diff options
author | yiming ju <yiming@multicorewareinc.com> | 2013-11-09 18:14:48 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-14 20:13:00 -0600 |
commit | 66a36c944021f7bc845d291f931b52bbbf3e1212 (patch) | |
tree | 730f435d927e69bbc0cdb87991ddbb1d00557faf | |
parent | 25ed52d2671a630b7be22c8019fa1bc333618982 (diff) |
GPU Calc: unit test cases for COUNTIF
Need to turn on NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test
AMLOEXT-176 BUG
Change-Id: Ia00cf13978f38e9b7272511235e9d45ef80886c8
Signed-off-by: haochen <haochen@multicorewareinc.com>
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r-- | sc/qa/unit/data/xls/opencl/math/countifs.xls | bin | 0 -> 27648 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/countifs.xls b/sc/qa/unit/data/xls/opencl/math/countifs.xls Binary files differnew file mode 100644 index 000000000000..12230109bd60 --- /dev/null +++ b/sc/qa/unit/data/xls/opencl/math/countifs.xls diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 1d6ce2006b14..bdaa94a6d2b2 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -199,6 +199,7 @@ public: void testMathFormulaLog10(); void testStatisticalFormulaExpondist(); void testMathAverageIfsFormula(); + void testMathCountIfsFormula(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -329,6 +330,7 @@ public: CPPUNIT_TEST(testMathFormulaLog10); CPPUNIT_TEST(testStatisticalFormulaExpondist); CPPUNIT_TEST(testMathAverageIfsFormula); + CPPUNIT_TEST(testMathCountIfsFormula); CPPUNIT_TEST_SUITE_END(); private: @@ -3622,6 +3624,28 @@ void ScOpenclTest::testMathFormulaFloor() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[ AMLOEXT-176 ] +void ScOpenclTest::testMathCountIfsFormula() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/math/countifs.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + sc::FormulaGroupInterpreter::enableOpenCL(true); + xDocSh->DoHardRecalc(true); + ScDocShellRef xDocShRes = loadDoc("opencl/math/countifs.", XLS); + ScDocument* pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + for (SCROW i = 1; i < 10; ++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-179] void ScOpenclTest::testMathAverageIfsFormula() { diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index a37d52820619..241afcca4d9c 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1431,6 +1431,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r ) case ocLog10: case ocExpDist: case ocAverageIfs: + case ocCountIfs: // Don't change the state. break; default: |