summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryiming ju <yiming@multicorewareinc.com>2013-11-05 14:55:02 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-13 00:45:01 -0600
commit29d038548c5c507e16483296d860b8f8beaa8082 (patch)
treec3bfbd9880507f011c15efce15c69acdc5b5bfba
parentGPU Calc: implemented for SUMIFS (diff)
downloadcore-29d038548c5c507e16483296d860b8f8beaa8082.tar.gz
core-29d038548c5c507e16483296d860b8f8beaa8082.zip
GPU Calc: unit test cases for SUMIFS
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-128 BUG Change-Id: I32a5e83a61987cbdb45e7522f2893bdebadbe7c4 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/sumifs.xlsbin0 -> 1693184 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx42
2 files changed, 42 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/math/sumifs.xls b/sc/qa/unit/data/xls/opencl/math/sumifs.xls
new file mode 100644
index 000000000000..4ee7274d5b76
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/math/sumifs.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 6fd60a472a0e..8d5d1d61ed0f 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -137,6 +137,7 @@ public:
void testFinancialDDBFormula();
void testFinancialFVFormula();
void testFinancialMDurationFormula();
+ void testMathSumIfsFormula();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -205,6 +206,7 @@ public:
CPPUNIT_TEST(testFinancialDDBFormula);
CPPUNIT_TEST(testFinancialFVFormula);
CPPUNIT_TEST(testFinancialMDurationFormula);
+ CPPUNIT_TEST(testMathSumIfsFormula);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2046,6 +2048,46 @@ void ScOpenclTest:: testFinancialFVFormula()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-128]
+void ScOpenclTest::testMathSumIfsFormula()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/math/sumifs.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ sc::FormulaGroupInterpreter::enableOpenCL(true);
+ xDocSh->DoHardRecalc(true);
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/sumifs.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 2; i <= 11; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(5,i,0));
+ double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ for (SCROW i = 2; i <= 11; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(6,i,0));
+ double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ for (SCROW i = 2; i <= 11; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(7,i,0));
+ double fExcel = pDocRes->GetValue(ScAddress(7,i,0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ for (SCROW i = 2; i <= 11; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(8,i,0));
+ double fExcel = pDocRes->GetValue(ScAddress(8,i,0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ xDocSh->DoClose();
+ xDocShRes->DoClose();
+}
ScOpenclTest::ScOpenclTest()
: ScBootstrapFixture( "/sc/qa/unit/data" )
{