summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormingli <mingli@multicorewareinc.com>2013-12-13 16:55:32 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-12-19 17:53:59 -0600
commitb77514259d6fd317c96494fe5d93ad70b5371380 (patch)
tree1e8678bbce6d6947e7a9589aeb3ba54a14332646
parenta418cc7066f56cc980c2bed1dc3600932861c9c5 (diff)
GPU Calc: unit test cases for AVERAGEA
Turn NO_FALLBACK_TO_SWINTERP on in formulagroupcl.cxx for test AMLOEXT-216 BUG Change-Id: I53e62963490ca01160e85c6aec2c03532e5068dc Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: Wei Wei <weiwei@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/qa/unit/data/xls/opencl/statistical/AverageA.xlsbin0 -> 7168 bytes
-rw-r--r--sc/qa/unit/opencl-test.cxx48
-rw-r--r--sc/source/core/tool/token.cxx1
3 files changed, 38 insertions, 11 deletions
diff --git a/sc/qa/unit/data/xls/opencl/statistical/AverageA.xls b/sc/qa/unit/data/xls/opencl/statistical/AverageA.xls
new file mode 100644
index 000000000000..6ba475b1144b
--- /dev/null
+++ b/sc/qa/unit/data/xls/opencl/statistical/AverageA.xls
Binary files differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 20957fa28a13..be4a47c11f42 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -272,6 +272,7 @@ public:
void testStatisticalFormulaMina();
void testStatisticalFormulaCountA();
void testStatisticalFormulaMaxa();
+ void testStatisticalFormulaAverageA();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -474,6 +475,7 @@ public:
CPPUNIT_TEST(testMathFormulaFact);
CPPUNIT_TEST(testStatisticalFormulaMaxa);
CPPUNIT_TEST(testStatisticalFormulaCountA);
+ CPPUNIT_TEST(testStatisticalFormulaAverageA);
CPPUNIT_TEST_SUITE_END();
private:
@@ -4967,25 +4969,25 @@ void ScOpenclTest::testMathFormulaAverageIf()
xDocSh->DoClose();
xDocShRes->DoClose();
}
-//[AMLOEXT-245]
-void ScOpenclTest::testMathFormulaSumProduct2()
+
+//[AMLOEXT-216]
+void ScOpenclTest::testStatisticalFormulaAverageA()
{
if (!detectOpenCLDevice())
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/sumproductTest.", XLS);
- ScDocument* pDoc = xDocSh->GetDocument();
+ ScDocShellRef xDocSh = loadDoc("opencl/statistical/AverageA.", XLS);
+ ScDocument *pDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT(pDoc);
enableOpenCL();
pDoc->CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/sumproductTest.", XLS);
- ScDocument* pDocRes = xDocShRes->GetDocument();
+ ScDocShellRef xDocShRes = loadDoc("opencl/statistical/AverageA.", XLS);
+ ScDocument *pDocRes = xDocShRes->GetDocument();
CPPUNIT_ASSERT(pDocRes);
- // Check the results of formula cells in the shared formula range.
- for (SCROW i = 2; i <= 12; ++i)
+ for (SCROW i = 0; i <= 9; ++i)
{
- double fLibre = pDoc->GetValue(ScAddress(4,i,1));
- double fExcel = pDocRes->GetValue(ScAddress(4,i,1));
- CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ 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));
}
xDocSh->DoClose();
xDocShRes->DoClose();
@@ -5020,6 +5022,30 @@ void ScOpenclTest:: testLogicalFormulaAnd()
xDocShRes->DoClose();
}
+//[AMLOEXT-245]
+void ScOpenclTest::testMathFormulaSumProduct2()
+{
+ if (!detectOpenCLDevice())
+ return;
+ ScDocShellRef xDocSh = loadDoc("opencl/math/sumproductTest.", XLS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ enableOpenCL();
+ pDoc->CalcAll();
+ ScDocShellRef xDocShRes = loadDoc("opencl/math/sumproductTest.", XLS);
+ ScDocument* pDocRes = xDocShRes->GetDocument();
+ CPPUNIT_ASSERT(pDocRes);
+ // Check the results of formula cells in the shared formula range.
+ for (SCROW i = 2; i <= 12; ++i)
+ {
+ double fLibre = pDoc->GetValue(ScAddress(4,i,1));
+ double fExcel = pDocRes->GetValue(ScAddress(4,i,1));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+ }
+ xDocSh->DoClose();
+ xDocShRes->DoClose();
+}
+
//[AMLOEXT-243]
void ScOpenclTest:: testStatisticalParallelCountBug()
{
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index a48545f0fc52..33cf32a37cb6 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1497,6 +1497,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case ocIsEven:
case ocIsOdd:
case ocFact:
+ case ocAverageA:
// Don't change the state.
break;
default: