summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordechuang <dechuang@multicorewareinc.com>2013-11-09 10:47:36 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:46 -0600
commita8bb0352b519b37c698ee62ae785523d6bf573a1 (patch)
treeb2e003b05ace38884ed760bc313b78450562689c
parentc41db78b286fcfba1a03a29045105915f50f48b8 (diff)
GPU Calc: unit test cases for FLOOR
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-169 BUG Change-Id: Ib678abfdabd914eb89c712bb14fe7651c3004531 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/math/floor.odsbin0 -> 9086 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx24
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/opencl/math/floor.ods b/sc/qa/unit/data/ods/opencl/math/floor.ods
new file mode 100644
index 000000000000..6534ea32d0a0
--- /dev/null
+++ b/sc/qa/unit/data/ods/opencl/math/floor.ods
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index e8f55093fd5a..e754f172f06c 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -189,6 +189,7 @@ public:
void testStatisticalFormulaChiSqDist();
void testStatisticalFormulaChiSqInv();
void testStatisticalFormulaGammaInv();
+ void testMathFormulaFloor();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -309,6 +310,7 @@ public:
CPPUNIT_TEST(testStatisticalFormulaChiSqDist);
CPPUNIT_TEST(testStatisticalFormulaChiSqInv);
CPPUNIT_TEST(testStatisticalFormulaGammaInv);
+ CPPUNIT_TEST(testMathFormulaFloor);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3410,6 +3412,28 @@ void ScOpenclTest::testStatisticalFormulaChiDist()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-169]
+void ScOpenclTest::testMathFormulaFloor()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/math/floor.", ODS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/floor.", ODS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 0; i <= 9; ++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 7c10c83d841f..3100595bc49c 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1422,6 +1422,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocChiSqDist:
case ocChiSqInv:
case ocGammaInv:
+ case ocFloor:
// Don't change the state.
break;
default: