summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorhongyu zhong <hongyu@multicorewareinc.com>2013-11-16 17:00:14 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-16 21:49:19 -0600
commit95b610968c8cc3d44609f5d766276138b7048843 (patch)
tree9e7692f96c87434e0e67be0a08ae1a0bfaad577c /sc
parent886c5551396d07e8372c9b90562487d1dc69e9b9 (diff)
GPU Calc: unit test cases for BETAINV
Turn NO_FALLBACK_TO_SWINTERP on in formulagroupcl.cxx for test resolve compile warning in opbase.cxx AMLOEXT-201 BUG Change-Id: I82917b13c43c1bcaa01928b89210c8eb7495a167 Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xls/opencl/statistical/Betainv.xlsbin0 -> 8704 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx25
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx2
-rw-r--r--sc/source/core/opencl/opbase.cxx4
-rw-r--r--sc/source/core/tool/token.cxx1
5 files changed, 29 insertions, 3 deletions
diff --git a/sc/qa/unit/data/xls/opencl/statistical/Betainv.xls b/sc/qa/unit/data/xls/opencl/statistical/Betainv.xls
new file mode 100644
index 000000000000..d06dfcaa209b
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/statistical/Betainv.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 81fa8ebd381e..e69a0714d22d 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -232,6 +232,7 @@ public:
void testStatisticalFormulaHypGeomDist();
void testArrayFormulaSumX2MY2();
void testArrayFormulaSumX2PY2();
+ void testStatisticalFormulaBetainv();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -395,6 +396,7 @@ public:
CPPUNIT_TEST(testStatisticalFormulaHypGeomDist);
CPPUNIT_TEST(testArrayFormulaSumX2MY2);
CPPUNIT_TEST(testArrayFormulaSumX2PY2);
+ CPPUNIT_TEST(testStatisticalFormulaBetainv);
CPPUNIT_TEST_SUITE_END();
private:
@@ -4522,6 +4524,29 @@ void ScOpenclTest:: testArrayFormulaSumX2PY2()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-201]
+void ScOpenclTest::testStatisticalFormulaBetainv()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/Betainv.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Betainv.", 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(5,i,0));
+ double fExcel = pDocRes->GetValue(ScAddress(5,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/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 3af918d7b0fc..45ab642b8d4d 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2280,7 +2280,6 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
if (err != CL_SUCCESS)
throw OpenCLError(err);
delete mpKernel;
- return true;
}
#undef NO_FALLBACK_TO_SWINTERP /* undef this for non-TDD runs */
catch (const UnhandledToken &ut) {
@@ -2312,6 +2311,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
return false;
#endif
}
+ return true;
} // namespace opencl
}} // namespace sc
diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx
index 07425dfe245e..7bcb4290b556 100644
--- a/sc/source/core/opencl/opbase.cxx
+++ b/sc/source/core/opencl/opbase.cxx
@@ -183,8 +183,7 @@ void CheckVariables::CheckSubArgumentIsNan2( std::stringstream & ss,
formula::svSingleVectorRef)
ss<<"[get_group_id(1)]";
ss<<", 0);\n";
- return;
-#endif
+#else
ss <<" tmp";
ss <<i;
ss << "=";
@@ -197,6 +196,7 @@ void CheckVariables::CheckSubArgumentIsNan2( std::stringstream & ss,
ss<<"[get_group_id(1)]";
ss<<";\n";
+#endif
}
void CheckVariables::CheckAllSubArgumentIsNan(
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 4c84ca4b1039..e4386ef72391 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1463,6 +1463,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocHypGeomDist:
case ocSumX2MY2:
case ocSumX2DY2:
+ case ocBetaInv:
// Don't change the state.
break;
default: