summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorŁukasz Hryniuk <lukasz.hryniuk@wp.pl>2015-10-04 17:18:52 +0200
committerŁukasz Hryniuk <lukasz.hryniuk@wp.pl>2015-10-05 18:26:21 +0200
commit31a2ce06108c45f23ba7860e63bebeb299b57101 (patch)
tree7ba22353ec35130c9d739f5192662339fcdf262c /sc
parent46717d374f972cd5bf8e7e21614ebe3613060738 (diff)
Performance test for LCM
Change-Id: I054191884f9550d5f16de2c7af04231f71f16bfa
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/perf/scperfobj.cxx26
-rw-r--r--sc/qa/perf/testdocuments/scMathFunctions2.odsbin348797 -> 370571 bytes
2 files changed, 26 insertions, 0 deletions
diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx
index e2539b273175..f9b2e45c014c 100644
--- a/sc/qa/perf/scperfobj.cxx
+++ b/sc/qa/perf/scperfobj.cxx
@@ -63,6 +63,7 @@ public:
CPPUNIT_TEST(testChiTest);
CPPUNIT_TEST(testSumX2PY2Test);
CPPUNIT_TEST(testTTest);
+ CPPUNIT_TEST(testLcm);
CPPUNIT_TEST_SUITE_END();
private:
@@ -79,6 +80,7 @@ private:
void testChiTest();
void testSumX2PY2Test();
void testTTest();
+ void testLcm();
};
@@ -393,6 +395,30 @@ void ScPerfObj::testTTest()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong TTest result" , 0.0, xCell->getValue());
}
+void ScPerfObj::testLcm()
+{
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(init("scMathFunctions2.ods"), UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_MESSAGE("Problem in document loading" , xDoc.is());
+ uno::Reference< sheet::XCalculatable > xCalculatable(xDoc, UNO_QUERY_THROW);
+
+ // get getSheets
+ uno::Reference< sheet::XSpreadsheets > xSheets (xDoc->getSheets(), UNO_QUERY_THROW);
+
+ uno::Any rSheet = xSheets->getByName(OUString::createFromAscii("LCMSheet"));
+
+ // query for the XSpreadsheet interface
+ uno::Reference< sheet::XSpreadsheet > xSheet (rSheet, UNO_QUERY);
+ uno::Reference< table::XCell > xCell = xSheet->getCellByPosition(1, 0);
+
+ callgrindStart();
+ xCell->setFormula(OUString::createFromAscii("=LCM(A1:A10000)"));
+ xCalculatable->calculate();
+ callgrindDump("sc:lcm");
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong LCM" , 2520.0, xCell->getValue());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScPerfObj);
}
diff --git a/sc/qa/perf/testdocuments/scMathFunctions2.ods b/sc/qa/perf/testdocuments/scMathFunctions2.ods
index 8dbc1b9c100d..bc65a193fc24 100644
--- a/sc/qa/perf/testdocuments/scMathFunctions2.ods
+++ b/sc/qa/perf/testdocuments/scMathFunctions2.ods
Binary files differ