summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormingli <mingli@multicorewareinc.com>2013-11-08 13:29:47 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:46 -0600
commit6bc2c27f983c83745a17fe5c283d53a156053879 (patch)
tree60671cacc424bc3116f3b0c3a66d49fb51faaf82
parente3ae4a6dd2bae2ec379c97a3040db5312e1b62c6 (diff)
GPU Calc: unit test cases for GAMMAINV
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-158 BUG Change-Id: Ia759d5fda3c96aafb51cd8bd7d6a9789b5fc149d 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/GammaInv.xlsbin0 -> 8704 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx29
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/statistical/GammaInv.xls b/sc/qa/unit/data/xls/opencl/statistical/GammaInv.xls
new file mode 100644
index 000000000000..077cfaddfab6
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/statistical/GammaInv.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index b1b0ad11fc95..e8f55093fd5a 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -188,6 +188,7 @@ public:
void testMathFormulaOdd();
void testStatisticalFormulaChiSqDist();
void testStatisticalFormulaChiSqInv();
+ void testStatisticalFormulaGammaInv();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -307,6 +308,7 @@ public:
CPPUNIT_TEST(testMathFormulaOdd);
CPPUNIT_TEST(testStatisticalFormulaChiSqDist);
CPPUNIT_TEST(testStatisticalFormulaChiSqInv);
+ CPPUNIT_TEST(testStatisticalFormulaGammaInv);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3358,6 +3360,33 @@ void ScOpenclTest::testStatisticalFormulaGammaDist()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-158]
+void ScOpenclTest::testStatisticalFormulaGammaInv()
+{
+ if (!detectOpenCLDevice())
+ return;
+
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaInv.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaInv.", 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));
+ fLibre = pDoc->GetValue(ScAddress(4,i,0));
+ fExcel = pDocRes->GetValue(ScAddress(4,i,0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ xDocSh->DoClose();
+ xDocShRes->DoClose();
+}
//[AMLOEXT-166]
void ScOpenclTest::testStatisticalFormulaChiDist()
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index ae1a14fd1dc1..7c10c83d841f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1421,6 +1421,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocOdd:
case ocChiSqDist:
case ocChiSqInv:
+ case ocGammaInv:
// Don't change the state.
break;
default: