From 8f6c1c39b213df40091f3136879d15a22b9486bc Mon Sep 17 00:00:00 2001 From: dechuang Date: Wed, 11 Dec 2013 16:04:45 +0800 Subject: GPU Calc: unit test cases for DSUM Need turn NO_FALLBACK_TO_SWINTERP on in formulagroupcl.cxx for test AMLOEXT-341 BUG Change-Id: I61f584611efaffc72b65727c2214fcd36c0e01cd Signed-off-by: haochen Signed-off-by: Wei Wei Signed-off-by: I-Jui (Ray) Sung Signed-off-by: Wei Wei --- sc/qa/unit/opencl-test.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'sc/qa/unit/opencl-test.cxx') diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index cb955d548f2f..6498a822ca3a 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -254,6 +254,7 @@ public: void testDatabaseFormulaDaverage(); void testDatabaseFormulaDstdev(); void testDatabaseFormulaDstdevp(); + void testDatabaseFormulaDsum(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -439,6 +440,7 @@ public: CPPUNIT_TEST(testDatabaseFormulaDaverage); CPPUNIT_TEST(testDatabaseFormulaDstdev); CPPUNIT_TEST(testDatabaseFormulaDstdevp); + CPPUNIT_TEST(testDatabaseFormulaDsum); CPPUNIT_TEST_SUITE_END(); private: @@ -5132,6 +5134,30 @@ void ScOpenclTest::testDatabaseFormulaDstdevp() xDocShRes->DoClose(); } +//[AMLOEXT-341] +void ScOpenclTest::testDatabaseFormulaDsum() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/database/dsum.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/database/dsum.", XLS); + ScDocument* pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + // Check the results of formula cells in the shared formula range. + for (SCROW i = 1; i <= 32; ++i) + { + double fLibre = pDoc->GetValue(ScAddress(9,i,0)); + double fExcel = pDocRes->GetValue(ScAddress(10,i,0)); + //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001)); + } + xDocSh->DoClose(); + xDocShRes->DoClose(); +} -- cgit