diff options
author | mulei <mulei@multicorewareinc.com> | 2013-11-01 11:52:04 -0500 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-01 12:51:20 -0500 |
commit | 9f73e855afb061ddeedcbb25f0fd826902784f3c (patch) | |
tree | 82ea94f2fe89cecfe33ff11ae252f2b25383261c | |
parent | 124beed4078231867f8327e34b90ee1f40c39a30 (diff) |
GPU Calc: unit test cases for NAN argument handling in PMT
Change-Id: I8f8e7a6220cff7e825a08fe16352478ea7090964
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Signed-off-by: haochen <haochen@multicorewareinc.com>
-rw-r--r-- | sc/qa/unit/data/xls/opencl/financial/PMT.xls | bin | 0 -> 7680 bytes | |||
-rw-r--r-- | sc/qa/unit/opencl-test.cxx | 25 |
2 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/financial/PMT.xls b/sc/qa/unit/data/xls/opencl/financial/PMT.xls Binary files differnew file mode 100644 index 000000000000..8c14db655e76 --- /dev/null +++ b/sc/qa/unit/data/xls/opencl/financial/PMT.xls diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 4e7e92e04fde..156184fc8811 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -116,6 +116,7 @@ public: void testFinacialYIELDFormula(); void testFinacialYIELDDISCFormula(); void testFinacialYIELDMATFormula(); + void testFinacialPMTFormula(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -163,6 +164,7 @@ public: CPPUNIT_TEST(testFinacialYIELDFormula); CPPUNIT_TEST(testFinacialYIELDDISCFormula); CPPUNIT_TEST(testFinacialYIELDMATFormula); + CPPUNIT_TEST(testFinacialPMTFormula); CPPUNIT_TEST_SUITE_END(); private: @@ -1534,6 +1536,29 @@ void ScOpenclTest::testFinacialYIELDMATFormula() xDocSh->DoClose(); xDocShRes->DoClose(); } +void ScOpenclTest:: testFinacialPMTFormula() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/financial/PMT.", XLS); + ScDocument *pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/financial/PMT.", XLS); + ScDocument *pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + for (SCROW i = 0; i <= 6; ++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" ) { |