diff options
author | mulei <mulei@multicorewareinc.com> | 2013-11-05 15:46:15 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-13 00:45:05 -0600 |
commit | dd3ac582e704d7ef9fcb9fb5f45c7e624aa0c162 (patch) | |
tree | 2139b395ee0bf252504aedff66b759b831821aab | |
parent | e7ad31bf7acd92cac6ee4fead76dee2bdee45029 (diff) |
GPU Calc: unit test cases for NPER
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test
AMLOEXT-108 BUG
Change-Id: Ib1469a02884e926ea2f5f93a6ffde95ca9b948d7
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/financial/NPER.xls | bin | 0 -> 7168 bytes | |||
-rw-r--r-- | sc/qa/unit/opencl-test.cxx | 24 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 1 |
3 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/financial/NPER.xls b/sc/qa/unit/data/xls/opencl/financial/NPER.xls Binary files differnew file mode 100644 index 000000000000..a5e2cbcdbf51 --- /dev/null +++ b/sc/qa/unit/data/xls/opencl/financial/NPER.xls diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 51f56287e97f..e6470f4af90d 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -140,6 +140,7 @@ public: void testMathSumIfsFormula(); void testFinancialVDBFormula(); void testStatisticalFormulaKurt(); + void testFinacialNPERFormula(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -211,6 +212,7 @@ public: CPPUNIT_TEST(testMathSumIfsFormula); CPPUNIT_TEST(testFinancialVDBFormula); CPPUNIT_TEST(testStatisticalFormulaKurt); + CPPUNIT_TEST(testFinacialNPERFormula); CPPUNIT_TEST_SUITE_END(); private: @@ -1620,6 +1622,28 @@ void ScOpenclTest::testStatisticalFormulaMedian() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-108] +void ScOpenclTest::testFinacialNPERFormula() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/financial/NPER.", XLS); + ScDocument *pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPER.", XLS); + ScDocument *pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + for (SCROW i = 0; i <= 10; ++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(); +} //[AMLOEXT-110] void ScOpenclTest::testFinancialAmorlincFormula() { diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 5988e98f7148..80a1236c61ab 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1381,6 +1381,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r ) case ocZW: case ocVBD: case ocKurt: + case ocZZR: // Don't change the state. break; default: |