summaryrefslogtreecommitdiff
path: root/sc/qa/unit
diff options
context:
space:
mode:
authoryiming ju <yiming@multicorewareinc.com>2013-11-09 13:40:38 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 19:45:35 -0600
commit5b5638007226181fc01aba33ecb2fd198366d26f (patch)
treebf518496be9b09e61e3674f6c1fb6deeb66db74d /sc/qa/unit
parent0324f62f6c578f7372649806b69615e157397089 (diff)
GPU Calc: unit test cases for AVERAGEIF
Need to turn on NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-179 BUG Change-Id: I5aba4a353469a4718b1e64ad30a7e7b90afee65f Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc/qa/unit')
-rw-r--r--sc/qa/unit/data/xls/opencl/math/averageifs.xlsbin0 -> 27648 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx25
2 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/math/averageifs.xls b/sc/qa/unit/data/xls/opencl/math/averageifs.xls
new file mode 100644
index 000000000000..d022e7ce25b6
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/math/averageifs.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 58f832118538..1d6ce2006b14 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -198,6 +198,7 @@ public:
void testMathFormulaExp();
void testMathFormulaLog10();
void testStatisticalFormulaExpondist();
+ void testMathAverageIfsFormula();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -327,6 +328,7 @@ public:
CPPUNIT_TEST(testMathFormulaExp);
CPPUNIT_TEST(testMathFormulaLog10);
CPPUNIT_TEST(testStatisticalFormulaExpondist);
+ CPPUNIT_TEST(testMathAverageIfsFormula);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3620,6 +3622,29 @@ void ScOpenclTest::testMathFormulaFloor()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[ AMLOEXT-179]
+void ScOpenclTest::testMathAverageIfsFormula()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/math/averageifs.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ sc::FormulaGroupInterpreter::enableOpenCL(true);
+ xDocSh->DoHardRecalc(true);
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/averageifs.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 1; i <= 11; ++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-180]
void ScOpenclTest::testMathFormulaLog10()
{