summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorxinjiang <xinjiang@multicorewareinc.com>2013-11-04 10:36:28 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-03 22:40:10 -0600
commit12a86d12e9be04b5ce3df946e6c7b5a065533cbd (patch)
treef52acfa30de57a6724e5f16d8eebe9f99428d9f2 /sc
parent3c9042ad3db8064af2ccd5171385ee1aaf59d9cf (diff)
GPU Calc: unit test cases for ISPMT in GPU calc
AMLOEXT-99 BUG Change-Id: I4388b184b23cf616dacfb20c61d2295765925ede 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/financial/ISPMT.xlsbin0 -> 6656 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/xls/opencl/financial/ISPMT.xls b/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls
new file mode 100644
index 000000000000..8759e7e59d27
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index c8cf3260f02c..dd626cd086d8 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -118,6 +118,7 @@ public:
void testFinacialYIELDMATFormula();
void testFinacialPMTFormula();
void testFinacialPPMTFormula();
+ void testFinancialISPMTFormula();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -167,6 +168,7 @@ public:
CPPUNIT_TEST(testFinacialYIELDMATFormula);
CPPUNIT_TEST(testFinacialPPMTFormula);
CPPUNIT_TEST(testFinacialPMTFormula);
+ CPPUNIT_TEST(testFinancialISPMTFormula);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1258,6 +1260,28 @@ void ScOpenclTest::testFinacialXNPVFormula()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-99]
+void ScOpenclTest:: testFinancialISPMTFormula()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/financial/ISPMT.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/financial/ISPMT.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 0; i <= 9; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
+ double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ xDocSh->DoClose();
+ xDocShRes->DoClose();
+}
void ScOpenclTest::testFinacialPriceMatFormula()
{
if (!detectOpenCLDevice())
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 89dcf9a13475..0cf62f45878a 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1366,6 +1366,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocCos:
case ocCosecant:
case ocCosecantHyp:
+ case ocISPMT:
// Don't change the state.
break;
default: