diff options
author | Łukasz Hryniuk <lukasz.hryniuk@wp.pl> | 2015-08-08 20:50:04 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-08-10 21:50:31 +0000 |
commit | fc71e5b4637ece8822e83c844d191f461b2f0177 (patch) | |
tree | deabb6e261e57476b14884fabaeacca182c30ed8 /sc | |
parent | d5bff1225a6739e8369bacd8392686bd26630d2f (diff) |
tdf#89387 related tests for ScSumXMY2()
Change-Id: Ia2ea65e05e0eec996f8ac485ee74b6daaa459178
Reviewed-on: https://gerrit.libreoffice.org/17598
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 30 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 759d65dd8351..7c54dc02ef68 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -160,6 +160,7 @@ public: void testFuncSUM(); void testFuncPRODUCT(); void testFuncSUMPRODUCT(); + void testFuncSUMXMY2(); void testFuncMIN(); void testFuncN(); void testFuncCOUNTIF(); @@ -491,6 +492,7 @@ public: CPPUNIT_TEST(testFuncSUM); CPPUNIT_TEST(testFuncPRODUCT); CPPUNIT_TEST(testFuncSUMPRODUCT); + CPPUNIT_TEST(testFuncSUMXMY2); CPPUNIT_TEST(testFuncMIN); CPPUNIT_TEST(testFuncN); CPPUNIT_TEST(testFuncCOUNTIF); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 38ac04a9b806..720ff5ef027e 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -3369,6 +3369,36 @@ void Test::testFuncSUMPRODUCT() m_pDoc->DeleteTab(0); } +void Test::testFuncSUMXMY2() +{ + m_pDoc->InsertTab(0, "Test SumXMY2"); + + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto recalc. + + ScAddress aPos(0,0,0); + m_pDoc->SetString(aPos, "=SUMXMY2(B1:B3;C1:C3)"); + CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(aPos)); + m_pDoc->SetValue(ScAddress(1,0,0), 1.0); // B1 + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(aPos)); + m_pDoc->SetValue(ScAddress(1,1,0), 2.0); // B2 + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(aPos)); + m_pDoc->SetValue(ScAddress(1,2,0), 3.0); // B3 + CPPUNIT_ASSERT_EQUAL(14.0, m_pDoc->GetValue(aPos)); + m_pDoc->SetValue(ScAddress(2,0,0), -1.0); // C1 + CPPUNIT_ASSERT_EQUAL(17.0, m_pDoc->GetValue(aPos)); + m_pDoc->SetValue(ScAddress(2,1,0), 3.0); // C2 + CPPUNIT_ASSERT_EQUAL(14.0, m_pDoc->GetValue(aPos)); + m_pDoc->SetValue(ScAddress(2,2,0), 1.0); // C3 + CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(aPos)); + + double result = 0.0; + m_pDoc->SetString(0, 4, 0, OUString("=SUMXMY2({2;3;4};{4;3;2})")); + m_pDoc->GetValue(0, 4, 0, result); + CPPUNIT_ASSERT_MESSAGE("Calculation of SUMXMY2 with inline arrays failed", result == 8.0); + + m_pDoc->DeleteTab(0); +} + void Test::testFuncMIN() { sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto recalc. |