summaryrefslogtreecommitdiff
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
commit1100b09b45af0d9a4d8afd76791326232d35b3f2 (patch)
tree00c392993871f44ceffd4bbf74771ec9407c7a1d
parente43736eda4df49bd1c592ba1c7a7c26bcc6a2083 (diff)
Added unit test for PRODUCT cell function with inline array.
3.3.2 didn't calculate this correctly.
-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 dd86f8b00..0ab6d32b0 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);
}