summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshiming zhang <shiming@multicorewareinc.com>2013-11-07 17:19:00 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:42 -0600
commit288d7f275169cb603411265c610e1f3b37d9d9c3 (patch)
tree03d1a349887b7f212bbab309fcf87ceb24935a6a
parent4c047317bf078ac94ca4abd01a474e6070b2cfe6 (diff)
GPU Calc: unit test cases for CHIDIST
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-166 BUG Change-Id: Ife835b135e7211697dc465b3dc61ed1494970632 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/ChiDist.xlsbin0 -> 7680 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx25
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 26 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/statistical/ChiDist.xls b/sc/qa/unit/data/xls/opencl/statistical/ChiDist.xls
new file mode 100644
index 000000000000..4fcbecb3b298
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/statistical/ChiDist.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index e48bceb084ef..e6344aee6f29 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -183,6 +183,7 @@ public:
void testFinacialNPER1Formula();
void testStatisticalFormulaFDist();
void testStatisticalFormulaVar();
+ void testStatisticalFormulaChiDist();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -297,6 +298,7 @@ public:
CPPUNIT_TEST(testFinacialNPER1Formula);
CPPUNIT_TEST(testStatisticalFormulaFDist);
CPPUNIT_TEST(testStatisticalFormulaVar);
+ CPPUNIT_TEST(testStatisticalFormulaChiDist);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3252,6 +3254,29 @@ void ScOpenclTest::testStatisticalFormulaGammaDist()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-166]
+void ScOpenclTest::testStatisticalFormulaChiDist()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/ChiDist.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/ChiDist.", 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();
+}
ScOpenclTest::ScOpenclTest()
: ScBootstrapFixture( "/sc/qa/unit/data" )
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 1022e2d9ff6f..9ada5aee5949 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1416,6 +1416,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocCotHyp:
case ocFDist:
case ocVar:
+ case ocChiDist:
// Don't change the state.
break;
default: