summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordechuang <dechuang@multicorewareinc.com>2013-11-12 16:37:10 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-15 11:54:30 -0600
commit66ded6ba639ed8f14015db88367c6451ac54eece (patch)
treebe36b84018ba98acca9a16c7f0fd5e44b40be324
parent1de904adc62c7d6cd29ecf248dbe941a51e09646 (diff)
GPU Calc: unit test cases for PRODUCT
Need macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-193 BUG Change-Id: I7d866bebf2bd3d01a8ea0643561f918581af2c93 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/product.xlsbin0 -> 24064 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx24
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/math/product.xls b/sc/qa/unit/data/xls/opencl/math/product.xls
new file mode 100644
index 000000000000..34520f7a3f2f
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/math/product.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index c4d028e7bfe3..f5295badb11a 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -228,6 +228,7 @@ public:
void testMathFormulaPi();
void testMathFormulaRandom();
void testMathFormulaConvert();
+ void testMathFormulaProduct();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -387,6 +388,7 @@ public:
CPPUNIT_TEST(testMathFormulaPi);
CPPUNIT_TEST(testMathFormulaRandom);
CPPUNIT_TEST(testMathFormulaConvert);
+ CPPUNIT_TEST(testMathFormulaProduct);
CPPUNIT_TEST_SUITE_END();
private:
@@ -4390,6 +4392,28 @@ void ScOpenclTest::testStatisticalFormulaBinomDist()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-193]
+void ScOpenclTest::testMathFormulaProduct()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/math/product.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/product.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 0; i <= 3; ++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-194]
void ScOpenclTest::testMathFormulaKombin()
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index d2212dcfbf3a..750c60c447b7 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1459,6 +1459,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocZTest:
case ocPi:
case ocRandom:
+ case ocProduct:
// Don't change the state.
break;
default: