summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryiming ju <yiming@multicorewareinc.com>2013-11-12 17:18:50 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-15 11:54:31 -0600
commit67e2b033b1ba0938f294e853b98ce748e0fb1fa5 (patch)
tree0faaec43886968fee32da0a4f30dac39eed0278f
parentd470a9f978198812466832acf81ff0128c856da3 (diff)
GPU Calc: unit test cases for SUMX2MY2
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-198 BUG Change-Id: I8d3817c990b07310be31b3246af1b58b960c62d1 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/array/SUMX2MY2.xlsbin0 -> 24064 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx31
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 32 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/array/SUMX2MY2.xls b/sc/qa/unit/data/xls/opencl/array/SUMX2MY2.xls
new file mode 100644
index 000000000000..62d8c9a8c8d9
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/array/SUMX2MY2.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 7afe2d52032e..bffd36d885d9 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -230,6 +230,7 @@ public:
void testMathFormulaConvert();
void testMathFormulaProduct();
void testStatisticalFormulaHypGeomDist();
+ void testArrayFormulaSumX2MY2();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -391,6 +392,7 @@ public:
CPPUNIT_TEST(testMathFormulaConvert);
CPPUNIT_TEST(testMathFormulaProduct);
CPPUNIT_TEST(testStatisticalFormulaHypGeomDist);
+ CPPUNIT_TEST(testArrayFormulaSumX2MY2);
CPPUNIT_TEST_SUITE_END();
private:
@@ -4439,6 +4441,34 @@ void ScOpenclTest::testMathFormulaKombin()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-198]
+void ScOpenclTest:: testArrayFormulaSumX2MY2()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/array/SUMX2MY2.", XLS);
+ ScDocument *pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/array/SUMX2MY2.", XLS);
+ ScDocument *pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 0; i <= 9; ++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));
+ }
+ for (SCROW i = 20; i <= 26; ++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-199]
void ScOpenclTest::testStatisticalFormulaHypGeomDist()
{
@@ -4462,6 +4492,7 @@ void ScOpenclTest::testStatisticalFormulaHypGeomDist()
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 75b28a519341..38f1b13fdf2a 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1461,6 +1461,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocRandom:
case ocProduct:
case ocHypGeomDist:
+ case ocSumX2MY2:
// Don't change the state.
break;
default: