From cb7e9881168c33b75db4803f144d9df69990f989 Mon Sep 17 00:00:00 2001 From: shiming zhang Date: Mon, 4 Nov 2013 17:11:40 +0800 Subject: GPU Calc: unit test cases for WEIBULL Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-78 BUG Change-Id: I4235313f70d2237ce06d4f71163d0d32bc0f064d Signed-off-by: haochen Signed-off-by: I-Jui (Ray) Sung --- sc/qa/unit/data/xls/opencl/statistical/Weibull.xls | Bin 0 -> 7168 bytes sc/qa/unit/opencl-test.cxx | 27 +++++++++++++++++++++ sc/source/core/tool/token.cxx | 1 + 3 files changed, 28 insertions(+) create mode 100644 sc/qa/unit/data/xls/opencl/statistical/Weibull.xls (limited to 'sc') diff --git a/sc/qa/unit/data/xls/opencl/statistical/Weibull.xls b/sc/qa/unit/data/xls/opencl/statistical/Weibull.xls new file mode 100644 index 000000000000..e94304195fef Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/statistical/Weibull.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index d108f83f0d8b..b40689411975 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -129,6 +129,7 @@ public: void testMathFormulaTan(); void testMathFormulaTanH(); void testStatisticalFormulaStandard(); + void testStatisticalFormulaWeibull(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -189,6 +190,7 @@ public: CPPUNIT_TEST(testMathFormulaTan); CPPUNIT_TEST(testMathFormulaTanH); CPPUNIT_TEST(testStatisticalFormulaStandard); + CPPUNIT_TEST(testStatisticalFormulaWeibull); CPPUNIT_TEST_SUITE_END(); private: @@ -1386,6 +1388,31 @@ void ScOpenclTest::testStatisticalFormulaStandard() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-78] +void ScOpenclTest::testStatisticalFormulaWeibull() +{ + if (!detectOpenCLDevice()) + return; + + ScDocShellRef xDocSh = loadDoc("opencl/statistical/Weibull.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Weibull.", XLS); + ScDocument* pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + // Check the results of formula cells in the shared formula range. + for (SCROW i = 1; i <= 20; ++i) + { + double fLibre = pDoc->GetValue(ScAddress(4,i,0)); + double fExcel = pDocRes->GetValue(ScAddress(4,i,0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + } + xDocSh->DoClose(); + xDocShRes->DoClose(); +} //[AMLOEXT-82] void ScOpenclTest::testStatisticalFormulaPearson() { diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 2de1508e21bc..e72e0263bcf1 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1375,6 +1375,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r ) case ocTan: case ocTanHyp: case ocStandard: + case ocWeibull: // Don't change the state. break; default: -- cgit