diff options
author | Łukasz Hryniuk <lukasz.hryniuk@wp.pl> | 2015-10-04 19:58:16 +0200 |
---|---|---|
committer | Łukasz Hryniuk <lukasz.hryniuk@wp.pl> | 2015-10-05 18:26:21 +0200 |
commit | 42268b559a718a182cc41476f0d05e1af82f64ae (patch) | |
tree | a746b80e73a42e4d4dfdd9e6e213de470adca007 /sc | |
parent | a285df4ea9805e7cf1071747e0b7adaf6ed52fff (diff) |
Performance test for PEARSON
Change-Id: Ifd7fe80c6eeea07a824fe9118425760f2558b1e0
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/perf/scperfobj.cxx | 27 | ||||
-rw-r--r-- | sc/qa/perf/testdocuments/scMathFunctions2.ods | bin | 434407 -> 731363 bytes |
2 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx index aa098cfbe595..41632d0ff8a1 100644 --- a/sc/qa/perf/scperfobj.cxx +++ b/sc/qa/perf/scperfobj.cxx @@ -65,6 +65,7 @@ public: CPPUNIT_TEST(testTTest); CPPUNIT_TEST(testLcm); CPPUNIT_TEST(testGcd); + CPPUNIT_TEST(testPearson); CPPUNIT_TEST_SUITE_END(); private: @@ -83,6 +84,7 @@ private: void testTTest(); void testLcm(); void testGcd(); + void testPearson(); }; @@ -445,6 +447,31 @@ void ScPerfObj::testGcd() CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong GCD", 3.0, xCell->getValue()); } +void ScPerfObj::testPearson() +{ + 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("PearsonSheet")); + + // query for the XSpreadsheet interface + uno::Reference< sheet::XSpreadsheet > xSheet (rSheet, UNO_QUERY); + uno::Reference< table::XCell > xCell = xSheet->getCellByPosition(0, 0); + + callgrindStart(); + xCell->setFormula(OUString::createFromAscii("=PEARSON(B1:CV100;CW1:GQ100)")); + xCalculatable->calculate(); + callgrindDump("sc:pearson"); + + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Wrong Pearson result" , 0.01255, xCell->getValue(), 10e-4); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(ScPerfObj); } diff --git a/sc/qa/perf/testdocuments/scMathFunctions2.ods b/sc/qa/perf/testdocuments/scMathFunctions2.ods Binary files differindex b5f838a50636..91464decca03 100644 --- a/sc/qa/perf/testdocuments/scMathFunctions2.ods +++ b/sc/qa/perf/testdocuments/scMathFunctions2.ods |