sc/qa/perf/scperfobj.cxx | 131 ++++++++++++++++++++++++++ sc/qa/perf/testdocuments/scMathFunctions2.ods |binary 2 files changed, 131 insertions(+)
New commits: commit 42268b559a718a182cc41476f0d05e1af82f64ae Author: Åukasz Hryniuk <[email protected]> Date: Sun Oct 4 19:58:16 2015 +0200 Performance test for PEARSON Change-Id: Ifd7fe80c6eeea07a824fe9118425760f2558b1e0 diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx index aa098cf..41632d0 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 b5f838a..91464de 100644 Binary files a/sc/qa/perf/testdocuments/scMathFunctions2.ods and b/sc/qa/perf/testdocuments/scMathFunctions2.ods differ commit a285df4ea9805e7cf1071747e0b7adaf6ed52fff Author: Åukasz Hryniuk <[email protected]> Date: Sun Oct 4 19:54:54 2015 +0200 Performance test for GCD Change-Id: I33504157bf10aadf5f010249aa35beefc4dbb972 diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx index f9b2e45..aa098cf 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 bc65a19..b5f838a 100644 Binary files a/sc/qa/perf/testdocuments/scMathFunctions2.ods and b/sc/qa/perf/testdocuments/scMathFunctions2.ods differ commit 31a2ce06108c45f23ba7860e63bebeb299b57101 Author: Åukasz Hryniuk <[email protected]> Date: Sun Oct 4 17:18:52 2015 +0200 Performance test for LCM Change-Id: I054191884f9550d5f16de2c7af04231f71f16bfa diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx index e2539b2..f9b2e45 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 8dbc1b9..bc65a19 100644 Binary files a/sc/qa/perf/testdocuments/scMathFunctions2.ods and b/sc/qa/perf/testdocuments/scMathFunctions2.ods differ commit 46717d374f972cd5bf8e7e21614ebe3613060738 Author: Åukasz Hryniuk <[email protected]> Date: Sun Oct 4 17:17:17 2015 +0200 Performance test for TTEST Change-Id: I05e34b24ed074a9f33d2a860f9042c85d7b556bc diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx index 5cb11f26..e2539b2 100644 --- a/sc/qa/perf/scperfobj.cxx +++ b/sc/qa/perf/scperfobj.cxx @@ -62,6 +62,7 @@ public: CPPUNIT_TEST(testFTest); CPPUNIT_TEST(testChiTest); CPPUNIT_TEST(testSumX2PY2Test); + CPPUNIT_TEST(testTTest); CPPUNIT_TEST_SUITE_END(); private: @@ -77,6 +78,7 @@ private: void testFTest(); void testChiTest(); void testSumX2PY2Test(); + void testTTest(); }; @@ -367,6 +369,30 @@ void ScPerfObj::testSumX2PY2Test() CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong SumX2PY2 result" , 574539.0, xCell->getValue()); } +void ScPerfObj::testTTest() +{ + 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("TTestSheet")); + + // 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("=T.TEST(B1:CV100;CW1:GQ100;2;1)")); + xCalculatable->calculate(); + callgrindDump("sc:ttest"); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong TTest result" , 0.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 094c3ec..8dbc1b9 100644 Binary files a/sc/qa/perf/testdocuments/scMathFunctions2.ods and b/sc/qa/perf/testdocuments/scMathFunctions2.ods differ commit 56d282666b5aa19d8de11b2e2288224beaf33a8b Author: Åukasz Hryniuk <[email protected]> Date: Sun Oct 4 17:15:29 2015 +0200 Performance test for SUMX2PY2 Change-Id: If7cf21e0345a1dd5a8eb0100a684c8272c7e2bce diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx index 42cc0eb..5cb11f26 100644 --- a/sc/qa/perf/scperfobj.cxx +++ b/sc/qa/perf/scperfobj.cxx @@ -61,6 +61,7 @@ public: CPPUNIT_TEST(testSum); CPPUNIT_TEST(testFTest); CPPUNIT_TEST(testChiTest); + CPPUNIT_TEST(testSumX2PY2Test); CPPUNIT_TEST_SUITE_END(); private: @@ -75,6 +76,7 @@ private: void testSum(); void testFTest(); void testChiTest(); + void testSumX2PY2Test(); }; @@ -341,6 +343,30 @@ void ScPerfObj::testChiTest() CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Wrong ChiTest result" , 0.0, xCell->getValue(), 10e-4); } +void ScPerfObj::testSumX2PY2Test() +{ + 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("SumX2PY2Sheet")); + + // query for the XSpreadsheet interface + uno::Reference< sheet::XSpreadsheet > xSheet (rSheet, UNO_QUERY); + uno::Reference< table::XCell > xCell = xSheet->getCellByPosition(2, 0); + + callgrindStart(); + xCell->setFormula(OUString::createFromAscii("=SUMX2PY2(A1:A10000;B1:B10000)")); + xCalculatable->calculate(); + callgrindDump("sc:sumx2py2"); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong SumX2PY2 result" , 574539.0, xCell->getValue()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPerfObj); } diff --git a/sc/qa/perf/testdocuments/scMathFunctions2.ods b/sc/qa/perf/testdocuments/scMathFunctions2.ods new file mode 100644 index 0000000..094c3ec Binary files /dev/null and b/sc/qa/perf/testdocuments/scMathFunctions2.ods differ
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
