summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshiming zhang <shiming@multicorewareinc.com>2013-11-07 16:50:52 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:42 -0600
commit647d771636f9e54fa86508dd421e364f04d83c58 (patch)
tree3f148481bd863e6abaf8b640e2b3d8098826b041
parente8a755e782de1a843a4874d067e38522e1a5911b (diff)
GPU Calc: unit test cases for VAR
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-79 BUG Change-Id: Iedb355e8ffd5b9ef768baee49d3776fcb7ebb348 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/Var.xlsbin0 -> 7680 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/Var.xls b/sc/qa/unit/data/xls/opencl/statistical/Var.xls
new file mode 100644
index 000000000000..d3118fcde4ce
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/statistical/Var.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 12e3ba8e8d68..e48bceb084ef 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -182,6 +182,7 @@ public:
void testMathFormulaCoth();
void testFinacialNPER1Formula();
void testStatisticalFormulaFDist();
+ void testStatisticalFormulaVar();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -295,6 +296,7 @@ public:
CPPUNIT_TEST(testMathFormulaCoth);
CPPUNIT_TEST(testFinacialNPER1Formula);
CPPUNIT_TEST(testStatisticalFormulaFDist);
+ CPPUNIT_TEST(testStatisticalFormulaVar);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1605,6 +1607,31 @@ void ScOpenclTest::testStatisticalFormulaWeibull()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-79]
+void ScOpenclTest::testStatisticalFormulaVar()
+{
+ if (!detectOpenCLDevice())
+ return;
+
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/Var.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Var.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ // Check the results of formula cells in the shared formula range.
+ for (SCROW i = 1; i <= 20; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+ double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ xDocSh->DoClose();
+ xDocShRes->DoClose();
+}
//[AMLOEXT-82]
void ScOpenclTest::testStatisticalFormulaPearson()
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 2cd7c538b27b..1022e2d9ff6f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1415,6 +1415,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocCot:
case ocCotHyp:
case ocFDist:
+ case ocVar:
// Don't change the state.
break;
default: