sc/CppunitTest_sc_opencl_test.mk |   41 
 sc/qa/unit/opencl-test.cxx       | 3016 +++++++++++++++++++--------------------
 2 files changed, 1520 insertions(+), 1537 deletions(-)

New commits:
commit da5377c88a26b167e94c030e8c8ac5251497e43b
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Nov 23 17:05:11 2022 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Nov 24 13:22:57 2022 +0100

    CppunitTest_sc_opencl_test: inherit from ScModelTestBase
    
    Change-Id: I53b8564a8fa7ebdc6ec4214a2cecd2917105a777
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143186
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sc/CppunitTest_sc_opencl_test.mk b/sc/CppunitTest_sc_opencl_test.mk
index 0807e14c08e1..f55b8ef5ce64 100644
--- a/sc/CppunitTest_sc_opencl_test.mk
+++ b/sc/CppunitTest_sc_opencl_test.mk
@@ -42,6 +42,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_opencl_test, \
     scqahelper \
     sfx \
     sot \
+    subsequenttest \
     svl \
     svt \
     svx \
@@ -72,45 +73,7 @@ $(eval $(call gb_CppunitTest_use_api,sc_opencl_test,\
 $(eval $(call gb_CppunitTest_use_ure,sc_opencl_test))
 $(eval $(call gb_CppunitTest_use_vcl,sc_opencl_test))
 
-$(eval $(call gb_CppunitTest_use_components,sc_opencl_test,\
-    basic/util/sb \
-    chart2/source/chartcore \
-    chart2/source/controller/chartcontroller \
-    comphelper/util/comphelp \
-    configmgr/source/configmgr \
-    dbaccess/util/dba \
-    embeddedobj/util/embobj \
-    eventattacher/source/evtatt \
-    filter/source/config/cache/filterconfig1 \
-    forms/util/frm \
-    framework/util/fwk \
-    i18npool/util/i18npool \
-    linguistic/source/lng \
-    oox/util/oox \
-    package/source/xstor/xstor \
-    package/util/package2 \
-    sax/source/expatwrap/expwrap \
-    scaddins/source/analysis/analysis \
-    scaddins/source/datefunc/date \
-    sc/util/sc \
-    sc/util/scfilt \
-    sfx2/util/sfx \
-    sot/util/sot \
-    svl/util/svl \
-    svtools/util/svt \
-    svx/util/svx \
-    svx/util/svxcore \
-    toolkit/util/tk \
-    ucb/source/core/ucb1 \
-    ucb/source/ucp/file/ucpfile1 \
-    ucb/source/ucp/tdoc/ucptdoc1 \
-       uui/util/uui \
-    unotools/util/utl \
-    unoxml/source/rdf/unordf \
-    unoxml/source/service/unoxml \
-    vcl/vcl.common \
-    xmloff/util/xo \
-))
+$(eval $(call gb_CppunitTest_use_rdb,sc_opencl_test,services))
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_opencl_test))
 
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index c88671ce6046..d01baf7cac36 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -4,19 +4,20 @@
 
 #include <string_view>
 
-#include <test/bootstrapfixture.hxx>
-
 #include "helper/qahelper.hxx"
 
 #include <docsh.hxx>
 #include <document.hxx>
 #include <formulagroup.hxx>
 
+#include <com/sun/star/document/MacroExecMode.hpp>
+#include <comphelper/sequence.hxx>
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
 class ScOpenCLTest
-    : public ScBootstrapFixture
+    : public ScModelTestBase
 {
 public:
     ScOpenCLTest();
@@ -28,8 +29,6 @@ public:
     void enableOpenCL();
     void disableOpenCL();
 
-    virtual void tearDown() override;
-
     void testSystematic();
     void testSharedFormulaXLS();
 #if 0
@@ -496,19 +495,51 @@ public:
     CPPUNIT_TEST_SUITE_END();
 
 private:
-    // Test env variables and methods
-    ScDocShellRef xDocSh;
-    ScDocShellRef xDocShRes;
-    void initTestEnv(std::u16string_view fileName, sal_Int32 nFormat);
+    void initTestEnv(std::u16string_view fileName);
+
+    ScDocument* getScDoc2();
 };
 
-void ScOpenCLTest::initTestEnv(std::u16string_view fileName, sal_Int32 nFormat)
+void ScOpenCLTest::initTestEnv(std::u16string_view fileName)
 {
+    // Some documents contain macros, disable them, otherwise
+    // the "Error, BASIC runtime error." dialog is prompted
+    // and it crashes in tearDown
+    std::vector<beans::PropertyValue> args;
+    beans::PropertyValue aMacroValue;
+    aMacroValue.Name = "MacroExecutionMode";
+    aMacroValue.Handle = -1;
+    aMacroValue.Value <<= document::MacroExecMode::NEVER_EXECUTE;
+    aMacroValue.State = beans::PropertyState_DIRECT_VALUE;
+    args.push_back(aMacroValue);
+
     disableOpenCL();
-    xDocSh = loadDoc(fileName, nFormat);
+    CPPUNIT_ASSERT(!ScCalcConfig::isOpenCLEnabled());
+
+    // Open the document with OpenCL disabled
+    mxComponent = mxDesktop->loadComponentFromURL(
+        createFileURL(fileName), "_default", 0, 
comphelper::containerToSequence(args));
 
     enableOpenCL();
-    xDocShRes = loadDoc(fileName, nFormat);
+    CPPUNIT_ASSERT(ScCalcConfig::isOpenCLEnabled());
+
+    // it's not possible to open the same document twice, thus, create a temp 
file
+    createTempCopy(fileName);
+
+    // Open the document with OpenCL enabled
+    mxComponent2 = mxDesktop->loadComponentFromURL(
+        maTempFile.GetURL(), "_default", 0, 
comphelper::containerToSequence(args));
+
+    // Check there are 2 documents
+    uno::Reference<frame::XFrames> xFrames = mxDesktop->getFrames();
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xFrames->getCount());
+}
+
+ScDocument* ScOpenCLTest::getScDoc2()
+{
+    ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent2.get());
+    CPPUNIT_ASSERT(pModelObj);
+    return pModelObj->GetDocument();
 }
 
 void ScOpenCLTest::enableOpenCL()
@@ -523,94 +554,94 @@ void ScOpenCLTest::disableOpenCL()
 
 void ScOpenCLTest::testCompilerHorizontal()
 {
-    initTestEnv(u"opencl/compiler/horizontal.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/compiler/horizontal.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i < 5; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(12, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(12, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(12, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(12, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
-        fLibre = rDoc.GetValue(ScAddress(13, i, 0));
-        fExcel = rDocRes.GetValue(ScAddress(13, i, 0));
+        fLibre = pDoc->GetValue(ScAddress(13, i, 0));
+        fExcel = pDocRes->GetValue(ScAddress(13, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
-        fLibre = rDoc.GetValue(ScAddress(14, i, 0));
-        fExcel = rDocRes.GetValue(ScAddress(14, i, 0));
+        fLibre = pDoc->GetValue(ScAddress(14, i, 0));
+        fExcel = pDocRes->GetValue(ScAddress(14, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testCompilerNested()
 {
-    initTestEnv(u"opencl/compiler/nested.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/compiler/nested.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i < 5; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testCompilerString()
 {
-    initTestEnv(u"opencl/compiler/string.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/compiler/string.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i < 5; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
 
-        fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testCompilerInEq()
 {
-    initTestEnv(u"opencl/compiler/ineq.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/compiler/ineq.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i < 7; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testCompilerPrecision()
 {
-    initTestEnv(u"opencl/compiler/precision.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
+    initTestEnv(u"ods/opencl/compiler/precision.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
     // Check that values with and without opencl are the same/similar enough.
     enableOpenCL();
-    rDoc.CalcAll();
+    pDoc->CalcAll();
     disableOpenCL();
-    rDoc.CalcAll();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i < 3; ++i)
     {
-        double fOpenCL = rDoc.GetValue(ScAddress(0, i, 0));
-        double fNormal = rDocRes.GetValue(ScAddress(0, i, 0));
+        double fOpenCL = pDoc->GetValue(ScAddress(0, i, 0));
+        double fNormal = pDocRes->GetValue(ScAddress(0, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fNormal, fOpenCL, fabs(1e-14*fOpenCL));
     }
 }
@@ -618,39 +649,41 @@ void ScOpenCLTest::testCompilerPrecision()
 #if 0
 void ScOpenCLTest::testSharedFormulaXLSStockHistory()
 {
-    initTestEnv("stock-history.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    xDocSh->DoHardRecalc();
+    initTestEnv(u"xls/stock-history.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    ScDocShell* pDocSh = getScDocShell();
+    pDocSh->DoHardRecalc();
 
     // 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)
-        double fLibre = rDoc.GetValue(ScAddress(7, i, 1));
-        double fExcel = rDocRes.GetValue(ScAddress(7, i, 1));
+        double fLibre = pDoc->GetValue(ScAddress(7, i, 1));
+        double fExcel = pDocRes->GetValue(ScAddress(7, i, 1));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
     }
 
     for (SCROW i = 33; i < 44; ++i)
     {   // Cell J34:J44 in S&P 500 (tab 1)
-        double fLibre = rDoc.GetValue(ScAddress(9, i, 1));
-        double fExcel = rDocRes.GetValue(ScAddress(9, i, 1));
+        double fLibre = pDoc->GetValue(ScAddress(9, i, 1));
+        double fExcel = pDocRes->GetValue(ScAddress(9, i, 1));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
     }
 }
 
 void ScOpenCLTest::testSharedFormulaXLSGroundWater()
 {
-    initTestEnv("ground-water-daily.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    xDocSh->DoHardRecalc();
+    initTestEnv(u"xls/ground-water-daily.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    ScDocShell* pDocSh = getScDocShell();
+    pDocSh->DoHardRecalc();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 5; i <= 77; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(11,i,1));
-        double fExcel = rDocRes.GetValue(ScAddress(11,i,1));
+        double fLibre = pDoc->GetValue(ScAddress(11,i,1));
+        double fExcel = pDocRes->GetValue(ScAddress(11,i,1));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
@@ -660,10 +693,10 @@ void ScOpenCLTest::testSharedFormulaXLSGroundWater()
 
 void ScOpenCLTest::testSystematic()
 {
-    initTestEnv(u"systematic.", FORMAT_XLS);
+    initTestEnv(u"xls/systematic.xls");
 
-    ScDocument& rDoc = xDocSh->GetDocument();
-    rDoc.CalcAll();
+    ScDocument* pDoc = getScDoc();
+    pDoc->CalcAll();
 
     int nAVertBegin(0), nAVertEnd(0), nBVertBegin(0), nBVertEnd(0);
     int nAHorEnd(0), nBHorEnd(0);
@@ -671,13 +704,13 @@ void ScOpenCLTest::testSystematic()
     int nRow, nCol;
     for (nRow = 0; nRow < 1000; ++nRow)
     {
-        if (rDoc.GetString(ScAddress(0, nRow, 0)) == "a")
+        if (pDoc->GetString(ScAddress(0, nRow, 0)) == "a")
         {
             nAVertBegin = nRow + 1;
 
             for (nCol = 0; nCol < 1000; ++nCol)
             {
-                if (rDoc.GetString(ScAddress(nCol, nRow, 0)) != "a")
+                if (pDoc->GetString(ScAddress(nCol, nRow, 0)) != "a")
                 {
                     nAHorEnd = nCol;
                     break;
@@ -688,7 +721,7 @@ void ScOpenCLTest::testSystematic()
     }
     for (; nRow < 1000; ++nRow)
     {
-        if (rDoc.GetString(ScAddress(0, nRow, 0)) != "a")
+        if (pDoc->GetString(ScAddress(0, nRow, 0)) != "a")
         {
             nAVertEnd = nRow;
             break;
@@ -697,13 +730,13 @@ void ScOpenCLTest::testSystematic()
 
     for (; nRow < 1000; ++nRow)
     {
-        if (rDoc.GetString(ScAddress(0, nRow, 0)) == "b")
+        if (pDoc->GetString(ScAddress(0, nRow, 0)) == "b")
         {
             nBVertBegin = nRow + 1;
 
             for (nCol = 0; nCol < 1000; ++nCol)
             {
-                if (rDoc.GetString(ScAddress(nCol, nRow, 0)) != "b")
+                if (pDoc->GetString(ScAddress(nCol, nRow, 0)) != "b")
                 {
                     nBHorEnd = nCol;
                     break;
@@ -714,7 +747,7 @@ void ScOpenCLTest::testSystematic()
     }
     for (; nRow < 1000; ++nRow)
     {
-        if (rDoc.GetString(ScAddress(0, nRow, 0)) != "b")
+        if (pDoc->GetString(ScAddress(0, nRow, 0)) != "b")
         {
             nBVertEnd = nRow;
             break;
@@ -734,8 +767,8 @@ void ScOpenCLTest::testSystematic()
     {
         for (int j = 1; j < nAHorEnd; ++j)
         {
-            double fLibre = rDoc.GetValue(ScAddress(j, i, 0));
-            double fExcel = rDoc.GetValue(ScAddress(j, nBVertBegin + (i - 
nAVertBegin), 0));
+            double fLibre = pDoc->GetValue(ScAddress(j, i, 0));
+            double fExcel = pDoc->GetValue(ScAddress(j, nBVertBegin + (i - 
nAVertBegin), 0));
 
             const OString sFailedMessage =
                 OStringChar(static_cast<char>('A'+j)) +
@@ -751,77 +784,77 @@ void ScOpenCLTest::testSystematic()
 
 void ScOpenCLTest::testSharedFormulaXLS()
 {
-    initTestEnv(u"sum_ex.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/sum_ex.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 0; i < 5; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
     for (SCROW i = 6; i < 14; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
     for (SCROW i = 15; i < 18; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
     for (SCROW i = 19; i < 22; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
     for (SCROW i = 23; i < 25; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        //double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        //double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         // There seems to be a bug in LibreOffice beta
         ASSERT_DOUBLES_EQUAL(/*fExcel*/ 60.0, fLibre);
     }
 
     for (SCROW i = 25; i < 27; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
     for (SCROW i = 28; i < 35; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
     // workaround for a Calc beta bug
-    ASSERT_DOUBLES_EQUAL(25.0, rDoc.GetValue(ScAddress(2, 35, 0)));
-    ASSERT_DOUBLES_EQUAL(24.0, rDoc.GetValue(ScAddress(2, 36, 0)));
+    ASSERT_DOUBLES_EQUAL(25.0, pDoc->GetValue(ScAddress(2, 35, 0)));
+    ASSERT_DOUBLES_EQUAL(24.0, pDoc->GetValue(ScAddress(2, 36, 0)));
 
     for (SCROW i = 38; i < 43; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
     for (SCROW i = 5; i < 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 1));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 1));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 1));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 1));
         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     }
 
@@ -829,8 +862,8 @@ void ScOpenCLTest::testSharedFormulaXLS()
     {
         for (SCCOL j = 6; j < 11; ++j)
         {
-            double fLibre = rDoc.GetValue(ScAddress(j, i, 1));
-            double fExcel = rDocRes.GetValue(ScAddress(j, i, 1));
+            double fLibre = pDoc->GetValue(ScAddress(j, i, 1));
+            double fExcel = pDocRes->GetValue(ScAddress(j, i, 1));
             CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
                 fabs(fExcel*0.0001));
         }
@@ -839,318 +872,319 @@ void ScOpenCLTest::testSharedFormulaXLS()
 
 void ScOpenCLTest::testMathFormulaCos()
 {
-    initTestEnv(u"opencl/math/cos.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/cos.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaSinh()
 {
-    initTestEnv(u"opencl/math/sinh.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    xDocSh->DoHardRecalc();
+    initTestEnv(u"xls/opencl/math/sinh.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    ScDocShell* pDocSh = getScDocShell();
+    pDocSh->DoHardRecalc();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaPi()
 {
-    initTestEnv(u"opencl/math/pi.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/pi.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(0,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(0,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(0,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaRandom()
 {
-    initTestEnv(u"opencl/math/random.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/random.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        rDoc.GetValue(ScAddress(0,i,0)); // LO
-        rDocRes.GetValue(ScAddress(0,i,0)); // Excel
+        pDoc->GetValue(ScAddress(0,i,0)); // LO
+        pDocRes->GetValue(ScAddress(0,i,0)); // Excel
         //because the random numbers will always change,so give the test "true"
         CPPUNIT_ASSERT(true);
     }
 }
 void ScOpenCLTest::testFinacialFormula()
 {
-    initTestEnv(u"opencl/financial/general.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/general.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6,i,1));
-        double fExcel = rDocRes.GetValue(ScAddress(6,i,1));
+        double fLibre = pDoc->GetValue(ScAddress(6,i,1));
+        double fExcel = pDocRes->GetValue(ScAddress(6,i,1));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,2));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,2));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,2));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,2));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6,i,3));
-        double fExcel = rDocRes.GetValue(ScAddress(6,i,3));
+        double fLibre = pDoc->GetValue(ScAddress(6,i,3));
+        double fExcel = pDocRes->GetValue(ScAddress(6,i,3));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,4));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,4));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,4));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,4));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,5));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,5));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,5));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,5));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 0; i < 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5,i,6));
-        double fExcel = rDocRes.GetValue(ScAddress(5,i,6));
+        double fLibre = pDoc->GetValue(ScAddress(5,i,6));
+        double fExcel = pDocRes->GetValue(ScAddress(5,i,6));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,7));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,7));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,7));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,7));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,8));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,8));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,8));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,8));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,9));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,9));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,9));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,9));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,10));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,10));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,10));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,10));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(7,i,11));
-        double fExcel = rDocRes.GetValue(ScAddress(7,i,11));
+        double fLibre = pDoc->GetValue(ScAddress(7,i,11));
+        double fExcel = pDocRes->GetValue(ScAddress(7,i,11));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5,i,12));
-        double fExcel = rDocRes.GetValue(ScAddress(5,i,12));
+        double fLibre = pDoc->GetValue(ScAddress(5,i,12));
+        double fExcel = pDocRes->GetValue(ScAddress(5,i,12));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 0; i <= 12; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6,i,13));
-        double fExcel = rDocRes.GetValue(ScAddress(6,i,13));
+        double fLibre = pDoc->GetValue(ScAddress(6,i,13));
+        double fExcel = pDocRes->GetValue(ScAddress(6,i,13));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,14));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,14));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,14));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,14));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6,i,15));
-        double fExcel = rDocRes.GetValue(ScAddress(6,i,15));
+        double fLibre = pDoc->GetValue(ScAddress(6,i,15));
+        double fExcel = pDocRes->GetValue(ScAddress(6,i,15));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6,i,16));
-        double fExcel = rDocRes.GetValue(ScAddress(6,i,16));
+        double fLibre = pDoc->GetValue(ScAddress(6,i,16));
+        double fExcel = pDocRes->GetValue(ScAddress(6,i,16));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 1; i <= 5; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6,i,17));
-        double fExcel = rDocRes.GetValue(ScAddress(6,i,17));
+        double fLibre = pDoc->GetValue(ScAddress(6,i,17));
+        double fExcel = pDocRes->GetValue(ScAddress(6,i,17));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 0; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,18));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,18));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,18));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,18));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 0; i <= 18; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,19));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,19));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,19));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,19));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaCorrel()
 {
-    initTestEnv(u"opencl/statistical/Correl.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/statistical/Correl.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 20; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testStatisticalFormulaFisher()
 {
-    initTestEnv(u"opencl/statistical/Fisher.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Fisher.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaFisherInv()
 {
-    initTestEnv(u"opencl/statistical/FisherInv.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/FisherInv.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaGamma()
 {
-    initTestEnv(u"opencl/statistical/Gamma.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Gamma.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialFvscheduleFormula()
 {
-    initTestEnv(u"opencl/financial/Fvschedule.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Fvschedule.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaAbs()
 {
-    initTestEnv(u"opencl/math/Abs.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/math/Abs.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Verify ABS Function
     for (SCROW i = 1; i <= 1000; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialSYDFormula()
 {
-    initTestEnv(u"opencl/financial/SYD.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/SYD.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
@@ -1159,15 +1193,15 @@ void ScOpenCLTest::testFinacialSYDFormula()
 #if !defined MACOSX
 void ScOpenCLTest::testFinacialIRRFormula()
 {
-    initTestEnv(u"opencl/financial/IRR.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/IRR.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
@@ -1175,139 +1209,139 @@ void ScOpenCLTest::testFinacialIRRFormula()
 
 void ScOpenCLTest::testStatisticalFormulaGammaLn()
 {
-    initTestEnv(u"opencl/statistical/GammaLn.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/GammaLn.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaGauss()
 {
-    initTestEnv(u"opencl/statistical/Gauss.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Gauss.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaGeoMean()
 {
-    initTestEnv(u"opencl/statistical/GeoMean.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/GeoMean.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaHarMean()
 {
-    initTestEnv(u"opencl/statistical/HarMean.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/HarMean.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialSLNFormula()
 {
-    initTestEnv(u"opencl/financial/SLN.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/SLN.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialMIRRFormula()
 {
-    initTestEnv(u"opencl/financial/MIRR.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/MIRR.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinancialCoupdaybsFormula()
 {
-    initTestEnv(u"opencl/financial/Coupdaybs.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Coupdaybs.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <=10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialDollardeFormula()
 {
-    initTestEnv(u"opencl/financial/Dollarde.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Dollarde.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinancialCoupdaysFormula()
 {
-    initTestEnv(u"opencl/financial/Coupdays.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Coupdays.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <=10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
@@ -1315,302 +1349,302 @@ void ScOpenCLTest::testFinancialCoupdaysFormula()
 
 void ScOpenCLTest::testFinancialCoupdaysncFormula()
 {
-    initTestEnv(u"opencl/financial/Coupdaysnc.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Coupdaysnc.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <=10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinacialRateFormula()
 {
-    initTestEnv(u"opencl/financial/RATE.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/RATE.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <= 5; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
+        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));
     }
 }
 
 void ScOpenCLTest::testFinancialAccrintmFormula()
 {
-    initTestEnv(u"opencl/financial/Accrintm.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Accrintm.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinancialCoupnumFormula()
 {
-    initTestEnv(u"opencl/financial/Coupnum.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Coupnum.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaNegbinomdist()
 {
-    initTestEnv(u"opencl/statistical/Negbinomdist.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Negbinomdist.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaSin()
 {
-    initTestEnv(u"opencl/math/sin.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/sin.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaSumSQ()
 {
-    initTestEnv(u"opencl/math/sumsq.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/sumsq.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i < 20; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(5,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaTan()
 {
-    initTestEnv(u"opencl/math/tan.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/tan.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaTanH()
 {
-    initTestEnv(u"opencl/math/tanh.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/tanh.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaSqrt()
 {
-    initTestEnv(u"opencl/math/sqrt.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/sqrt.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialPriceFormula()
 {
-    initTestEnv(u"opencl/financial/Price.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Price.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialDollarfrFormula()
 {
-    initTestEnv(u"opencl/financial/Dollarfr.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Dollarfr.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialPriceDiscFormula()
 {
-    initTestEnv(u"opencl/financial/PriceDisc.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/PriceDisc.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialODDLPRICEFormula()
 {
-    initTestEnv(u"opencl/financial/Oddlprice.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Oddlprice.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(8, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(8, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest:: testFinacialOddlyieldFormula()
 {
-    initTestEnv(u"opencl/financial/Oddlyield.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Oddlyield.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(8, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(8, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialDISCFormula()
 {
-    initTestEnv(u"opencl/financial/DISC.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/DISC.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest:: testFinacialPVFormula()
 {
-    initTestEnv(u"opencl/financial/PV.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/PV.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialINTRATEFormula()
 {
-    initTestEnv(u"opencl/financial/INTRATE.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/INTRATE.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaStandard()
 {
-    initTestEnv(u"opencl/statistical/Standard.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Standard.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 20; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaWeibull()
 {
-    initTestEnv(u"opencl/statistical/Weibull.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Weibull.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 20; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(4,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
             fExcel == 0?1e-4:fabs(1e-4*fExcel));
     }
@@ -1618,1303 +1652,1304 @@ void ScOpenCLTest::testStatisticalFormulaWeibull()
 
 void ScOpenCLTest::testStatisticalFormulaVar()
 {
-    initTestEnv(u"opencl/statistical/Var.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Var.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 20; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaSkew()
 {
-    initTestEnv(u"opencl/statistical/Skew.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Skew.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 20; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaSkewp()
 {
-    initTestEnv(u"opencl/statistical/Skewp.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Skewp.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 20; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaPearson()
 {
-    initTestEnv(u"opencl/statistical/Pearson.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Pearson.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaRsq()
 {
-    initTestEnv(u"opencl/statistical/Rsq.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Rsq.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaTrunc()
 {
-    initTestEnv(u"opencl/math/trunc.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/trunc.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaCosh()
 {
-    initTestEnv(u"opencl/math/cosh.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/math/cosh.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testStatisticalFormulaCovar()
 {
-    initTestEnv(u"opencl/statistical/Covar.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Covar.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 0; i <= 16; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaKurt()
 {
-    initTestEnv(u"opencl/statistical/Kurt.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Kurt.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaCot()
 {
-    initTestEnv(u"opencl/math/cot.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/math/cot.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaDevSq()
 {
-    initTestEnv(u"opencl/statistical/DevSq.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/DevSq.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 0; i <= 11; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaCsc()
 {
-    initTestEnv(u"opencl/math/csc.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/math/csc.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaCoth()
 {
-    initTestEnv(u"opencl/math/coth.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/math/coth.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialXNPVFormula()
 {
-    initTestEnv(u"opencl/financial/XNPV.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/XNPV.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 
     for (SCROW i = 16; i <= 26; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaIntercept()
 {
-    initTestEnv(u"opencl/statistical/Intercept.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Intercept.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinancialAmordegrcFormula()
 {
-    initTestEnv(u"opencl/financial/Amordegrc.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Amordegrc.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest:: testFinancialISPMTFormula()
 {
-    initTestEnv(u"opencl/financial/ISPMT.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/ISPMT.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaMedian()
 {
-    initTestEnv(u"opencl/statistical/Median.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Median.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaNormdist()
 {
-    initTestEnv(u"opencl/statistical/Normdist.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Normdist.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(4,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaNormsdist()
 {
-    initTestEnv(u"opencl/statistical/Normsdist.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Normsdist.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaPermut()
 {
-    initTestEnv(u"opencl/statistical/Permut.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Permut.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaPermutation()
 {
-    initTestEnv(u"opencl/statistical/Permutation.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Permutation.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaPhi()
 {
-    initTestEnv(u"opencl/statistical/Phi.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Phi.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaCscH()
 {
-    initTestEnv(u"opencl/math/csch.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/math/csch.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaLogInv()
 {
-    initTestEnv(u"opencl/statistical/LogInv.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/LogInv.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialNPERFormula()
 {
-    initTestEnv(u"opencl/financial/NPER.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/NPER.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaForecast()
 {
-    initTestEnv(u"opencl/statistical/Forecast.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/statistical/Forecast.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinancialAmorlincFormula()
 {
-    initTestEnv(u"opencl/financial/Amorlinc.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Amorlinc.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinancialDDBFormula()
 {
-    initTestEnv(u"opencl/financial/ddb.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/ddb.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinacialPriceMatFormula()
 {
-    initTestEnv(u"opencl/financial/PriceMat.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/PriceMat.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
+        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));
     }
 }
 void ScOpenCLTest::testFinacialFormulaReceived()
 {
-    initTestEnv(u"opencl/financial/Received.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Received.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 0; i < 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(5,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinancialFormulaCumipmt()
 {
-    initTestEnv(u"opencl/financial/Cumipmt.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Cumipmt.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
+        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));
     }
 }
 void ScOpenCLTest::testFinancialFormulaCumprinc()
 {
-    initTestEnv(u"opencl/financial/Cumprinc.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Cumprinc.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 10; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
+        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));
     }
 }
 void ScOpenCLTest::testFinacialRRIFormula()
 {
-    initTestEnv(u"opencl/financial/RRI.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/RRI.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinacialEFFECT_ADDFormula()
 {
-    initTestEnv(u"opencl/financial/EFFECT_ADD.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/EFFECT_ADD.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinacialNominalFormula()
 {
-    initTestEnv(u"opencl/financial/Nominal.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Nominal.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(3,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinacialTBILLEQFormula()
 {
-    initTestEnv(u"opencl/financial/TBILLEQ.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/TBILLEQ.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinacialTBILLPRICEFormula()
 {
-    initTestEnv(u"opencl/financial/TBILLPRICE.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/TBILLPRICE.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinacialTBILLYIELDFormula()
 {
-    initTestEnv(u"opencl/financial/TBILLYIELD.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/TBILLYIELD.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 void ScOpenCLTest::testFinacialYIELDFormula()
 {
-    initTestEnv(u"opencl/financial/YIELD.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/YIELD.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialYIELDDISCFormula()
 {
-    initTestEnv(u"opencl/financial/YIELDDISC.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/YIELDDISC.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testFinacialYIELDMATFormula()
 {
-    initTestEnv(u"opencl/financial/YIELDMAT.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/YIELDMAT.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
+        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));
     }
 }
 void ScOpenCLTest:: testFinacialPMTFormula()
 {
-    initTestEnv(u"opencl/financial/PMT.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/PMT.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest:: testFinancialDurationFormula()
 {
-    initTestEnv(u"opencl/financial/Duration.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/financial/Duration.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
+        double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+        double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testStatisticalFormulaLogNormDist()
 {
-    initTestEnv(u"opencl/statistical/LogNormDist.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/statistical/LogNormDist.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Check the results of formula cells in the shared formula range.
     for (SCROW i = 1; i <= 19; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(4,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(4,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaArcCos()
 {
-    initTestEnv(u"opencl/math/ArcCos.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/math/ArcCos.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     // Verify ACos Function
     for (SCROW i = 1; i <= 1000; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(1,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest::testMathFormulaPower()
 {
-    initTestEnv(u"opencl/math/power.", FORMAT_ODS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"ods/opencl/math/power.ods");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 15; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(2,i,0));
-        double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
+        double fLibre = pDoc->GetValue(ScAddress(2,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     }
 }
 
 void ScOpenCLTest:: testFinacialPPMTFormula()
 {
-    initTestEnv(u"opencl/financial/PPMT.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/PPMT.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
+        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));
     }
 }
 
 void ScOpenCLTest:: testFinacialNPVFormula()
 {
-    initTestEnv(u"opencl/financial/NPV.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/NPV.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 6; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
+        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));
     }
 }
 
 void ScOpenCLTest:: testFinancialDuration_ADDFormula()
 {
-    initTestEnv(u"opencl/financial/Duration_ADD.", FORMAT_XLS);
-    ScDocument& rDoc = xDocSh->GetDocument();
-    ScDocument& rDocRes = xDocShRes->GetDocument();
-    rDoc.CalcAll();
+    initTestEnv(u"xls/opencl/financial/Duration_ADD.xls");
+    ScDocument* pDoc = getScDoc();
+    ScDocument* pDocRes = getScDoc2();
+    pDoc->CalcAll();
 
     for (SCROW i = 0; i <= 9; ++i)
     {
-        double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
-        double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));

... etc. - the rest is truncated

Reply via email to