summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authormulei <mulei@multicorewareinc.com>2013-11-04 10:06:33 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-03 22:16:33 -0600
commit7acf9f27319cf6a6184e2bb37f237a944247b606 (patch)
treeb974113470c7be281d0a14c38114a6ccb3194363 /sc
parent7c19dd02d9241e06ecfeeb9ba4ab2971cba7ef43 (diff)
GPU Calc: unit test cases for NAN argument handling in PPMT
AMLOEXT-119 BUG Change-Id: I3bc04bfeeeaee80e6d1273d373180d8bf3aaf901 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/PPMT.xlsbin0 -> 7168 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx25
2 files changed, 24 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xls/opencl/financial/PPMT.xls b/sc/qa/unit/data/xls/opencl/financial/PPMT.xls
new file mode 100644
index 000000000000..484ee64cd0dc
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/financial/PPMT.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 156184fc8811..c8cf3260f02c 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -117,6 +117,7 @@ public:
void testFinacialYIELDDISCFormula();
void testFinacialYIELDMATFormula();
void testFinacialPMTFormula();
+ void testFinacialPPMTFormula();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -164,6 +165,7 @@ public:
CPPUNIT_TEST(testFinacialYIELDFormula);
CPPUNIT_TEST(testFinacialYIELDDISCFormula);
CPPUNIT_TEST(testFinacialYIELDMATFormula);
+ CPPUNIT_TEST(testFinacialPPMTFormula);
CPPUNIT_TEST(testFinacialPMTFormula);
CPPUNIT_TEST_SUITE_END();
@@ -1557,7 +1559,28 @@ void ScOpenclTest:: testFinacialPMTFormula()
xDocSh->DoClose();
xDocShRes->DoClose();
}
-
+//[AMLOEXT-119]
+void ScOpenclTest:: testFinacialPPMTFormula()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/financial/PPMT.", XLS);
+ ScDocument *pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/financial/PPMT.", XLS);
+ ScDocument *pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 0; i <= 6; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
+ double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ xDocSh->DoClose();
+ xDocShRes->DoClose();
+}
ScOpenclTest::ScOpenclTest()
: ScBootstrapFixture( "/sc/qa/unit/data" )