summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryiming ju <yiming@multicorewareinc.com>2013-11-05 15:10:50 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-13 00:45:02 -0600
commit84a63e75caa46188f8ae88c02bf82c512d3fa146 (patch)
treeb685881d15b2a0cc5f472d025b882a36c634127c
parentGPU Calc: implemented for VDB (diff)
downloadcore-84a63e75caa46188f8ae88c02bf82c512d3fa146.tar.gz
core-84a63e75caa46188f8ae88c02bf82c512d3fa146.zip
GPU Calc: unit test cases for VDB
Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-133 BUG Change-Id: I16fa478bf7dbccbc8dcd98922d17501a6aa988b1 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/VDB.xlsbin0 -> 22016 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx36
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 37 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/financial/VDB.xls b/sc/qa/unit/data/xls/opencl/financial/VDB.xls
new file mode 100644
index 000000000000..d0f58b510f5f
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/financial/VDB.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 8d5d1d61ed0f..78bf08b35016 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -138,6 +138,7 @@ public:
void testFinancialFVFormula();
void testFinancialMDurationFormula();
void testMathSumIfsFormula();
+ void testFinancialVDBFormula();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -207,6 +208,7 @@ public:
CPPUNIT_TEST(testFinancialFVFormula);
CPPUNIT_TEST(testFinancialMDurationFormula);
CPPUNIT_TEST(testMathSumIfsFormula);
+ CPPUNIT_TEST(testFinancialVDBFormula);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2088,6 +2090,40 @@ void ScOpenclTest::testMathSumIfsFormula()
xDocSh->DoClose();
xDocShRes->DoClose();
}
+ //[AMLOEXT-133]
+void ScOpenclTest:: testFinancialVDBFormula()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/financial/VDB.", XLS);
+ ScDocument *pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/financial/VDB.", XLS);
+ ScDocument *pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ for (SCROW i = 0; i <= 10; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
+ double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ for (SCROW i = 15; i <= 26; ++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));
+ }
+ for (SCROW i = 30; i <= 41; ++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" )
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index b738e1669e52..02dd30a68d9c 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1379,6 +1379,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocMedian:
case ocGDA:
case ocZW:
+ case ocVBD:
// Don't change the state.
break;
default: