From a6ec887150d07ededcc2c333d60237581b28442f Mon Sep 17 00:00:00 2001 From: yiming ju Date: Fri, 8 Nov 2013 12:36:17 +0800 Subject: GPU Calc: unit test cases for CHISQDIST Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-139 BUG Change-Id: I4908543d895d35f667722ebffd92f40d0a3e5818 Signed-off-by: haochen Signed-off-by: I-Jui (Ray) Sung --- .../unit/data/ods/opencl/statistical/CHISQDIST.ods | Bin 0 -> 19796 bytes sc/qa/unit/opencl-test.cxx | 31 +++++++++++++++++++++ sc/source/core/tool/token.cxx | 1 + 3 files changed, 32 insertions(+) create mode 100644 sc/qa/unit/data/ods/opencl/statistical/CHISQDIST.ods (limited to 'sc') diff --git a/sc/qa/unit/data/ods/opencl/statistical/CHISQDIST.ods b/sc/qa/unit/data/ods/opencl/statistical/CHISQDIST.ods new file mode 100644 index 000000000000..81e84d15b394 Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/statistical/CHISQDIST.ods differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 7ebbb27db569..76cf866cc6a1 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -186,6 +186,7 @@ public: void testStatisticalFormulaChiDist(); void testMathFormulaPower(); void testMathFormulaOdd(); + void testStatisticalFormulaChiSqDist(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -303,6 +304,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaChiDist); CPPUNIT_TEST(testMathFormulaPower); CPPUNIT_TEST(testMathFormulaOdd); + CPPUNIT_TEST(testStatisticalFormulaChiSqDist); CPPUNIT_TEST_SUITE_END(); private: @@ -2965,6 +2967,35 @@ void ScOpenclTest:: testFinancialXirrFormula() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-139] +void ScOpenclTest::testStatisticalFormulaChiSqDist() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/statistical/CHISQDIST.", ODS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CHISQDIST.", ODS); + ScDocument* pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + // Check the results of formula cells in the shared formula range. + for (SCROW i = 1; i <= 9; ++i) + { + double fLibre = pDoc->GetValue(ScAddress(2,i,0)); + double fExcel = pDocRes->GetValue(ScAddress(2,i,0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + } + for (SCROW i = 1; i <= 9; ++i) + { + double fLibre = pDoc->GetValue(ScAddress(3,i,0)); + double fExcel = pDocRes->GetValue(ScAddress(3,i,0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + } + xDocSh->DoClose(); + xDocShRes->DoClose(); +} //[AMLOEXT-140] void ScOpenclTest::testStatisticalFormulaConfidence() { diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 3a099e1e28a1..11c5737184c8 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1419,6 +1419,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r ) case ocChiDist: case ocPower: case ocOdd: + case ocChiSqDist: // Don't change the state. break; default: -- cgit