From 35764e147a11721a574069b31dcacdf095139841 Mon Sep 17 00:00:00 2001 From: yiming ju Date: Tue, 31 Dec 2013 11:16:23 +0800 Subject: GPU Calc: unit test cases for Averageif not support double vector AMLOEXT-386 BUG Change-Id: Ie7c20cf9e354ca4c88388238ba735262098bb09f Signed-off-by: haochen Signed-off-by: Wei Wei Signed-off-by: I-Jui (Ray) Sung Signed-off-by: Wei Wei --- sc/qa/unit/data/xls/opencl/math/averageif_mix.xls | Bin 0 -> 24064 bytes sc/qa/unit/opencl-test.cxx | 25 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 sc/qa/unit/data/xls/opencl/math/averageif_mix.xls (limited to 'sc') diff --git a/sc/qa/unit/data/xls/opencl/math/averageif_mix.xls b/sc/qa/unit/data/xls/opencl/math/averageif_mix.xls new file mode 100644 index 000000000000..0fd3f8dd5dba Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/math/averageif_mix.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 4103dad757f1..cf3e01412087 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -286,6 +286,7 @@ public: void testAddInFormulaBesseLJ(); void testNegSub(); void testStatisticalFormulaAvedev(); + void testMathFormulaAverageIf_Mix(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -503,6 +504,7 @@ public: CPPUNIT_TEST(testAddInFormulaBesseLJ); CPPUNIT_TEST(testNegSub); CPPUNIT_TEST(testStatisticalFormulaAvedev); + CPPUNIT_TEST(testMathFormulaAverageIf_Mix); CPPUNIT_TEST_SUITE_END(); private: @@ -5945,7 +5947,28 @@ void ScOpenclTest::testNegSub() xDocSh->DoClose(); xDocShRes->DoClose(); } - +//[AMLOEXT-386] +void ScOpenclTest::testMathFormulaAverageIf_Mix() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/math/averageif_mix.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/math/averageif_mix.", XLS); + ScDocument* pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + for (SCROW i = 0; i <= 9; ++i) + { + double fLibre = pDoc->GetValue(ScAddress(2,i,0)); + double fExcel = pDocRes->GetValue(ScAddress(2,i,0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + } + xDocSh->DoClose(); + xDocShRes->DoClose(); +} ScOpenclTest::ScOpenclTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { -- cgit v1.2.3