summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryiming ju <yiming@multicorewareinc.com>2013-11-17 12:04:32 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-16 23:20:20 -0600
commitf7e6521efca5e5966a65e84848a1c35d71ba1a0b (patch)
tree76ab9adb32475d51e11fef2ccf02b21ef88923e1
parente57f015669d1a50e23347915613adcb8b42ea564 (diff)
GPU Calc: unit test cases for COVAR
Turn NO_FALLBACK_TO_SWINTERP on in formulagroupcl.cxx for test AMLOEXT-86 BUG Change-Id: Ie35b4fe1efcdd21e8488ce560c30bd3fca6aa30c 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/statistical/Covar.xlsbin0 -> 8192 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx27
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 28 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/statistical/Covar.xls b/sc/qa/unit/data/xls/opencl/statistical/Covar.xls
new file mode 100644
index 000000000000..fc559b0d50c3
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/statistical/Covar.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index cebdfa2909bf..07828836557e 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -238,6 +238,7 @@ public:
void testStatisticalFormulaTInv();
void testArrayFormulaSumXMY2();
void testStatisticalFormulaStDevP();
+ void testStatisticalFormulaCovar();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -407,6 +408,7 @@ public:
CPPUNIT_TEST(testStatisticalFormulaTInv);
CPPUNIT_TEST(testArrayFormulaSumXMY2);
CPPUNIT_TEST(testStatisticalFormulaStDevP);
+ CPPUNIT_TEST(testStatisticalFormulaCovar);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1951,6 +1953,31 @@ void ScOpenclTest::testMathFormulaCosh()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+void ScOpenclTest::testStatisticalFormulaCovar()
+{
+ if (!detectOpenCLDevice())
+ return;
+
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/Covar.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Covar.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ // Check the results of formula cells in the shared formula range.
+ for (SCROW i = 0; i <= 16; ++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-87]
void ScOpenclTest::testStatisticalFormulaKurt()
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 77ea7362727d..b8a509536049 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1469,6 +1469,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocTInv:
case ocSumXMY2:
case ocStDevP:
+ case ocCovar:
// Don't change the state.
break;
default: