summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-05-04 22:05:51 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-05-04 22:05:51 -0400
commitdafbd8ef18252e18c6622ee636b0f5ee0a84bfcd (patch)
tree35688f1aaf53f6f73ef0d1a80cc7ff87d091071d /sc/qa
parent75a87836d75100fc4da446e9ce57a0862b6f0295 (diff)
Added unit test for PRODUCT cell function with inline array.
3.3.2 didn't calculate this correctly.
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.cxx25
1 files changed, 22 insertions, 3 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 35558d1a75a3..8c3c37ecc726 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -224,7 +224,7 @@ public:
void testCollator();
void testInput();
- void testSUM();
+ void testCellFunctions();
void testVolatileFunc();
void testFuncParam();
void testNamedRange();
@@ -264,7 +264,7 @@ public:
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testCollator);
CPPUNIT_TEST(testInput);
- CPPUNIT_TEST(testSUM);
+ CPPUNIT_TEST(testCellFunctions);
CPPUNIT_TEST(testVolatileFunc);
CPPUNIT_TEST(testFuncParam);
CPPUNIT_TEST(testNamedRange);
@@ -398,11 +398,13 @@ void Test::testInput()
m_pDoc->DeleteTab(0);
}
-void Test::testSUM()
+void Test::testCellFunctions()
{
rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("foo"));
CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
m_pDoc->InsertTab (0, aTabName));
+
+ // SUM
double val = 1;
m_pDoc->SetValue (0, 0, 0, val);
m_pDoc->SetValue (0, 1, 0, val);
@@ -412,6 +414,23 @@ void Test::testSUM()
m_pDoc->GetValue (0, 2, 0, result);
CPPUNIT_ASSERT_MESSAGE ("calculation failed", result == 2.0);
+ // PRODUCT
+ val = 1;
+ m_pDoc->SetValue(0, 0, 0, val);
+ val = 2;
+ m_pDoc->SetValue(0, 1, 0, val);
+ val = 3;
+ m_pDoc->SetValue(0, 2, 0, val);
+ m_pDoc->SetString(0, 3, 0, OUString(RTL_CONSTASCII_USTRINGPARAM("=PRODUCT(A1:A3)")));
+ m_pDoc->CalcAll();
+ m_pDoc->GetValue(0, 3, 0, result);
+ CPPUNIT_ASSERT_MESSAGE("Calculation of PRODUCT failed", result == 6.0);
+
+ m_pDoc->SetString(0, 4, 0, OUString(RTL_CONSTASCII_USTRINGPARAM("=PRODUCT({1;2;3})")));
+ m_pDoc->CalcAll();
+ m_pDoc->GetValue(0, 4, 0, result);
+ CPPUNIT_ASSERT_MESSAGE("Calculation of PRODUCT with inline array failed", result == 6.0);
+
m_pDoc->DeleteTab(0);
}