diff options
author | fengzeng <fengzeng@multicorewareinc.com> | 2013-11-10 08:10:22 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-14 20:30:39 -0600 |
commit | a9edef9c11cd5529f4995645d4649a2189be0a29 (patch) | |
tree | 14b97d390afde1eaaecf95f8c4548db3cebca350 /sc | |
parent | 9558470f2dea5679ba3a35550743ba88a1377da3 (diff) |
GPU Calc: unit test cases for TRUNC
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test
AMLOEXT-84 BUG
Change-Id: I96d14bd61d6694a5aa2ebf7ca1a53b8ee9de255d
Signed-off-by: haochen <haochen@multicorewareinc.com>
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xls/opencl/math/trunc.xls | bin | 0 -> 24576 bytes | |||
-rw-r--r-- | sc/qa/unit/opencl-test.cxx | 24 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/math/trunc.xls b/sc/qa/unit/data/xls/opencl/math/trunc.xls Binary files differnew file mode 100644 index 000000000000..a64b591d7162 --- /dev/null +++ b/sc/qa/unit/data/xls/opencl/math/trunc.xls diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 9b68e14988eb..91413f7be42f 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -204,6 +204,7 @@ public: void testMathFormulaEven(); void testMathFormulaLog(); void testMathFormulaMod(); + void testMathFormulaTrunc(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -339,6 +340,7 @@ public: CPPUNIT_TEST(testMathFormulaEven); CPPUNIT_TEST(testMathFormulaLog); CPPUNIT_TEST(testMathFormulaMod); + CPPUNIT_TEST(testMathFormulaTrunc); CPPUNIT_TEST_SUITE_END(); private: @@ -1720,6 +1722,28 @@ void ScOpenclTest::testStatisticalFormulaRsq() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-84] +void ScOpenclTest::testMathFormulaTrunc() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/math/trunc.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/math/trunc.", XLS); + ScDocument* pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + for (SCROW i = 0; i <= 15; ++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(); +} //[AMLOEXT-85] void ScOpenclTest::testMathFormulaCosh() { diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index e9adcef5754d..f065e83b5cc8 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1436,6 +1436,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r ) case ocEven: case ocLog: case ocMod: + case ocTrunc: // Don't change the state. break; default: |