summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfengzeng <fengzeng@multicorewareinc.com>2013-12-13 13:14:53 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-12-19 17:53:55 -0600
commit9f3ad30a94dbf5fc51a9d491f5e3b66ae4218772 (patch)
tree8ace6b0edeaac0589f08914e484994e6dd94a8c6
parente25d9b6cbe032f9d0a47279056c4a8554967cff4 (diff)
GPU Calc: unit test cases for COUNTIF
turn NO_FALLBACK_TO_SWINTERP on in formulagroupcl.cxx for test AMLOEXT-360 BUG Change-Id: I325229533d702c5914eb733c7a3d605c67b9969e Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: Wei Wei <weiwei@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/qa/unit/data/xls/opencl/math/countif.xlsbin0 -> 25600 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx25
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 25 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xls/opencl/math/countif.xls b/sc/qa/unit/data/xls/opencl/math/countif.xls
new file mode 100644
index 000000000000..06c715c4525b
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/math/countif.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index c8e45b911e93..1bfb6d27c354 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -265,6 +265,7 @@ public:
void testMathFormulaRoundDown();
void testMathFormulaInt();
void testMathFormulaRadians();
+ void testMathFormulaCountIf();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -461,6 +462,7 @@ public:
CPPUNIT_TEST(testMathFormulaRoundDown);
CPPUNIT_TEST(testMathFormulaInt);
CPPUNIT_TEST(testMathFormulaRadians);
+ CPPUNIT_TEST(testMathFormulaCountIf);
CPPUNIT_TEST_SUITE_END();
private:
@@ -5409,7 +5411,28 @@ void ScOpenclTest::testMathFormulaDegrees()
xDocSh->DoClose();
xDocShRes->DoClose();
}
-
+//[AMLOEXT-360]
+void ScOpenclTest::testMathFormulaCountIf()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/math/countif.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/countif.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 0; i <= 26; ++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" )
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index d598e0e10891..43ed108ebb9e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1493,6 +1493,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocRoundDown:
case ocInt:
case ocRad:
+ case ocCountIf:
// Don't change the state.
break;
default: