From 42268b559a718a182cc41476f0d05e1af82f64ae Mon Sep 17 00:00:00 2001 From: Ɓukasz Hryniuk Date: Sun, 4 Oct 2015 19:58:16 +0200 Subject: Performance test for PEARSON Change-Id: Ifd7fe80c6eeea07a824fe9118425760f2558b1e0 --- sc/qa/perf/scperfobj.cxx | 27 ++++++++++++++++++++++++++ sc/qa/perf/testdocuments/scMathFunctions2.ods | Bin 434407 -> 731363 bytes 2 files changed, 27 insertions(+) (limited to 'sc') 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 index b5f838a50636..91464decca03 100644 Binary files a/sc/qa/perf/testdocuments/scMathFunctions2.ods and b/sc/qa/perf/testdocuments/scMathFunctions2.ods differ -- cgit