diff options
author | yiming ju <yiming@multicorewareinc.com> | 2013-11-17 18:29:16 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-17 13:02:19 -0600 |
commit | 59c0051b26c28a0b277a83177f7e7d5db012b6cf (patch) | |
tree | 578b4c01a7696455539454720f269ec5de468032 /sc/qa | |
parent | 62f23965591ad3e2a3ee772e518d3fccd6b5ae9f (diff) |
GPU Calc: unit test cases for SUMPRODUCT WITH FIXED WINDOWS
AMLOEXT-214 BUG
Change-Id: Ib5adff235593b3a38f6aa7e63edf0196d31b8e82
Signed-off-by: haochen <haochen@multicorewareinc.com>
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls | bin | 0 -> 19968 bytes | |||
-rw-r--r-- | sc/qa/unit/opencl-test.cxx | 38 |
2 files changed, 38 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls b/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls Binary files differnew file mode 100644 index 000000000000..09ff33e1d791 --- /dev/null +++ b/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 0cbf365a31f0..987fc40a67ff 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -240,6 +240,7 @@ public: void testStatisticalFormulaStDevP(); void testStatisticalFormulaCovar(); void testLogicalFormulaAnd(); + void testMathFormulaSumProduct(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -411,6 +412,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaStDevP); CPPUNIT_TEST(testStatisticalFormulaCovar); CPPUNIT_TEST(testLogicalFormulaAnd); + CPPUNIT_TEST(testMathFormulaSumProduct); CPPUNIT_TEST_SUITE_END(); private: @@ -4716,6 +4718,42 @@ void ScOpenclTest:: testArrayFormulaSumXMY2() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-214] +void ScOpenclTest::testMathFormulaSumProduct() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/math/sumproduct_mixSliding.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/math/sumproduct_mixSliding.", XLS); + ScDocument* pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + // Check the results of formula cells in the shared formula range. + for (SCROW i = 0; i <= 9; ++i) + { + double fLibre = pDoc->GetValue(ScAddress(2,i,0)); + double fExcel = pDocRes->GetValue(ScAddress(2,i,0)); + if ( i == 1 ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(82, fLibre, fabs(0.0001*fExcel)); + else if ( i == 2 ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(113, fLibre, fabs(0.0001*fExcel)); + else if ( i == 4 ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(175, fLibre, fabs(0.0001*fExcel)); + else if ( i == 5 ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(206, fLibre, fabs(0.0001*fExcel)); + else if ( i == 6 ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(237, fLibre, fabs(0.0001*fExcel)); + else if ( i == 7 ) + CPPUNIT_ASSERT_DOUBLES_EQUAL(268, fLibre, fabs(0.0001*fExcel)); + else + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + } + xDocSh->DoClose(); + xDocShRes->DoClose(); +} //[AMLOEXT-217] void ScOpenclTest:: testLogicalFormulaAnd() { |