summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorŁukasz Hryniuk <lukasz.hryniuk@wp.pl>2015-10-04 19:54:54 +0200
committerŁukasz Hryniuk <lukasz.hryniuk@wp.pl>2015-10-05 18:26:21 +0200
commita285df4ea9805e7cf1071747e0b7adaf6ed52fff (patch)
tree44ac3ddd3f7799722f5b35c6339063f5636ff861 /sc
parent31a2ce06108c45f23ba7860e63bebeb299b57101 (diff)
Performance test for GCD
Change-Id: I33504157bf10aadf5f010249aa35beefc4dbb972
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/perf/scperfobj.cxx26
-rw-r--r--sc/qa/perf/testdocuments/scMathFunctions2.odsbin370571 -> 434407 bytes
2 files changed, 26 insertions, 0 deletions
diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx
index f9b2e45c014c..aa098cfbe595 100644
--- a/sc/qa/perf/scperfobj.cxx
+++ b/sc/qa/perf/scperfobj.cxx
@@ -64,6 +64,7 @@ public:
CPPUNIT_TEST(testSumX2PY2Test);
CPPUNIT_TEST(testTTest);
CPPUNIT_TEST(testLcm);
+ CPPUNIT_TEST(testGcd);
CPPUNIT_TEST_SUITE_END();
private:
@@ -81,6 +82,7 @@ private:
void testSumX2PY2Test();
void testTTest();
void testLcm();
+ void testGcd();
};
@@ -419,6 +421,30 @@ void ScPerfObj::testLcm()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong LCM" , 2520.0, xCell->getValue());
}
+void ScPerfObj::testGcd()
+{
+ 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("GCDSheet"));
+
+ // 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("=GCD(A1:A10000)"));
+ xCalculatable->calculate();
+ callgrindDump("sc:gcd");
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong GCD", 3.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 bc65a193fc24..b5f838a50636 100644
--- a/sc/qa/perf/testdocuments/scMathFunctions2.ods
+++ b/sc/qa/perf/testdocuments/scMathFunctions2.ods
Binary files differ