summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-22 22:13:18 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-24 08:15:43 +0100
commitcf7b00b34fb06b1fd36e623b06cf91cfe3a8e792 (patch)
tree26394fe4daafb46a8104efef86ceb1323d3362b3 /sc/qa
parent673b22a7811a4e341d7a0e8ef9cf61dbc607b97e (diff)
add test for wrong matrix calculations
Change-Id: Ie4e5169eba887ff373d7c1317efe725e9efa8c28
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx23
2 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 0c39d6f3576c..013ac2691882 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -177,6 +177,7 @@ public:
void testFuncNOW();
void testFuncGETPIVOTDATA();
void testFuncGETPIVOTDATALeafAccess();
+ void testMatrixOp();
void testExternalRef();
void testExternalRefFunctions();
@@ -483,6 +484,7 @@ public:
CPPUNIT_TEST(testFuncIFERROR);
CPPUNIT_TEST(testFuncGETPIVOTDATA);
CPPUNIT_TEST(testFuncGETPIVOTDATALeafAccess);
+ CPPUNIT_TEST(testMatrixOp);
CPPUNIT_TEST(testExternalRef);
CPPUNIT_TEST(testExternalRefFunctions);
CPPUNIT_TEST(testCopyToDocument);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 5deed054cf14..ab23102a83f8 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -4847,4 +4847,27 @@ void Test::testExternalRefFunctions()
m_pDoc->DeleteTab(0);
}
+void Test::testMatrixOp()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ for (SCROW nRow = 0; nRow < 4; ++nRow)
+ {
+ m_pDoc->SetValue(0, nRow, 0, nRow);
+ }
+ m_pDoc->SetValue(1, 0, 0, 2.0);
+ m_pDoc->SetValue(3, 0, 0, 1.0);
+ m_pDoc->SetValue(3, 1, 0, 2.0);
+ m_pDoc->SetString(2, 0, 0, "=SUMPRODUCT((A1:A4)*B1+D1)");
+ m_pDoc->SetString(2, 1, 0, "=SUMPRODUCT((A1:A4)*B1-D2)");
+
+ double nVal = m_pDoc->GetValue(2, 0, 0);
+ CPPUNIT_ASSERT_EQUAL(16.0, nVal);
+
+ nVal = m_pDoc->GetValue(2, 1, 0);
+ CPPUNIT_ASSERT_EQUAL(4.0, nVal);
+
+ m_pDoc->DeleteTab(0);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */