[Libreoffice-commits] core.git: sc/qa
Pranav Kant
pranav913 at gmail.com
Fri Mar 6 13:07:44 PST 2015
sc/qa/unit/opencl-test.cxx | 2351 +++++++++++++--------------------------------
1 file changed, 683 insertions(+), 1668 deletions(-)
New commits:
commit 0ef455bdc33356dcf00e3a2f724b2a18e15de38f
Author: Pranav Kant <pranav913 at gmail.com>
Date: Sun Mar 1 21:32:22 2015 +0530
tdf#89267: Reduce duplicate code
Change-Id: Ib0c8801841e122be58f5a931c7413b08487e1f23
Reviewed-on: https://gerrit.libreoffice.org/14694
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Tested-by: Tor Lillqvist <tml at collabora.com>
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 9f2fb4f..f6a6ae3 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -297,6 +297,7 @@ public:
void testStatisticalFormulaStDevA1();
void testStatisticalFormulaStDevPA1();
void testFinancialMDurationFormula1();
+
CPPUNIT_TEST_SUITE(ScOpenCLTest);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testFinacialFormula);
@@ -530,8 +531,30 @@ public:
private:
uno::Reference<uno::XInterface> m_xCalcComponent;
+
+ // Test env variables and methods
+ ScDocShellRef xDocSh;
+ ScDocShellRef xDocShRes;
+ bool initTestEnv(const OUString fileName, sal_Int32 nFormat,
+ bool bReadWrite);
};
+bool ScOpenCLTest::initTestEnv(const OUString fileName, sal_Int32 nFormat,
+ bool bReadWrite)
+{
+ if(!detectOpenCLDevice())
+ return false;
+
+ xDocSh = loadDoc(fileName, nFormat, bReadWrite);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
+ enableOpenCL();
+
+ xDocShRes = loadDoc(fileName, nFormat, bReadWrite);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
+
+ return true;
+}
+
bool ScOpenCLTest::load(const OUString &rFilter, const OUString &rURL,
const OUString &rUserData, unsigned int nFilterFlags,
unsigned int nClipboardID, unsigned int nFilterVersion)
@@ -558,16 +581,12 @@ void ScOpenCLTest::enableOpenCL()
void ScOpenCLTest::testCompilerHorizontal()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/compiler/horizontal.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/compiler/horizontal.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/compiler/horizontal.", ODS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i < 5; ++i)
{
@@ -581,21 +600,16 @@ void ScOpenCLTest::testCompilerHorizontal()
fExcel = rDocRes.GetValue(ScAddress(14, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
+
void ScOpenCLTest::testCompilerNested()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/compiler/nested.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/compiler/nested.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/compiler/nested.", ODS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i < 5; ++i)
{
@@ -603,24 +617,16 @@ void ScOpenCLTest::testCompilerNested()
double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testCompilerString()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/compiler/string.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/compiler/string.", ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/compiler/string.", ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i < 5; ++i)
{
@@ -632,24 +638,16 @@ void ScOpenCLTest::testCompilerString()
fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testCompilerInEq()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/compiler/ineq.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/compiler/ineq.", ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/compiler/ineq.", ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i < 7; ++i)
{
@@ -657,22 +655,17 @@ void ScOpenCLTest::testCompilerInEq()
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
#if 0
void ScOpenCLTest::testSharedFormulaXLSStockHistory()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("stock-history.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("stock-history.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
xDocSh->DoHardRecalc(true);
- ScDocShellRef xDocShRes = loadDoc("stock-history.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 33; i < 44; ++i)
{ // Cell H34:H44 in S&P 500 (tab 1)
@@ -687,22 +680,16 @@ void ScOpenCLTest::testSharedFormulaXLSStockHistory()
double fExcel = rDocRes.GetValue(ScAddress(9, i, 1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
}
-
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testSharedFormulaXLSGroundWater()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("ground-water-daily.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("ground-water-daily.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
xDocSh->DoHardRecalc(true);
- ScDocShellRef xDocShRes = loadDoc("ground-water-daily.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 5; i <= 77; ++i)
{
@@ -710,22 +697,19 @@ void ScOpenCLTest::testSharedFormulaXLSGroundWater()
double fExcel = rDocRes.GetValue(ScAddress(11,i,1));
ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
+
+
}
#endif
void ScOpenCLTest::testSharedFormulaXLS()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("sum_ex.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("sum_ex.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("sum_ex.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i < 5; ++i)
{
@@ -805,84 +789,64 @@ void ScOpenCLTest::testSharedFormulaXLS()
fabs(fExcel*0.0001));
}
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaCos()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/cos.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/math/cos.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/cos.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaSinh()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/sinh.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/math/sinh.", XLS);
- enableOpenCL();
ScDocument& rDoc = xDocSh->GetDocument();
- xDocSh->DoHardRecalc(true);
- ScDocShellRef xDocShRes = loadDoc("opencl/math/sinh.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ xDocSh->DoHardRecalc(true);
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaPi()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/pi.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/math/pi.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/pi.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(0,i,0));
double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaRandom()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/random.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/math/random.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/random.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(0,i,0));
@@ -892,22 +856,15 @@ void ScOpenCLTest::testMathFormulaRandom()
(void) fExcel;
CPPUNIT_ASSERT(true);
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/general.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/financial/general.", XLS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/general.", XLS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 10; ++i)
{
@@ -951,7 +908,7 @@ void ScOpenCLTest::testFinacialFormula()
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- for (SCROW i = 0; i < 10; ++i)
+ for (SCROW i = 0; i < 10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5,i,6));
double fExcel = rDocRes.GetValue(ScAddress(5,i,6));
@@ -1048,24 +1005,16 @@ void ScOpenCLTest::testFinacialFormula()
double fExcel = rDocRes.GetValue(ScAddress(3,i,19));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaCorrel()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Correl.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Correl.", ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Correl.", ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
@@ -1073,22 +1022,15 @@ void ScOpenCLTest::testStatisticalFormulaCorrel()
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
-
}
void ScOpenCLTest::testStatisticalFormulaFisher()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Fisher.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Fisher.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Fisher.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -1096,22 +1038,16 @@ void ScOpenCLTest::testStatisticalFormulaFisher()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaFisherInv()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/FisherInv.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/FisherInv.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/FisherInv.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -1119,22 +1055,16 @@ void ScOpenCLTest::testStatisticalFormulaFisherInv()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaGamma()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Gamma.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Gamma.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Gamma.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -1142,40 +1072,31 @@ void ScOpenCLTest::testStatisticalFormulaGamma()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialFvscheduleFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Fvschedule.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Fvschedule.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Fvschedule.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaAbs()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/Abs.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/Abs.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/Abs.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
// Verify ABS Function
for (SCROW i = 1; i <= 1000; ++i)
@@ -1184,64 +1105,51 @@ void ScOpenCLTest::testMathFormulaAbs()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialSYDFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/SYD.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/SYD.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/SYD.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
// this test has intermittent failures on OSX
#if !defined MACOSX
void ScOpenCLTest::testFinacialIRRFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/IRR.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/IRR.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/IRR.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
#endif
void ScOpenCLTest::testStatisticalFormulaGammaLn()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/GammaLn.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaLn.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaLn.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -1249,20 +1157,16 @@ void ScOpenCLTest::testStatisticalFormulaGammaLn()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaGauss()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Gauss.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Gauss.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Gauss.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -1270,21 +1174,16 @@ void ScOpenCLTest::testStatisticalFormulaGauss()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaGeoMean()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/GeoMean.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/GeoMean.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GeoMean.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -1292,21 +1191,16 @@ void ScOpenCLTest::testStatisticalFormulaGeoMean()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaHarMean()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/HarMean.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/HarMean.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/HarMean.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -1314,199 +1208,160 @@ void ScOpenCLTest::testStatisticalFormulaHarMean()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialSLNFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/SLN.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/SLN.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/SLN.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialMIRRFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/MIRR.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/MIRR.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/MIRR.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialCoupdaybsFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Coupdaybs.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdaybs.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdaybs.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <=10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialDollardeFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Dollarde.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Dollarde.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Dollarde.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialCoupdaysFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Coupdays.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdays.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdays.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <=10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
+
}
void ScOpenCLTest::testFinancialCoupdaysncFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Coupdaysnc.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdaysnc.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdaysnc.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <=10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialRateFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/RATE.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/RATE.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/RATE.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <= 5; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialAccrintmFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Accrintm.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Accrintm.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Accrintm.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <= 10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialCoupnumFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Coupnum.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupnum.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupnum.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaNegbinomdist()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Negbinomdist.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Negbinomdist." ,XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Negbinomdist." ,XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
@@ -1514,282 +1369,224 @@ void ScOpenCLTest::testStatisticalFormulaNegbinomdist()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaSin()
{
- if (!detectOpenCLDevice())
- return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/sin.", XLS);
+ if(!initTestEnv("opencl/math/sin.", XLS, false))
+ return;
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/sin.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaSumSQ()
{
- if (!detectOpenCLDevice())
- return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/sumsq.", XLS);
+ if(!initTestEnv("opencl/math/sumsq.", XLS, false))
+ return;
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/sumsq.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i < 20; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5,i,0));
double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaTan()
{
- if (!detectOpenCLDevice())
- return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/tan.", XLS);
+ if(!initTestEnv("opencl/math/tan.", XLS, false))
+ return;
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/tan.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaTanH()
{
- if (!detectOpenCLDevice())
- return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/tanh.", XLS);
+ if(!initTestEnv("opencl/math/tanh.", XLS, false))
+ return;
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/tanh.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaSqrt()
{
- if (!detectOpenCLDevice())
- return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/sqrt.", XLS);
+ if(!initTestEnv("opencl/math/sqrt.", XLS, false))
+ return;
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/sqrt.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialPriceFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Price.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Price.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Price.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <= 10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialDollarfrFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Dollarfr.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Dollarfr.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Dollarfr.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialPriceDiscFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/PriceDisc.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/PriceDisc.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/PriceDisc.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialODDLPRICEFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Oddlprice.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Oddlprice.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Oddlprice.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <= 10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinacialOddlyieldFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Oddlyield.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Oddlyield.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Oddlyield.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialDISCFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/DISC.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/DISC.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/DISC.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinacialPVFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/PV.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/PV.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/PV.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialINTRATEFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/INTRATE.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/INTRATE.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/INTRATE.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaStandard()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Standard.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Standard.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Standard.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
@@ -1797,22 +1594,16 @@ void ScOpenCLTest::testStatisticalFormulaStandard()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaWeibull()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Weibull.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Weibull.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Weibull.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
@@ -1821,22 +1612,16 @@ void ScOpenCLTest::testStatisticalFormulaWeibull()
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
fExcel == 0?1e-4:fabs(1e-4*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaVar()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Var.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Var.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Var.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
@@ -1844,22 +1629,16 @@ void ScOpenCLTest::testStatisticalFormulaVar()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaSkew()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Skew.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Skew.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Skew.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
@@ -1867,22 +1646,16 @@ void ScOpenCLTest::testStatisticalFormulaSkew()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaSkewp()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Skewp.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Skewp.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Skewp.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 20; ++i)
{
@@ -1890,20 +1663,16 @@ void ScOpenCLTest::testStatisticalFormulaSkewp()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaPearson()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Pearson.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Pearson.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Pearson.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
@@ -1911,20 +1680,16 @@ void ScOpenCLTest::testStatisticalFormulaPearson()
double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaRsq()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Rsq.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Rsq.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Rsq.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
@@ -1932,62 +1697,47 @@ void ScOpenCLTest::testStatisticalFormulaRsq()
double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaTrunc()
{
- if (!detectOpenCLDevice())
- return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/trunc.", XLS);
+ if(!initTestEnv("opencl/math/trunc.", XLS, false))
+ return;
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/trunc.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(2,i,0));
double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaCosh()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/cosh.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/math/cosh.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/cosh.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
- for (SCROW i = 0; i <= 15; ++i)
+ rDoc.CalcAll();
+
+ for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaCovar()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Covar.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Covar.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Covar.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 16; ++i)
{
@@ -1995,20 +1745,16 @@ void ScOpenCLTest::testStatisticalFormulaCovar()
double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaKurt()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Kurt.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Kurt.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Kurt.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2016,43 +1762,32 @@ void ScOpenCLTest::testStatisticalFormulaKurt()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaCot()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/cot.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/math/cot.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/cot.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaDevSq()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/DevSq.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/DevSq.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/DevSq.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 11; ++i)
{
@@ -2060,61 +1795,48 @@ void ScOpenCLTest::testStatisticalFormulaDevSq()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaCsc()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/csc.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/csc.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/csc.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaCoth()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/coth.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/math/coth.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/coth.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialXNPVFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/XNPV.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/XNPV.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/XNPV.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
@@ -2128,81 +1850,64 @@ void ScOpenCLTest::testFinacialXNPVFormula()
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaIntercept()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Intercept.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Intercept.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Intercept.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 1; i <= 19; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(2,i,0));
double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialAmordegrcFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Amordegrc.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Amordegrc.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Amordegrc.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinancialISPMTFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/ISPMT.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/ISPMT.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/ISPMT.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaMedian()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Median.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Median.",XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Median.",XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
@@ -2210,20 +1915,16 @@ void ScOpenCLTest::testStatisticalFormulaMedian()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaNormdist()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Normdist.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normdist.",XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normdist.",XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2231,20 +1932,16 @@ void ScOpenCLTest::testStatisticalFormulaNormdist()
double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaNormsdist()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Normsdist.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normsdist.",XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normsdist.",XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2252,20 +1949,16 @@ void ScOpenCLTest::testStatisticalFormulaNormsdist()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaPermut()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Permut.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Permut.",XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Permut.",XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2273,20 +1966,16 @@ void ScOpenCLTest::testStatisticalFormulaPermut()
double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaPermutation()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Permutation.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Permutation.",XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Permutation.",XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
@@ -2294,20 +1983,16 @@ void ScOpenCLTest::testStatisticalFormulaPermutation()
double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaPhi()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Phi.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Phi.",XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Phi.",XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2315,41 +2000,32 @@ void ScOpenCLTest::testStatisticalFormulaPhi()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaCscH()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/csch.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/csch.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/csch.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(1,i,0));
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaLogInv()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/LogInv.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/LogInv.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/LogInv.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2357,41 +2033,32 @@ void ScOpenCLTest::testStatisticalFormulaLogInv()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialNPERFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/NPER.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/NPER.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPER.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaForecast()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Forecast.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Forecast.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Forecast.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2399,78 +2066,62 @@ void ScOpenCLTest::testStatisticalFormulaForecast()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialAmorlincFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Amorlinc.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Amorlinc.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Amorlinc.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialDDBFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/ddb.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/ddb.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/ddb.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialPriceMatFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/PriceMat.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/PriceMat.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/PriceMat.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialFormulaReceived()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Received.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Received.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Received.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i < 10; ++i)
{
@@ -2478,19 +2129,15 @@ void ScOpenCLTest::testFinacialFormulaReceived()
double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialFormulaCumipmt()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Cumipmt.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Cumipmt.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Cumipmt.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 10; ++i)
{
@@ -2498,19 +2145,15 @@ void ScOpenCLTest::testFinancialFormulaCumipmt()
double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialFormulaCumprinc()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Cumprinc.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Cumprinc.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Cumprinc.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 10; ++i)
{
@@ -2518,57 +2161,46 @@ void ScOpenCLTest::testFinancialFormulaCumprinc()
double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialRRIFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/RRI.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/RRI.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/RRI.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialEFFECT_ADDFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/EFFECT_ADD.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/EFFECT_ADD.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/EFFECT_ADD.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialNominalFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Nominal.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Nominal.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Nominal.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2576,177 +2208,139 @@ void ScOpenCLTest::testFinacialNominalFormula()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialTBILLEQFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/TBILLEQ.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLEQ.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLEQ.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialTBILLPRICEFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/TBILLPRICE.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLPRICE.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLPRICE.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialTBILLYIELDFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/TBILLYIELD.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLYIELD.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLYIELD.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialYIELDFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/YIELD.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELD.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELD.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialYIELDDISCFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/YIELDDISC.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELDDISC.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELDDISC.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinacialYIELDMATFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/YIELDMAT.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELDMAT.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELDMAT.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinacialPMTFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/PMT.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/PMT.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/PMT.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinancialDurationFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Duration.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaLogNormDist()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/LogNormDist.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/LogNormDist.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/LogNormDist.", ODS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2754,20 +2348,16 @@ void ScOpenCLTest::testStatisticalFormulaLogNormDist()
double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaArcCos()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/ArcCos.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCos.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCos.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Verify ACos Function
for (SCROW i = 1; i <= 1000; ++i)
{
@@ -2775,100 +2365,80 @@ void ScOpenCLTest::testMathFormulaArcCos()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaPower()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/power.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/power.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/power.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 15; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(2,i,0));
double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinacialPPMTFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/PPMT.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/PPMT.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/PPMT.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinacialNPVFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/NPV.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/NPV.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPV.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 6; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinancialDuration_ADDFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Duration_ADD.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration_ADD.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration_ADD.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaNorminv()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Norminv.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Norminv.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Norminv.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2876,20 +2446,16 @@ void ScOpenCLTest::testStatisticalFormulaNorminv()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaNormsinv()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Normsinv.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normsinv.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normsinv.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 19; ++i)
{
@@ -2897,20 +2463,16 @@ void ScOpenCLTest::testStatisticalFormulaNormsinv()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaArcCosHyp()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/ArcCosHyp.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCosHyp.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCosHyp.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Verify ACosH Function
for (SCROW i = 1; i <= 1000; ++i)
{
@@ -2918,40 +2480,32 @@ void ScOpenCLTest::testMathFormulaArcCosHyp()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinancialMDurationFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/MDuration.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/MDuration.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/MDuration.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaArcCot()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/ArcCot.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCot.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCot.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Verify ACot Function
for (SCROW i = 1; i <= 1000; ++i)
{
@@ -2959,80 +2513,64 @@ void ScOpenCLTest::testMathFormulaArcCot()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinancialFVFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/FV.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/FV.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/FV.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialDBFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/db.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/db.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/db.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialCouppcdFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Couppcd.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Couppcd.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Couppcd.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathSumIfsFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/sumifs.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/sumifs.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- xDocSh->DoHardRecalc(true);
- ScDocShellRef xDocShRes = loadDoc("opencl/math/sumifs.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ xDocSh->DoHardRecalc(true);
+
for (SCROW i = 2; i <= 11; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(5,i,0));
@@ -3057,20 +2595,16 @@ void ScOpenCLTest::testMathSumIfsFormula()
double fExcel = rDocRes.GetValue(ScAddress(8,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaArcCotHyp()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/ArcCotHyp.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCotHyp.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCotHyp.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Verify ACotH Function
for (SCROW i = 1; i <= 1000; ++i)
{
@@ -3078,20 +2612,16 @@ void ScOpenCLTest::testMathFormulaArcCotHyp()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaArcSin()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/ArcSin.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/math/ArcSin.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcSin.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Verify ACotH Function
for (SCROW i = 1; i <= 1000; ++i)
{
@@ -3099,20 +2629,16 @@ void ScOpenCLTest::testMathFormulaArcSin()
double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinancialVDBFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/VDB.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/VDB.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/VDB.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 10; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
@@ -3131,39 +2657,29 @@ void ScOpenCLTest:: testFinancialVDBFormula()
double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinancialIPMTFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/IPMT.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/IPMT.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/IPMT.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest:: testFinancialXirrFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/XIRR.", ODS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/financial/XIRR.", ODS);
- CPPUNIT_ASSERT(xDocSh.Is());
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
rDoc.CalcAll();
for (SCROW i = 1; i <= 10; ++i)
@@ -3179,19 +2695,17 @@ void ScOpenCLTest:: testFinancialXirrFormula()
CPPUNIT_ASSERT(rtl::math::approxEqual(fExpected, fFormula));
}
- xDocSh->DoClose();
+
}
void ScOpenCLTest::testStatisticalFormulaChiSqDist()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/CHISQDIST.", ODS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/CHISQDIST.", ODS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CHISQDIST.", ODS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 1; i <= 9; ++i)
{
@@ -3205,22 +2719,16 @@ void ScOpenCLTest::testStatisticalFormulaChiSqDist()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaConfidence()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Confidence.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Confidence.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Confidence.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
@@ -3228,20 +2736,16 @@ void ScOpenCLTest::testStatisticalFormulaConfidence()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaFDist()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/Fdist.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/Fdist.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Fdist.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
@@ -3249,62 +2753,48 @@ void ScOpenCLTest::testStatisticalFormulaFDist()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialCoupncdFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Coupncd.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupncd.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupncd.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testFinancialAccrintFormula()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/financial/Accrint.", XLS, false))
return;
- ScDocShellRef xDocSh = loadDoc("opencl/financial/Accrint.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
- rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/financial/Accrint.", XLS);
ScDocument& rDocRes = xDocShRes->GetDocument();
+ rDoc.CalcAll();
+
for (SCROW i = 0; i <= 9; ++i)
{
double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testStatisticalFormulaCritBinom()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/statistical/CritBinom.", XLS, false))
return;
-
- ScDocShellRef xDocSh = loadDoc("opencl/statistical/CritBinom.", XLS);
ScDocument& rDoc = xDocSh->GetDocument();
- enableOpenCL();
+ ScDocument& rDocRes = xDocShRes->GetDocument();
rDoc.CalcAll();
- ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CritBinom.", XLS);
- ScDocument& rDocRes = xDocShRes->GetDocument();
// Check the results of formula cells in the shared formula range.
for (SCROW i = 0; i <= 9; ++i)
{
@@ -3312,20 +2802,16 @@ void ScOpenCLTest::testStatisticalFormulaCritBinom()
double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
}
- xDocSh->DoClose();
- xDocShRes->DoClose();
}
void ScOpenCLTest::testMathFormulaArcSinHyp()
{
- if (!detectOpenCLDevice())
+ if(!initTestEnv("opencl/math/ArcSinHyp.", ODS, false))
return;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list