From c6a035a2a5259bea7da3867300471182b3e38ed2 Mon Sep 17 00:00:00 2001
From: mingli <mingli@multicorewareinc.com>
Date: Tue, 24 Dec 2013 13:39:24 +0800
Subject: GPU Calc: unit test cases for AVEDEV

Turn  NO_FALLBACK_TO_SWINTERP on in formulagroupcl.cxx for test

AMLOEXT-379 BUG

Change-Id: I575c5f1c2f4648232cdf4982514f0d2571fa139d
Signed-off-by: haochen <haochen@multicorewareinc.com>
Signed-off-by: Wei Wei <weiwei@multicorewareinc.com>
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
---
 sc/qa/unit/data/xls/opencl/statistical/Avedev.xls | Bin 0 -> 8704 bytes
 sc/qa/unit/opencl-test.cxx                        |  29 +++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 sc/qa/unit/data/xls/opencl/statistical/Avedev.xls

(limited to 'sc/qa')

diff --git a/sc/qa/unit/data/xls/opencl/statistical/Avedev.xls b/sc/qa/unit/data/xls/opencl/statistical/Avedev.xls
new file mode 100644
index 000000000000..d085313dcbdf
Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/statistical/Avedev.xls differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 225e297ea17f..4103dad757f1 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -285,6 +285,7 @@ public:
     void testMathFormulaSumIf();
     void testAddInFormulaBesseLJ();
     void testNegSub();
+    void testStatisticalFormulaAvedev();
     CPPUNIT_TEST_SUITE(ScOpenclTest);
     CPPUNIT_TEST(testSharedFormulaXLS);
     CPPUNIT_TEST(testFinacialFormula);
@@ -501,6 +502,7 @@ public:
     CPPUNIT_TEST(testMathFormulaSumIf);
     CPPUNIT_TEST(testAddInFormulaBesseLJ);
     CPPUNIT_TEST(testNegSub);
+    CPPUNIT_TEST(testStatisticalFormulaAvedev);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -5893,7 +5895,32 @@ void ScOpenclTest::testAddInFormulaBesseLJ()
     xDocSh->DoClose();
     xDocShRes->DoClose();
 }
-//[AMLOEXT-381]
+//AMLOEXT-379
+void ScOpenclTest::testStatisticalFormulaAvedev()
+{
+    if (!detectOpenCLDevice())
+        return;
+
+    ScDocShellRef xDocSh = loadDoc("opencl/statistical/Avedev.", XLS);
+    ScDocument* pDoc = xDocSh->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+    enableOpenCL();
+    pDoc->CalcAll();
+    ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Avedev.", XLS);
+    ScDocument* pDocRes = xDocShRes->GetDocument();
+    CPPUNIT_ASSERT(pDocRes);
+    // Check the results of formula cells in the shared formula range.
+    for (SCROW i = 1; i <= 19; ++i)
+    {
+        double fLibre = pDoc->GetValue(ScAddress(3,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+    }
+    xDocSh->DoClose();
+    xDocShRes->DoClose();
+}
+
+//[AMLOEXT-383]
 void ScOpenclTest::testNegSub()
 {
     if (!detectOpenCLDevice())
-- 
cgit