From b07bfeea13e32a6fbf70d5932901a95c02ebf878 Mon Sep 17 00:00:00 2001 From: yiming ju Date: Thu, 7 Nov 2013 14:54:11 +0800 Subject: GPU Calc: unit test cases for LN Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-154 BUG Change-Id: Icf35e717a740515e86195699b776d0910c71b1f0 Signed-off-by: haochen Signed-off-by: I-Jui (Ray) Sung --- sc/qa/unit/data/xls/opencl/math/LN.xls | Bin 0 -> 6144 bytes sc/qa/unit/opencl-test.cxx | 25 +++++++++++++++++++++++++ sc/source/core/tool/token.cxx | 1 + 3 files changed, 26 insertions(+) create mode 100644 sc/qa/unit/data/xls/opencl/math/LN.xls (limited to 'sc') diff --git a/sc/qa/unit/data/xls/opencl/math/LN.xls b/sc/qa/unit/data/xls/opencl/math/LN.xls new file mode 100644 index 000000000000..e57d809ae846 Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/math/LN.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 4c27c586456b..ffd7e8c7f036 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -176,6 +176,7 @@ public: void testStatisticalFormulaForecast(); void testStatisticalFormulaLogNormDist(); void testStatisticalFormulaGammaDist(); + void testMathFormulaLN(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -283,6 +284,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaForecast); CPPUNIT_TEST(testStatisticalFormulaLogNormDist); CPPUNIT_TEST(testStatisticalFormulaGammaDist); + CPPUNIT_TEST(testMathFormulaLN); CPPUNIT_TEST_SUITE_END(); private: @@ -3046,6 +3048,29 @@ void ScOpenclTest::testMathFormulaBitAnd() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-154] +void ScOpenclTest::testMathFormulaLN() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/math/LN.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/math/LN.", 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(); +} //[AMLOEXT-157] void ScOpenclTest::testStatisticalFormulaGammaDist() { diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 1fb60b2bc465..2e4aa241f7a5 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1410,6 +1410,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r ) case ocForecast: case ocLogNormDist: case ocGammaDist: + case ocLn: // Don't change the state. break; default: -- cgit