summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormingli <mingli@multicorewareinc.com>2013-11-09 11:49:52 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:48 -0600
commit52a17171d45ce25177277a569e78ee9318f705bf (patch)
tree958f2aceed953ebdfd885c36ab604925633a2905
parent8d7b2d96e5a8d1f991476dfdc6f940bd8adf0ed4 (diff)
GPU Calc: unit test cases for BETADIST
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-162 BUG Change-Id: I7d0300030d7518d20dd7b890dc665e9b56ba5c8d 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/BetaDist.odsbin0 -> 17575 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx28
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 29 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/opencl/statistical/BetaDist.ods b/sc/qa/unit/data/ods/opencl/statistical/BetaDist.ods
new file mode 100644
index 000000000000..197ea5ad5dc3
--- /dev/null
+++ b/sc/qa/unit/data/ods/opencl/statistical/BetaDist.ods
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index d1aa95cbf2a9..d3c073dbc47b 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -193,6 +193,7 @@ public:
void testStatisticalFormulaFInv();
void testStatisticalFormulaFTest();
void testStatisticalFormulaB();
+ void testStatisticalFormulaBetaDist();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -317,6 +318,7 @@ public:
CPPUNIT_TEST(testStatisticalFormulaFInv);
CPPUNIT_TEST(testStatisticalFormulaFTest);
CPPUNIT_TEST(testStatisticalFormulaB);
+ CPPUNIT_TEST(testStatisticalFormulaBetaDist);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3472,6 +3474,32 @@ void ScOpenclTest::testStatisticalFormulaB()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-162]
+void ScOpenclTest::testStatisticalFormulaBetaDist()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/BetaDist.", ODS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/BetaDist.", ODS);
+ 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(6,i,0));
+ double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ fLibre = pDoc->GetValue(ScAddress(7,i,0));
+ fExcel = pDocRes->GetValue(ScAddress(7,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 b1b1de3fee18..6e1a6063301a 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1426,6 +1426,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocFInv:
case ocFTest:
case ocB:
+ case ocBetaDist:
// Don't change the state.
break;
default: