summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryiming ju <yiming@multicorewareinc.com>2013-11-08 12:36:17 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:45 -0600
commita6ec887150d07ededcc2c333d60237581b28442f (patch)
tree661aa69ae65f2cc1c8f73f38c35e07f974980eb1
parent800eb0eb9a145c878d8dcaf42c09fa8b66d36771 (diff)
GPU Calc: unit test cases for CHISQDIST
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-139 BUG Change-Id: I4908543d895d35f667722ebffd92f40d0a3e5818 Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/qa/unit/data/ods/opencl/statistical/CHISQDIST.odsbin0 -> 19796 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx31
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 32 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/opencl/statistical/CHISQDIST.ods b/sc/qa/unit/data/ods/opencl/statistical/CHISQDIST.ods
new file mode 100644
index 000000000000..81e84d15b394
--- /dev/null
+++ b/sc/qa/unit/data/ods/opencl/statistical/CHISQDIST.ods
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 7ebbb27db569..76cf866cc6a1 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -186,6 +186,7 @@ public:
void testStatisticalFormulaChiDist();
void testMathFormulaPower();
void testMathFormulaOdd();
+ void testStatisticalFormulaChiSqDist();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -303,6 +304,7 @@ public:
CPPUNIT_TEST(testStatisticalFormulaChiDist);
CPPUNIT_TEST(testMathFormulaPower);
CPPUNIT_TEST(testMathFormulaOdd);
+ CPPUNIT_TEST(testStatisticalFormulaChiSqDist);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2965,6 +2967,35 @@ void ScOpenclTest:: testFinancialXirrFormula()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-139]
+void ScOpenclTest::testStatisticalFormulaChiSqDist()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/CHISQDIST.", ODS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CHISQDIST.", ODS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ // Check the results of formula cells in the shared formula range.
+ for (SCROW i = 1; i <= 9; ++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));
+ }
+ for (SCROW i = 1; i <= 9; ++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-140]
void ScOpenclTest::testStatisticalFormulaConfidence()
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 3a099e1e28a1..11c5737184c8 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1419,6 +1419,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocChiDist:
case ocPower:
case ocOdd:
+ case ocChiSqDist:
// Don't change the state.
break;
default: