summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxinjiang <xinjiang@multicorewareinc.com>2013-11-04 11:12:17 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-03 23:32:20 -0600
commitd454a57acd6bada1cd6913a7c42f8bf3f0a39a70 (patch)
tree5126032837298b3076b71d97442640eebe359078
parent0beb28ce1bec18b84402f2eb2f598c19f54444c2 (diff)
GPU Calc: unit test cases for DURATION
AMLOEXT-111 BUG Change-Id: I1d206b0eda0dca8254f0491399d0a4679eb39ef8 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/financial/Duration.odsbin0 -> 13996 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/financial/Duration.ods b/sc/qa/unit/data/ods/opencl/financial/Duration.ods
new file mode 100644
index 000000000000..d884dfebc9d1
--- /dev/null
+++ b/sc/qa/unit/data/ods/opencl/financial/Duration.ods
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 7264c7e99a62..0d228d569007 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -120,6 +120,7 @@ public:
void testFinacialPPMTFormula();
void testFinancialISPMTFormula();
void testFinacialPriceFormula();
+ void testFinancialDurationFormula();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -171,6 +172,7 @@ public:
CPPUNIT_TEST(testFinacialPMTFormula);
CPPUNIT_TEST(testFinancialISPMTFormula);
CPPUNIT_TEST(testFinacialPriceFormula);
+ CPPUNIT_TEST(testFinancialDurationFormula);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1608,6 +1610,28 @@ void ScOpenclTest:: testFinacialPMTFormula()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+//[AMLOEXT-111]
+void ScOpenclTest:: testFinancialDurationFormula()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration.", ODS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration.", 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();
+}
//[AMLOEXT-119]
void ScOpenclTest:: testFinacialPPMTFormula()
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 0cf62f45878a..5845c6355352 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1367,6 +1367,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocCosecant:
case ocCosecantHyp:
case ocISPMT:
+ case ocLaufz:
// Don't change the state.
break;
default: