From 9f2ebf896982ecd6fe065f77054256fb845fc049 Mon Sep 17 00:00:00 2001 From: shiming zhang Date: Wed, 18 Dec 2013 15:46:56 +0800 Subject: GPU Calc: unit test cases for besselj Turn NO_FALLBACK_TO_SWINTERP on in formulagroupcl.cxx for test AMLOEXT-378 BUG Change-Id: I1cbc041e1aa1899fa10931e7bfc3f8c8b43066f6 Signed-off-by: haochen Signed-off-by: I-Jui (Ray) Sung Signed-off-by: Wei Wei --- sc/qa/unit/opencl-test.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'sc/qa/unit/opencl-test.cxx') diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 65528df6c3b5..3a1267417e2b 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -283,6 +283,7 @@ public: void testMathFormulaSeriesSum(); void testMathFormulaQuotient(); void testMathFormulaSumIf(); + void testAddInFormulaBesseLJ(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -496,6 +497,7 @@ public: CPPUNIT_TEST(testMathFormulaQuotient); CPPUNIT_TEST(testMathFormulaSeriesSum); CPPUNIT_TEST(testMathFormulaSumIf); + CPPUNIT_TEST(testAddInFormulaBesseLJ); CPPUNIT_TEST_SUITE_END(); private: @@ -5861,6 +5863,31 @@ void ScOpenclTest::testMathFormulaSumIf() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-378] +void ScOpenclTest::testAddInFormulaBesseLJ() +{ + if (!detectOpenCLDevice()) + return; + + ScDocShellRef xDocSh = loadDoc("opencl/addin/besselj.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + + ScDocShellRef xDocShRes = loadDoc("opencl/addin/besselj.", 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(2,i,0)); + double fExcel = pDocRes->GetValue(ScAddress(2,i,0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + } + xDocSh->DoClose(); + xDocShRes->DoClose(); +} ScOpenclTest::ScOpenclTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { -- cgit