From a30a12b1cc81441a7e490465ec5ad4ab070a661d Mon Sep 17 00:00:00 2001 From: hongyu zhong Date: Mon, 11 Nov 2013 16:30:22 +0800 Subject: GPU Calc: unit test cases for BINOMDIST Need to turn on NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-192 BUG Change-Id: If6fad4b811f46f88895c6c841cc9754244968728 Signed-off-by: haochen Signed-off-by: I-Jui (Ray) Sung --- .../unit/data/xls/opencl/statistical/BinomDist.xls | Bin 0 -> 8192 bytes sc/qa/unit/opencl-test.cxx | 25 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 sc/qa/unit/data/xls/opencl/statistical/BinomDist.xls (limited to 'sc/qa/unit') diff --git a/sc/qa/unit/data/xls/opencl/statistical/BinomDist.xls b/sc/qa/unit/data/xls/opencl/statistical/BinomDist.xls new file mode 100644 index 000000000000..09c712be851c Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/statistical/BinomDist.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index b00d1e299b55..8a4eaf94d04c 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -216,6 +216,7 @@ public: void testMathFormulaSumSQ(); void testStatisticalFormulaSkewp(); void testMathFormulaSqrtPi(); + void testStatisticalFormulaBinomDist(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -363,6 +364,7 @@ public: CPPUNIT_TEST(testMathFormulaSumSQ); CPPUNIT_TEST(testStatisticalFormulaSkewp); CPPUNIT_TEST(testMathFormulaSqrtPi); + CPPUNIT_TEST(testStatisticalFormulaBinomDist); CPPUNIT_TEST_SUITE_END(); private: @@ -4101,6 +4103,29 @@ void ScOpenclTest::testMathFormulaSqrtPi() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-192] +void ScOpenclTest::testStatisticalFormulaBinomDist() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/statistical/BinomDist.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/BinomDist.", XLS); + 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(1,i,0)); + double fExcel = pDocRes->GetValue(ScAddress(1,i,0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + } + xDocSh->DoClose(); + xDocShRes->DoClose(); +} ScOpenclTest::ScOpenclTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { -- cgit