summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authoryangzhang <yangzhang@multicorewareinc.com>2013-11-04 14:58:13 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-05 13:29:21 -0600
commit73cde39d6314fcc426165d1fea204f78de847ffb (patch)
tree64db667432ac715cd38b1c589052bed3174e4f0b /sc/qa
parent289d4bf7e0631221a3b0b4a59e031069a608ab18 (diff)
GPU Calc: unit test cases for ABS
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-47 BUG Change-Id: Ie33b4e5fad47f58a33ecdb0405521e7df694148c Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/data/ods/opencl/math/Abs.odsbin0 -> 18827 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx28
2 files changed, 28 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/opencl/math/Abs.ods b/sc/qa/unit/data/ods/opencl/math/Abs.ods
new file mode 100644
index 000000000000..2e55c73c5b9c
--- /dev/null
+++ b/sc/qa/unit/data/ods/opencl/math/Abs.ods
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 88232aa97085..90867bae53a2 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -123,6 +123,7 @@ public:
void testFinancialDurationFormula();
void testFinancialCoupnumFormula();
void testMathFormulaSinh();
+ void testMathFormulaAbs();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -177,6 +178,7 @@ public:
CPPUNIT_TEST(testFinancialDurationFormula);
CPPUNIT_TEST(testFinancialCoupnumFormula);
CPPUNIT_TEST(testMathFormulaSinh);
+ CPPUNIT_TEST(testMathFormulaAbs);
CPPUNIT_TEST_SUITE_END();
private:
@@ -775,6 +777,32 @@ void ScOpenclTest::testFinacialFvscheduleFormula()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-47]
+void ScOpenclTest::testMathFormulaAbs()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh =
+ loadDoc("opencl/math/Abs.", ODS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes =
+ loadDoc("opencl/math/Abs.", ODS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+
+ // Verify ABS Function
+ for (SCROW i = 1; i <= 1000; ++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-69]
void ScOpenclTest::testFinacialSYDFormula()
{