LCOV - code coverage report
Current view: top level - sc/qa/unit - opencl-test.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 914 3812 24.0 %
Date: 2014-11-03 Functions: 235 238 98.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is added by mcw.
       4             :  */
       5             : 
       6             : #include <sal/config.h>
       7             : #include <unotest/filters-test.hxx>
       8             : #include <test/bootstrapfixture.hxx>
       9             : #include <rtl/strbuf.hxx>
      10             : #include <osl/file.hxx>
      11             : 
      12             : #include "scdll.hxx"
      13             : #include <sfx2/app.hxx>
      14             : #include <sfx2/docfilt.hxx>
      15             : #include <sfx2/docfile.hxx>
      16             : #include <sfx2/sfxmodelfactory.hxx>
      17             : #include <svl/stritem.hxx>
      18             : 
      19             : #include "helper/qahelper.hxx"
      20             : 
      21             : #include "calcconfig.hxx"
      22             : #include "interpre.hxx"
      23             : 
      24             : #include "docsh.hxx"
      25             : #include "postit.hxx"
      26             : #include "patattr.hxx"
      27             : #include "scitems.hxx"
      28             : #include "document.hxx"
      29             : #include "cellform.hxx"
      30             : #include "drwlayer.hxx"
      31             : #include "userdat.hxx"
      32             : #include "formulacell.hxx"
      33             : #include "platforminfo.hxx"
      34             : #include "formulagroup.hxx"
      35             : 
      36             : #include <svx/svdpage.hxx>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::com::sun::star::uno;
      40             : 
      41             : /* Implementation of Filters test */
      42             : 
      43         892 : class ScOpenCLTest
      44             :     : public test::FiltersTest
      45             :     , public ScBootstrapFixture
      46             : {
      47             : public:
      48             :     ScOpenCLTest();
      49             : 
      50             :     /**
      51             :      * Try to auto-detect OpenCL device if one is available.
      52             :      *
      53             :      * @return true if a usable OpenCL device is found, false otherwise.
      54             :      */
      55             :     bool detectOpenCLDevice();
      56             : 
      57             :     /**
      58             :      * Turn on OpenCL group interpreter. Call this after the document is
      59             :      * loaded and before performing formula calculation.
      60             :      */
      61             :     void enableOpenCL();
      62             : 
      63             :     virtual void setUp() SAL_OVERRIDE;
      64             :     virtual void tearDown() SAL_OVERRIDE;
      65             : 
      66             :     virtual bool load( const OUString &rFilter, const OUString &rURL,
      67             :             const OUString &rUserData, unsigned int nFilterFlags,
      68             :             unsigned int nClipboardID, unsigned int nFilterVersion) SAL_OVERRIDE;
      69             :     void testSharedFormulaXLS();
      70             : #if 0
      71             :     void testSharedFormulaXLSGroundWater();
      72             :     void testSharedFormulaXLSStockHistory();
      73             : #endif
      74             :     void testFinacialFormula();
      75             :     void testStatisticalFormulaFisher();
      76             :     void testStatisticalFormulaFisherInv();
      77             :     void testStatisticalFormulaGamma();
      78             :     void testFinacialFvscheduleFormula();
      79             : // this test has intermittent failures on OSX
      80             : #if !defined MACOSX
      81             :     void testFinacialIRRFormula();
      82             : #endif
      83             :     void testFinacialMIRRFormula();
      84             :     void testFinacialRateFormula();
      85             :     void testFinancialAccrintmFormula();
      86             :     void testFinancialAccrintFormula();
      87             :     void testCompilerHorizontal();
      88             :     void testCompilerNested();
      89             :     void testFinacialSLNFormula();
      90             :     void testStatisticalFormulaGammaLn();
      91             :     void testStatisticalFormulaGauss();
      92             :     void testStatisticalFormulaGeoMean();
      93             :     void testStatisticalFormulaHarMean();
      94             :     void testFinancialCoupdaybsFormula();
      95             :     void testFinacialDollardeFormula();
      96             :     void testCompilerString();
      97             :     void testCompilerInEq();
      98             :     void testFinacialDollarfrFormula();
      99             :     void testFinacialSYDFormula();
     100             :     void testStatisticalFormulaCorrel();
     101             :     void testFinancialCoupdaysFormula();
     102             :     void testFinancialCoupdaysncFormula();
     103             :     void testFinacialDISCFormula();
     104             :     void testFinacialINTRATEFormula();
     105             :     void testMathFormulaCos();
     106             :     void testMathFormulaCsc();
     107             :     void testStatisticalFormulaRsq();
     108             :     void testStatisticalFormulaPearson();
     109             :     void testStatisticalFormulaNegbinomdist();
     110             :     void testFinacialXNPVFormula();
     111             :     void testFinacialPriceMatFormula();
     112             :     void testFinacialFormulaReceived();
     113             :     void testFinancialFormulaCumipmt();
     114             :     void testFinancialFormulaCumprinc();
     115             :     void testFinacialRRIFormula();
     116             :     void testFinacialEFFECT_ADDFormula();
     117             :     void testFinacialNominalFormula();
     118             :     void testFinacialTBILLEQFormula();
     119             :     void testFinacialTBILLPRICEFormula();
     120             :     void testFinacialTBILLYIELDFormula();
     121             :     void testFinacialYIELDFormula();
     122             :     void testFinacialYIELDDISCFormula();
     123             :     void testFinacialYIELDMATFormula();
     124             :     void testFinacialPMTFormula();
     125             :     void testFinacialPPMTFormula();
     126             :     void testFinancialISPMTFormula();
     127             :     void testFinacialPriceFormula();
     128             :     void testFinancialDurationFormula();
     129             :     void testFinancialCoupnumFormula();
     130             :     void testMathFormulaSinh();
     131             :     void testMathFormulaAbs();
     132             :     void testFinacialPVFormula();
     133             :     void testMathFormulaSin();
     134             :     void testMathFormulaTan();
     135             :     void testMathFormulaTanH();
     136             :     void testStatisticalFormulaStandard();
     137             :     void testStatisticalFormulaWeibull();
     138             :     void testStatisticalFormulaMedian();
     139             :     void testFinancialDuration_ADDFormula();
     140             :     void testFinancialAmordegrcFormula();
     141             :     void testFinancialAmorlincFormula();
     142             :     void testFinancialDDBFormula();
     143             :     void testFinancialFVFormula();
     144             :     void testFinancialMDurationFormula();
     145             :     void testMathSumIfsFormula();
     146             :     void testFinancialVDBFormula();
     147             :     void testStatisticalFormulaKurt();
     148             :     void testFinacialNPERFormula();
     149             :     void testStatisticalFormulaNormdist();
     150             :     void testMathFormulaArcCos();
     151             :     void testMathFormulaSqrt();
     152             :     void testMathFormulaArcCosHyp();
     153             :     void testFinancialXirrFormula();
     154             :     void testFinacialNPVFormula();
     155             :     void testStatisticalFormulaNormsdist();
     156             :     void testStatisticalFormulaNorminv();
     157             :     void testStatisticalFormulaNormsinv();
     158             :     void testStatisticalFormulaPermut();
     159             :     void testStatisticalFormulaPermutation();
     160             :     void testStatisticalFormulaPhi();
     161             :     void testFinancialIPMTFormula();
     162             :     void testStatisticalFormulaConfidence();
     163             :     void testStatisticalFormulaIntercept();
     164             :     void testFinacialODDLPRICEFormula();
     165             :     void testFinacialOddlyieldFormula();
     166             :     void testFinacialPriceDiscFormula();
     167             :     void testFinancialDBFormula();
     168             :     void testFinancialCouppcdFormula();
     169             :     void testFinancialCoupncdFormula();
     170             :     void testStatisticalFormulaLogInv();
     171             :     void testMathFormulaArcCot();
     172             :     void testMathFormulaCosh();
     173             :     void testStatisticalFormulaCritBinom();
     174             :     void testMathFormulaArcCotHyp();
     175             :     void testMathFormulaArcSin();
     176             :     void testMathFormulaArcSinHyp();
     177             :     void testMathFormulaArcTan();
     178             :     void testMathFormulaArcTanHyp();
     179             :     void testMathFormulaBitAnd();
     180             :     void testStatisticalFormulaForecast();
     181             :     void testStatisticalFormulaLogNormDist();
     182             :     void testStatisticalFormulaGammaDist();
     183             :     void testMathFormulaLN();
     184             :     void testMathFormulaRound();
     185             :     void testMathFormulaCot();
     186             :     void testMathFormulaCoth();
     187             :     void testFinacialNPER1Formula();
     188             :     void testStatisticalFormulaFDist();
     189             :     void testStatisticalFormulaVar();
     190             :     void testStatisticalFormulaChiDist();
     191             :     void testMathFormulaPower();
     192             :     void testMathFormulaOdd();
     193             :     void testStatisticalFormulaChiSqDist();
     194             :     void testStatisticalFormulaChiSqInv();
     195             :     void testStatisticalFormulaGammaInv();
     196             :     void testMathFormulaFloor();
     197             :     void testStatisticalFormulaFInv();
     198             :     void testStatisticalFormulaFTest();
     199             :     void testStatisticalFormulaB();
     200             :     void testStatisticalFormulaBetaDist();
     201             :     void testMathFormulaCscH();
     202             :     void testMathFormulaExp();
     203             :     void testMathFormulaLog10();
     204             :     void testStatisticalFormulaExpondist();
     205             :     void testMathAverageIfsFormula();
     206             :     void testMathCountIfsFormula();
     207             :     void testMathFormulaCombina();
     208             :     void testMathFormulaEven();
     209             :     void testMathFormulaLog();
     210             :     void testMathFormulaMod();
     211             :     void testMathFormulaTrunc();
     212             :     void testStatisticalFormulaSkew();
     213             :     void testMathFormulaArcTan2();
     214             :     void testMathFormulaBitOr();
     215             :     void testMathFormulaBitLshift();
     216             :     void testMathFormulaBitRshift();
     217             :     void testMathFormulaBitXor();
     218             :     void testStatisticalFormulaChiInv();
     219             :     void testStatisticalFormulaPoisson();
     220             :     void testMathFormulaSumSQ();
     221             :     void testStatisticalFormulaSkewp();
     222             :     void testMathFormulaSqrtPi();
     223             :     void testStatisticalFormulaBinomDist();
     224             :     void testStatisticalFormulaVarP();
     225             :     void testMathFormulaCeil();
     226             :     // void testMathFormulaKombin();
     227             :     void testStatisticalFormulaDevSq();
     228             :     void testStatisticalFormulaStDev();
     229             :     void testStatisticalFormulaSlope();
     230             :     void testStatisticalFormulaSTEYX();
     231             :     void testStatisticalFormulaZTest();
     232             :     void testMathFormulaPi();
     233             :     void testMathFormulaRandom();
     234             :     void testMathFormulaConvert();
     235             :     void testMathFormulaProduct();
     236             :     void testStatisticalFormulaHypGeomDist();
     237             :     void testArrayFormulaSumX2MY2();
     238             :     void testArrayFormulaSumX2PY2();
     239             :     void testStatisticalFormulaBetainv();
     240             :     void testStatisticalFormulaTTest();
     241             :     void testStatisticalFormulaTDist();
     242             :     void testStatisticalFormulaTInv();
     243             :     void testArrayFormulaSumXMY2();
     244             :     void testStatisticalFormulaStDevP();
     245             :     void testStatisticalFormulaCovar();
     246             :     void testLogicalFormulaAnd();
     247             :     void testLogicalFormulaOr();
     248             :     void testMathFormulaSumProduct();
     249             :     void testMathFormulaSumProduct2();
     250             :     void testStatisticalParallelCountBug();
     251             :     void testSpreadSheetFormulaVLookup();
     252             :     void testLogicalFormulaNot();
     253             :     void testLogicalFormulaXor();
     254             :     void testDatabaseFormulaDmax();
     255             :     void testDatabaseFormulaDmin();
     256             :     void testDatabaseFormulaDproduct();
     257             :     void testDatabaseFormulaDaverage();
     258             :     void testDatabaseFormulaDstdev();
     259             :     void testDatabaseFormulaDstdevp();
     260             :     void testDatabaseFormulaDsum();
     261             :     void testDatabaseFormulaDvar();
     262             :     void testDatabaseFormulaDvarp();
     263             :     void testMathFormulaAverageIf();
     264             :     void testDatabaseFormulaDcount();
     265             :     void testDatabaseFormulaDcountA();
     266             :     void testMathFormulaDegrees();
     267             :     void testMathFormulaRoundUp();
     268             :     void testMathFormulaRoundDown();
     269             :     void testMathFormulaInt();
     270             :     void testMathFormulaRadians();
     271             :     void testMathFormulaCountIf();
     272             :     void testMathFormulaIsEven();
     273             :     void testMathFormulaIsOdd();
     274             :     void testMathFormulaFact();
     275             :     void testStatisticalFormulaMina();
     276             :     void testStatisticalFormulaCountA();
     277             :     void testStatisticalFormulaMaxa();
     278             :     void testStatisticalFormulaAverageA();
     279             :     void testStatisticalFormulaVarA();
     280             :     void testStatisticalFormulaVarPA();
     281             :     void testStatisticalFormulaStDevA();
     282             :     void testStatisticalFormulaStDevPA();
     283             :     void testMathFormulaSEC();
     284             :     void testMathFormulaSECH();
     285             :     void testMathFormulaMROUND();
     286             :     void testMathFormulaSeriesSum();
     287             :     void testMathFormulaQuotient();
     288             :     void testMathFormulaSumIf();
     289             :     void testAddInFormulaBesseLJ();
     290             :     void testNegSub();
     291             :     void testStatisticalFormulaAvedev();
     292             :     void testMathFormulaAverageIf_Mix();
     293             :     void testStatisticalFormulaKurt1();
     294             :     void testStatisticalFormulaHarMean1();
     295             :     void testStatisticalFormulaVarA1();
     296             :     void testStatisticalFormulaVarPA1();
     297             :     void testStatisticalFormulaStDevA1();
     298             :     void testStatisticalFormulaStDevPA1();
     299             :     void testFinancialMDurationFormula1();
     300           4 :     CPPUNIT_TEST_SUITE(ScOpenCLTest);
     301           2 :     CPPUNIT_TEST(testSharedFormulaXLS);
     302           2 :     CPPUNIT_TEST(testFinacialFormula);
     303           2 :     CPPUNIT_TEST(testStatisticalFormulaFisher);
     304           2 :     CPPUNIT_TEST(testStatisticalFormulaFisherInv);
     305           2 :     CPPUNIT_TEST(testStatisticalFormulaGamma);
     306           2 :     CPPUNIT_TEST(testFinacialFvscheduleFormula);
     307             : // this test has intermittent failures on OSX
     308             : #if !defined MACOSX
     309           2 :     CPPUNIT_TEST(testFinacialIRRFormula);
     310             : #endif
     311           2 :     CPPUNIT_TEST(testFinacialMIRRFormula);
     312           2 :     CPPUNIT_TEST(testFinacialRateFormula);
     313           2 :     CPPUNIT_TEST(testCompilerHorizontal);
     314           2 :     CPPUNIT_TEST(testCompilerNested);
     315           2 :     CPPUNIT_TEST(testFinacialSLNFormula);
     316           2 :     CPPUNIT_TEST(testFinancialAccrintmFormula);
     317           2 :     CPPUNIT_TEST(testStatisticalFormulaGammaLn);
     318           2 :     CPPUNIT_TEST(testStatisticalFormulaGauss);
     319           2 :     CPPUNIT_TEST(testStatisticalFormulaGeoMean);
     320           2 :     CPPUNIT_TEST(testStatisticalFormulaHarMean);
     321           2 :     CPPUNIT_TEST(testFinancialCoupdaybsFormula);
     322           2 :     CPPUNIT_TEST(testFinacialDollardeFormula);
     323           2 :     CPPUNIT_TEST(testCompilerString);
     324           2 :     CPPUNIT_TEST(testCompilerInEq);
     325           2 :     CPPUNIT_TEST(testFinacialDollarfrFormula);
     326           2 :     CPPUNIT_TEST(testFinacialSYDFormula);
     327           2 :     CPPUNIT_TEST(testStatisticalFormulaCorrel);
     328           2 :     CPPUNIT_TEST(testFinancialCoupdaysFormula);
     329           2 :     CPPUNIT_TEST(testFinancialCoupdaysncFormula);
     330           2 :     CPPUNIT_TEST(testFinacialDISCFormula);
     331           2 :     CPPUNIT_TEST(testFinacialINTRATEFormula);
     332           2 :     CPPUNIT_TEST(testMathFormulaCos);
     333           2 :     CPPUNIT_TEST(testStatisticalFormulaNegbinomdist);
     334           2 :     CPPUNIT_TEST(testStatisticalFormulaRsq);
     335           2 :     CPPUNIT_TEST(testStatisticalFormulaPearson);
     336           2 :     CPPUNIT_TEST(testMathFormulaCsc);
     337           2 :     CPPUNIT_TEST(testFinacialPriceMatFormula);
     338           2 :     CPPUNIT_TEST(testFinacialXNPVFormula);
     339           2 :     CPPUNIT_TEST(testFinacialFormulaReceived);
     340           2 :     CPPUNIT_TEST(testFinancialFormulaCumipmt);
     341           2 :     CPPUNIT_TEST(testFinancialFormulaCumprinc);
     342           2 :     CPPUNIT_TEST(testFinacialRRIFormula);
     343           2 :     CPPUNIT_TEST(testFinacialEFFECT_ADDFormula);
     344           2 :     CPPUNIT_TEST(testFinacialNominalFormula);
     345           2 :     CPPUNIT_TEST(testFinacialTBILLEQFormula);
     346           2 :     CPPUNIT_TEST(testFinacialTBILLPRICEFormula);
     347           2 :     CPPUNIT_TEST(testFinacialTBILLYIELDFormula);
     348           2 :     CPPUNIT_TEST(testFinacialYIELDFormula);
     349           2 :     CPPUNIT_TEST(testFinacialYIELDDISCFormula);
     350           2 :     CPPUNIT_TEST(testFinacialYIELDMATFormula);
     351           2 :     CPPUNIT_TEST(testFinacialPPMTFormula);
     352           2 :     CPPUNIT_TEST(testFinacialPMTFormula);
     353           2 :     CPPUNIT_TEST(testFinancialISPMTFormula);
     354           2 :     CPPUNIT_TEST(testFinacialPriceFormula);
     355           2 :     CPPUNIT_TEST(testFinancialDurationFormula);
     356           2 :     CPPUNIT_TEST(testFinancialCoupnumFormula);
     357           2 :     CPPUNIT_TEST(testMathFormulaSinh);
     358           2 :     CPPUNIT_TEST(testMathFormulaAbs);
     359           2 :     CPPUNIT_TEST(testFinacialPVFormula);
     360           2 :     CPPUNIT_TEST(testMathFormulaSin);
     361           2 :     CPPUNIT_TEST(testMathFormulaTan);
     362           2 :     CPPUNIT_TEST(testMathFormulaTanH);
     363           2 :     CPPUNIT_TEST(testStatisticalFormulaStandard);
     364           2 :     CPPUNIT_TEST(testStatisticalFormulaWeibull);
     365           2 :     CPPUNIT_TEST(testStatisticalFormulaMedian);
     366           2 :     CPPUNIT_TEST(testFinancialDuration_ADDFormula);
     367           2 :     CPPUNIT_TEST(testFinancialAmordegrcFormula);
     368           2 :     CPPUNIT_TEST(testFinancialAmorlincFormula);
     369           2 :     CPPUNIT_TEST(testFinancialDDBFormula);
     370           2 :     CPPUNIT_TEST(testFinancialFVFormula);
     371           2 :     CPPUNIT_TEST(testFinancialMDurationFormula);
     372           2 :     CPPUNIT_TEST(testMathSumIfsFormula);
     373           2 :     CPPUNIT_TEST(testFinancialVDBFormula);
     374           2 :     CPPUNIT_TEST(testStatisticalFormulaKurt);
     375           2 :     CPPUNIT_TEST(testFinacialNPERFormula);
     376           2 :     CPPUNIT_TEST(testStatisticalFormulaNormdist);
     377           2 :     CPPUNIT_TEST(testMathFormulaArcCos);
     378           2 :     CPPUNIT_TEST(testMathFormulaSqrt);
     379           2 :     CPPUNIT_TEST(testMathFormulaArcCosHyp);
     380           2 :     CPPUNIT_TEST(testFinancialXirrFormula);
     381           2 :     CPPUNIT_TEST(testFinacialNPVFormula);
     382           2 :     CPPUNIT_TEST(testStatisticalFormulaNormsdist);
     383           2 :     CPPUNIT_TEST(testStatisticalFormulaNorminv);
     384           2 :     CPPUNIT_TEST(testStatisticalFormulaNormsinv);
     385           2 :     CPPUNIT_TEST(testStatisticalFormulaPermut);
     386           2 :     CPPUNIT_TEST(testStatisticalFormulaPermutation);
     387           2 :     CPPUNIT_TEST(testStatisticalFormulaPhi);
     388           2 :     CPPUNIT_TEST(testFinancialIPMTFormula);
     389           2 :     CPPUNIT_TEST(testStatisticalFormulaConfidence);
     390           2 :     CPPUNIT_TEST(testStatisticalFormulaIntercept);
     391           2 :     CPPUNIT_TEST(testFinacialODDLPRICEFormula);
     392           2 :     CPPUNIT_TEST(testFinacialOddlyieldFormula);
     393           2 :     CPPUNIT_TEST(testFinacialPriceDiscFormula);
     394           2 :     CPPUNIT_TEST(testFinancialDBFormula);
     395           2 :     CPPUNIT_TEST(testFinancialCouppcdFormula);
     396           2 :     CPPUNIT_TEST(testFinancialCoupncdFormula);
     397           2 :     CPPUNIT_TEST(testFinancialAccrintFormula);
     398           2 :     CPPUNIT_TEST(testStatisticalFormulaLogInv);
     399           2 :     CPPUNIT_TEST(testMathFormulaArcCot);
     400           2 :     CPPUNIT_TEST(testMathFormulaCosh);
     401           2 :     CPPUNIT_TEST(testStatisticalFormulaCritBinom);
     402           2 :     CPPUNIT_TEST(testMathFormulaArcCotHyp);
     403           2 :     CPPUNIT_TEST(testMathFormulaArcSin);
     404           2 :     CPPUNIT_TEST(testMathFormulaArcSinHyp);
     405           2 :     CPPUNIT_TEST(testMathFormulaArcTan);
     406           2 :     CPPUNIT_TEST(testMathFormulaArcTanHyp);
     407           2 :     CPPUNIT_TEST(testMathFormulaBitAnd);
     408           2 :     CPPUNIT_TEST(testStatisticalFormulaForecast);
     409           2 :     CPPUNIT_TEST(testStatisticalFormulaLogNormDist);
     410           2 :     CPPUNIT_TEST(testStatisticalFormulaGammaDist);
     411           2 :     CPPUNIT_TEST(testMathFormulaLN);
     412           2 :     CPPUNIT_TEST(testMathFormulaRound);
     413           2 :     CPPUNIT_TEST(testMathFormulaCot);
     414           2 :     CPPUNIT_TEST(testMathFormulaCoth);
     415           2 :     CPPUNIT_TEST(testFinacialNPER1Formula);
     416           2 :     CPPUNIT_TEST(testStatisticalFormulaFDist);
     417           2 :     CPPUNIT_TEST(testStatisticalFormulaVar);
     418           2 :     CPPUNIT_TEST(testStatisticalFormulaChiDist);
     419           2 :     CPPUNIT_TEST(testMathFormulaPower);
     420           2 :     CPPUNIT_TEST(testMathFormulaOdd);
     421           2 :     CPPUNIT_TEST(testStatisticalFormulaChiSqDist);
     422           2 :     CPPUNIT_TEST(testStatisticalFormulaChiSqInv);
     423           2 :     CPPUNIT_TEST(testStatisticalFormulaGammaInv);
     424           2 :     CPPUNIT_TEST(testMathFormulaFloor);
     425           2 :     CPPUNIT_TEST(testStatisticalFormulaFInv);
     426           2 :     CPPUNIT_TEST(testStatisticalFormulaFTest);
     427           2 :     CPPUNIT_TEST(testStatisticalFormulaB);
     428           2 :     CPPUNIT_TEST(testStatisticalFormulaBetaDist);
     429           2 :     CPPUNIT_TEST(testMathFormulaCscH);
     430           2 :     CPPUNIT_TEST(testMathFormulaExp);
     431           2 :     CPPUNIT_TEST(testMathFormulaLog10);
     432           2 :     CPPUNIT_TEST(testStatisticalFormulaExpondist);
     433           2 :     CPPUNIT_TEST(testMathAverageIfsFormula);
     434           2 :     CPPUNIT_TEST(testMathCountIfsFormula);
     435           2 :     CPPUNIT_TEST(testMathFormulaCombina);
     436           2 :     CPPUNIT_TEST(testMathFormulaEven);
     437           2 :     CPPUNIT_TEST(testMathFormulaLog);
     438           2 :     CPPUNIT_TEST(testMathFormulaMod);
     439           2 :     CPPUNIT_TEST(testMathFormulaTrunc);
     440           2 :     CPPUNIT_TEST(testStatisticalFormulaSkew);
     441           2 :     CPPUNIT_TEST(testMathFormulaArcTan2);
     442           2 :     CPPUNIT_TEST(testMathFormulaBitOr);
     443           2 :     CPPUNIT_TEST(testMathFormulaBitLshift);
     444           2 :     CPPUNIT_TEST(testMathFormulaBitRshift);
     445           2 :     CPPUNIT_TEST(testMathFormulaBitXor);
     446           2 :     CPPUNIT_TEST(testStatisticalFormulaChiInv);
     447           2 :     CPPUNIT_TEST(testStatisticalFormulaPoisson);
     448           2 :     CPPUNIT_TEST(testMathFormulaSumSQ);
     449           2 :     CPPUNIT_TEST(testStatisticalFormulaSkewp);
     450           2 :     CPPUNIT_TEST(testMathFormulaSqrtPi);
     451           2 :     CPPUNIT_TEST(testStatisticalFormulaBinomDist);
     452           2 :     CPPUNIT_TEST(testStatisticalFormulaVarP);
     453           2 :     CPPUNIT_TEST(testMathFormulaCeil);
     454             :     // This test fails MacOS 10.8. Disabled temporarily
     455             :     // CPPUNIT_TEST(testMathFormulaKombin);
     456           2 :     CPPUNIT_TEST(testStatisticalFormulaDevSq);
     457           2 :     CPPUNIT_TEST(testStatisticalFormulaStDev);
     458           2 :     CPPUNIT_TEST(testStatisticalFormulaSlope);
     459           2 :     CPPUNIT_TEST(testStatisticalFormulaSTEYX);
     460           2 :     CPPUNIT_TEST(testStatisticalFormulaZTest);
     461           2 :     CPPUNIT_TEST(testMathFormulaPi);
     462           2 :     CPPUNIT_TEST(testMathFormulaRandom);
     463           2 :     CPPUNIT_TEST(testMathFormulaConvert);
     464           2 :     CPPUNIT_TEST(testMathFormulaProduct);
     465           2 :     CPPUNIT_TEST(testStatisticalFormulaHypGeomDist);
     466           2 :     CPPUNIT_TEST(testArrayFormulaSumX2MY2);
     467           2 :     CPPUNIT_TEST(testArrayFormulaSumX2PY2);
     468           2 :     CPPUNIT_TEST(testStatisticalFormulaBetainv);
     469           2 :     CPPUNIT_TEST(testStatisticalFormulaTTest);
     470           2 :     CPPUNIT_TEST(testStatisticalFormulaTDist);
     471           2 :     CPPUNIT_TEST(testStatisticalFormulaTInv);
     472           2 :     CPPUNIT_TEST(testArrayFormulaSumXMY2);
     473           2 :     CPPUNIT_TEST(testStatisticalFormulaStDevP);
     474           2 :     CPPUNIT_TEST(testStatisticalFormulaCovar);
     475           2 :     CPPUNIT_TEST(testLogicalFormulaAnd);
     476           2 :     CPPUNIT_TEST(testMathFormulaSumProduct);
     477           2 :     CPPUNIT_TEST(testMathFormulaSumProduct2);
     478           2 :     CPPUNIT_TEST(testStatisticalParallelCountBug);
     479           2 :     CPPUNIT_TEST(testSpreadSheetFormulaVLookup);
     480           2 :     CPPUNIT_TEST(testLogicalFormulaOr);
     481           2 :     CPPUNIT_TEST(testLogicalFormulaNot);
     482           2 :     CPPUNIT_TEST(testLogicalFormulaXor);
     483           2 :     CPPUNIT_TEST(testDatabaseFormulaDmax);
     484           2 :     CPPUNIT_TEST(testDatabaseFormulaDmin);
     485           2 :     CPPUNIT_TEST(testDatabaseFormulaDproduct);
     486           2 :     CPPUNIT_TEST(testDatabaseFormulaDaverage);
     487           2 :     CPPUNIT_TEST(testDatabaseFormulaDstdev);
     488           2 :     CPPUNIT_TEST(testDatabaseFormulaDstdevp);
     489           2 :     CPPUNIT_TEST(testDatabaseFormulaDsum);
     490           2 :     CPPUNIT_TEST(testDatabaseFormulaDvar);
     491           2 :     CPPUNIT_TEST(testDatabaseFormulaDvarp);
     492           2 :     CPPUNIT_TEST(testMathFormulaAverageIf);
     493           2 :     CPPUNIT_TEST(testDatabaseFormulaDcount);
     494           2 :     CPPUNIT_TEST(testDatabaseFormulaDcountA);
     495           2 :     CPPUNIT_TEST(testMathFormulaDegrees);
     496           2 :     CPPUNIT_TEST(testMathFormulaRoundUp);
     497           2 :     CPPUNIT_TEST(testMathFormulaRoundDown);
     498           2 :     CPPUNIT_TEST(testMathFormulaInt);
     499           2 :     CPPUNIT_TEST(testMathFormulaRadians);
     500           2 :     CPPUNIT_TEST(testMathFormulaCountIf);
     501           2 :     CPPUNIT_TEST(testMathFormulaIsEven);
     502           2 :     CPPUNIT_TEST(testMathFormulaIsOdd);
     503           2 :     CPPUNIT_TEST(testMathFormulaFact);
     504           2 :     CPPUNIT_TEST(testStatisticalFormulaMaxa);
     505           2 :     CPPUNIT_TEST(testStatisticalFormulaMina);
     506           2 :     CPPUNIT_TEST(testStatisticalFormulaCountA);
     507           2 :     CPPUNIT_TEST(testStatisticalFormulaAverageA);
     508           2 :     CPPUNIT_TEST(testStatisticalFormulaVarA);
     509           2 :     CPPUNIT_TEST(testStatisticalFormulaVarPA);
     510           2 :     CPPUNIT_TEST(testStatisticalFormulaStDevA);
     511           2 :     CPPUNIT_TEST(testStatisticalFormulaStDevPA);
     512           2 :     CPPUNIT_TEST(testMathFormulaSEC);
     513           2 :     CPPUNIT_TEST(testMathFormulaSECH);
     514           2 :     CPPUNIT_TEST(testMathFormulaMROUND);
     515           2 :     CPPUNIT_TEST(testMathFormulaQuotient);
     516           2 :     CPPUNIT_TEST(testMathFormulaSeriesSum);
     517           2 :     CPPUNIT_TEST(testMathFormulaSumIf);
     518           2 :     CPPUNIT_TEST(testAddInFormulaBesseLJ);
     519           2 :     CPPUNIT_TEST(testNegSub);
     520           2 :     CPPUNIT_TEST(testStatisticalFormulaAvedev);
     521           2 :     CPPUNIT_TEST(testMathFormulaAverageIf_Mix);
     522           2 :     CPPUNIT_TEST(testStatisticalFormulaKurt1);
     523           2 :     CPPUNIT_TEST(testStatisticalFormulaHarMean1);
     524           2 :     CPPUNIT_TEST(testStatisticalFormulaVarA1);
     525           2 :     CPPUNIT_TEST(testStatisticalFormulaVarPA1);
     526           2 :     CPPUNIT_TEST(testStatisticalFormulaStDevA1);
     527           2 :     CPPUNIT_TEST(testStatisticalFormulaStDevPA1);
     528           2 :     CPPUNIT_TEST(testFinancialMDurationFormula1);
     529           4 :     CPPUNIT_TEST_SUITE_END();
     530             : 
     531             : private:
     532             :     uno::Reference<uno::XInterface> m_xCalcComponent;
     533             : };
     534             : 
     535           0 : bool ScOpenCLTest::load(const OUString &rFilter, const OUString &rURL,
     536             :     const OUString &rUserData, unsigned int nFilterFlags,
     537             :         unsigned int nClipboardID, unsigned int nFilterVersion)
     538             : {
     539             :     ScDocShellRef xDocShRef = ScBootstrapFixture::load(rURL, rFilter, rUserData,
     540           0 :         OUString(), nFilterFlags, nClipboardID, nFilterVersion );
     541           0 :     bool bLoaded = xDocShRef.Is();
     542             :     //reference counting of ScDocShellRef is very confused.
     543           0 :     if (bLoaded)
     544           0 :         xDocShRef->DoClose();
     545           0 :     return bLoaded;
     546             : }
     547             : 
     548         446 : bool ScOpenCLTest::detectOpenCLDevice()
     549             : {
     550         446 :     sc::FormulaGroupInterpreter::enableOpenCL(true);
     551         446 :     return sc::FormulaGroupInterpreter::switchOpenCLDevice(OUString(),true);
     552             : }
     553             : 
     554           0 : void ScOpenCLTest::enableOpenCL()
     555             : {
     556           0 :     sc::FormulaGroupInterpreter::enableOpenCL(true);
     557           0 : }
     558             : 
     559           2 : void ScOpenCLTest::testCompilerHorizontal()
     560             : {
     561           2 :     if (!detectOpenCLDevice())
     562           4 :         return;
     563             : 
     564           0 :     ScDocShellRef xDocSh = loadDoc("opencl/compiler/horizontal.", ODS);
     565           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     566           0 :     enableOpenCL();
     567           0 :     rDoc.CalcAll();
     568             : 
     569           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/compiler/horizontal.", ODS);
     570           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     571             :     // Check the results of formula cells in the shared formula range.
     572           0 :     for (SCROW i = 1; i < 5; ++i)
     573             :     {
     574           0 :         double fLibre = rDoc.GetValue(ScAddress(12, i, 0));
     575           0 :         double fExcel = rDocRes.GetValue(ScAddress(12, i, 0));
     576           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     577           0 :         fLibre = rDoc.GetValue(ScAddress(13, i, 0));
     578           0 :         fExcel = rDocRes.GetValue(ScAddress(13, i, 0));
     579           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     580           0 :         fLibre = rDoc.GetValue(ScAddress(14, i, 0));
     581           0 :         fExcel = rDocRes.GetValue(ScAddress(14, i, 0));
     582           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     583             :     }
     584           0 :     xDocSh->DoClose();
     585           0 :     xDocShRes->DoClose();
     586             : }
     587           2 : void ScOpenCLTest::testCompilerNested()
     588             : {
     589           2 :     if (!detectOpenCLDevice())
     590           4 :         return;
     591             : 
     592           0 :     ScDocShellRef xDocSh = loadDoc("opencl/compiler/nested.", ODS);
     593           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     594           0 :     enableOpenCL();
     595           0 :     rDoc.CalcAll();
     596             : 
     597           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/compiler/nested.", ODS);
     598           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     599             :     // Check the results of formula cells in the shared formula range.
     600           0 :     for (SCROW i = 1; i < 5; ++i)
     601             :     {
     602           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     603           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     604           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     605             :     }
     606           0 :     xDocSh->DoClose();
     607           0 :     xDocShRes->DoClose();
     608             : }
     609             : 
     610           2 : void ScOpenCLTest::testCompilerString()
     611             : {
     612           2 :     if (!detectOpenCLDevice())
     613           4 :         return;
     614             : 
     615           0 :     ScDocShellRef xDocSh = loadDoc("opencl/compiler/string.", ODS);
     616           0 :     CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
     617           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     618           0 :     enableOpenCL();
     619           0 :     rDoc.CalcAll();
     620             : 
     621           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/compiler/string.", ODS);
     622           0 :     CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
     623           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     624             :     // Check the results of formula cells in the shared formula range.
     625           0 :     for (SCROW i = 1; i < 5; ++i)
     626             :     {
     627           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     628           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     629           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     630             : 
     631           0 :         fLibre = rDoc.GetValue(ScAddress(3, i, 0));
     632           0 :         fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
     633           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     634             :     }
     635           0 :     xDocSh->DoClose();
     636           0 :     xDocShRes->DoClose();
     637             : }
     638             : 
     639           2 : void ScOpenCLTest::testCompilerInEq()
     640             : {
     641           2 :     if (!detectOpenCLDevice())
     642           4 :         return;
     643             : 
     644           0 :     ScDocShellRef xDocSh = loadDoc("opencl/compiler/ineq.", ODS);
     645           0 :     CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
     646           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     647           0 :     enableOpenCL();
     648           0 :     rDoc.CalcAll();
     649             : 
     650           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/compiler/ineq.", ODS);
     651           0 :     CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
     652           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     653             :     // Check the results of formula cells in the shared formula range.
     654           0 :     for (SCROW i = 1; i < 7; ++i)
     655             :     {
     656           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
     657           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
     658           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     659             :     }
     660           0 :     xDocSh->DoClose();
     661           0 :     xDocShRes->DoClose();
     662             : }
     663             : 
     664             : #if 0
     665             : void ScOpenCLTest::testSharedFormulaXLSStockHistory()
     666             : {
     667             :     if (!detectOpenCLDevice())
     668             :         return;
     669             : 
     670             :     ScDocShellRef xDocSh = loadDoc("stock-history.", XLS);
     671             :     ScDocument& rDoc = xDocSh->GetDocument();
     672             :     xDocSh->DoHardRecalc(true);
     673             : 
     674             :     ScDocShellRef xDocShRes = loadDoc("stock-history.", XLS);
     675             :     ScDocument& rDocRes = xDocShRes->GetDocument();
     676             :     // Check the results of formula cells in the shared formula range.
     677             :     for (SCROW i = 33; i < 44; ++i)
     678             :     {   // Cell H34:H44 in S&P 500 (tab 1)
     679             :         double fLibre = rDoc.GetValue(ScAddress(7, i, 1));
     680             :         double fExcel = rDocRes.GetValue(ScAddress(7, i, 1));
     681             :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
     682             :     }
     683             : 
     684             :     for (SCROW i = 33; i < 44; ++i)
     685             :     {   // Cell J34:J44 in S&P 500 (tab 1)
     686             :         double fLibre = rDoc.GetValue(ScAddress(9, i, 1));
     687             :         double fExcel = rDocRes.GetValue(ScAddress(9, i, 1));
     688             :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
     689             :     }
     690             : 
     691             :     xDocSh->DoClose();
     692             :     xDocShRes->DoClose();
     693             : }
     694             : 
     695             : void ScOpenCLTest::testSharedFormulaXLSGroundWater()
     696             : {
     697             :     if (!detectOpenCLDevice())
     698             :         return;
     699             : 
     700             :     ScDocShellRef xDocSh = loadDoc("ground-water-daily.", XLS);
     701             :     ScDocument& rDoc = xDocSh->GetDocument();
     702             :     xDocSh->DoHardRecalc(true);
     703             : 
     704             :     ScDocShellRef xDocShRes = loadDoc("ground-water-daily.", XLS);
     705             :     ScDocument& rDocRes = xDocShRes->GetDocument();
     706             :     // Check the results of formula cells in the shared formula range.
     707             :     for (SCROW i = 5; i <= 77; ++i)
     708             :     {
     709             :         double fLibre = rDoc.GetValue(ScAddress(11,i,1));
     710             :         double fExcel = rDocRes.GetValue(ScAddress(11,i,1));
     711             :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     712             :     }
     713             :     xDocSh->DoClose();
     714             :     xDocShRes->DoClose();
     715             : }
     716             : #endif
     717             : 
     718           2 : void ScOpenCLTest::testSharedFormulaXLS()
     719             : {
     720           2 :     if (!detectOpenCLDevice())
     721           4 :         return;
     722             : 
     723           0 :     ScDocShellRef xDocSh = loadDoc("sum_ex.", XLS);
     724           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     725           0 :     enableOpenCL();
     726           0 :     rDoc.CalcAll();
     727           0 :     ScDocShellRef xDocShRes = loadDoc("sum_ex.", XLS);
     728           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     729             :     // Check the results of formula cells in the shared formula range.
     730             :     // AMLOEXT-5
     731           0 :     for (SCROW i = 0; i < 5; ++i)
     732             :     {
     733           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     734           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     735           0 :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     736             :     }
     737             :     // AMLOEXT-6
     738           0 :     for (SCROW i = 6; i < 14; ++i)
     739             :     {
     740           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     741           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     742           0 :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     743             :     }
     744             : 
     745             :     // AMLOEXT-8
     746           0 :     for (SCROW i = 15; i < 18; ++i)
     747             :     {
     748           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     749           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     750           0 :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     751             :     }
     752             : 
     753             :     // AMLOEXT-10
     754           0 :     for (SCROW i = 19; i < 22; ++i)
     755             :     {
     756           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     757           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     758           0 :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     759             :     }
     760             : 
     761             :     // AMLOEXT-9
     762           0 :     for (SCROW i = 23; i < 25; ++i)
     763             :     {
     764           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     765             :         //double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     766             :         // There seems to be a bug in LibreOffice beta
     767           0 :         ASSERT_DOUBLES_EQUAL(/*fExcel*/ 60.0, fLibre);
     768             :     }
     769             : 
     770             :     // AMLOEXT-9
     771           0 :     for (SCROW i = 25; i < 27; ++i)
     772             :     {
     773           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     774           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     775           0 :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     776             :     }
     777             :     // AMLOEXT-11
     778           0 :     for (SCROW i = 28; i < 35; ++i)
     779             :     {
     780           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     781           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     782           0 :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     783             :     }
     784             :     // AMLOEXT-11; workaround for a Calc beta bug
     785           0 :     ASSERT_DOUBLES_EQUAL(25.0, rDoc.GetValue(ScAddress(2, 35, 0)));
     786           0 :     ASSERT_DOUBLES_EQUAL(24.0, rDoc.GetValue(ScAddress(2, 36, 0)));
     787             : 
     788             :     // AMLOEXT-12
     789           0 :     for (SCROW i = 38; i < 43; ++i)
     790             :     {
     791           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
     792           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
     793           0 :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     794             :     }
     795             : 
     796             :     // AMLOEXT-14
     797           0 :     for (SCROW i = 5; i < 10; ++i)
     798             :     {
     799           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 1));
     800           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 1));
     801           0 :         ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
     802             :     }
     803             : 
     804             :     // AMLOEXT-15, AMLOEXT-16, and AMLOEXT-17
     805           0 :     for (SCROW i = 5; i < 10; ++i)
     806             :     {
     807           0 :         for (SCCOL j = 6; j < 11; ++j)
     808             :         {
     809           0 :             double fLibre = rDoc.GetValue(ScAddress(j, i, 1));
     810           0 :             double fExcel = rDocRes.GetValue(ScAddress(j, i, 1));
     811           0 :             CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
     812           0 :                 fabs(fExcel*0.0001));
     813             :         }
     814             :     }
     815           0 :     xDocSh->DoClose();
     816           0 :     xDocShRes->DoClose();
     817             : }
     818             : //[AMLOEXT-76]
     819           2 : void ScOpenCLTest::testMathFormulaCos()
     820             : {
     821           2 :     if (!detectOpenCLDevice())
     822           4 :         return;
     823             : 
     824           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/cos.", XLS);
     825           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     826           0 :     enableOpenCL();
     827           0 :     rDoc.CalcAll();
     828           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/cos.", XLS);
     829           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     830           0 :     for (SCROW i = 0; i <= 15; ++i)
     831             :     {
     832           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
     833           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
     834           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     835             :     }
     836           0 :     xDocSh->DoClose();
     837           0 :     xDocShRes->DoClose();
     838             : }
     839             : //[AMLOEXT-116]
     840           2 : void ScOpenCLTest::testMathFormulaSinh()
     841             : {
     842           2 :     if (!detectOpenCLDevice())
     843           4 :         return;
     844             : 
     845           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sinh.", XLS);
     846           0 :     enableOpenCL();
     847           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     848           0 :     xDocSh->DoHardRecalc(true);
     849           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sinh.", XLS);
     850           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     851           0 :     for (SCROW i = 0; i <= 15; ++i)
     852             :     {
     853           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
     854           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
     855           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     856             :     }
     857           0 :     xDocSh->DoClose();
     858           0 :     xDocShRes->DoClose();
     859             : }
     860             : //[AMLOEXT-196]
     861           2 : void ScOpenCLTest::testMathFormulaPi()
     862             : {
     863           2 :     if (!detectOpenCLDevice())
     864           4 :         return;
     865             : 
     866           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/pi.", XLS);
     867           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     868           0 :     enableOpenCL();
     869           0 :     rDoc.CalcAll();
     870           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/pi.", XLS);
     871           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     872           0 :     for (SCROW i = 0; i <= 15; ++i)
     873             :     {
     874           0 :         double fLibre = rDoc.GetValue(ScAddress(0,i,0));
     875           0 :         double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
     876           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     877             :     }
     878           0 :     xDocSh->DoClose();
     879           0 :     xDocShRes->DoClose();
     880             : }
     881             : //[AMLOEXT-197]
     882           2 : void ScOpenCLTest::testMathFormulaRandom()
     883             : {
     884           2 :     if (!detectOpenCLDevice())
     885           4 :         return;
     886             : 
     887           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/random.", XLS);
     888           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     889           0 :     enableOpenCL();
     890           0 :     rDoc.CalcAll();
     891           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/random.", XLS);
     892           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     893           0 :     for (SCROW i = 0; i <= 15; ++i)
     894             :     {
     895           0 :         double fLibre = rDoc.GetValue(ScAddress(0,i,0));
     896           0 :         double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
     897             :         //because the random numbers will always change,so give the test "true"
     898             :         (void) fLibre;
     899             :         (void) fExcel;
     900           0 :         CPPUNIT_ASSERT(true);
     901             :     }
     902           0 :     xDocSh->DoClose();
     903           0 :     xDocShRes->DoClose();
     904             : }
     905           2 : void ScOpenCLTest::testFinacialFormula()
     906             : {
     907           2 :     if (!detectOpenCLDevice())
     908           4 :         return;
     909             : 
     910           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/general.", XLS);
     911           0 :     CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
     912           0 :     ScDocument& rDoc = xDocSh->GetDocument();
     913           0 :     enableOpenCL();
     914           0 :     rDoc.CalcAll();
     915           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/general.", XLS);
     916           0 :     CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
     917           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
     918             :     // Check the results of formula cells in the shared formula range.
     919           0 :     for (SCROW i = 1; i <= 10; ++i)
     920             :     {
     921           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
     922           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
     923           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     924             :     }
     925             :     // AMLOEXT-22
     926           0 :     for (SCROW i = 1; i <= 10; ++i)
     927             :     {
     928           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,1));
     929           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,1));
     930           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     931             :     }
     932             :         //[AMLOEXT-23]
     933           0 :     for (SCROW i = 1; i <= 10; ++i)
     934             :     {
     935           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,2));
     936           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,2));
     937           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     938             :     }
     939             :     //[AMLOEXT-24]
     940           0 :     for (SCROW i = 1; i <= 10; ++i)
     941             :     {
     942           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,3));
     943           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,3));
     944           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     945             :     }
     946             :     //[AMLOEXT-25]
     947           0 :     for (SCROW i = 0; i <= 9; ++i)
     948             :     {
     949           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,4));
     950           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,4));
     951           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     952             :     }
     953             :     //[AMLOEXT-26]
     954           0 :     for (SCROW i = 0; i <= 9; ++i)
     955             :     {
     956           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,5));
     957           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,5));
     958           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     959             :     }
     960             :         //[AMLOEXT-27]
     961           0 :         for (SCROW i = 0; i < 10; ++i)
     962             :     {
     963           0 :         double fLibre = rDoc.GetValue(ScAddress(5,i,6));
     964           0 :         double fExcel = rDocRes.GetValue(ScAddress(5,i,6));
     965           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     966             :     }
     967             :     //[AMLOEXT-28]
     968           0 :     for (SCROW i = 1; i <= 9; ++i)
     969             :     {
     970           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,7));
     971           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,7));
     972           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     973             :     }
     974             :     //[AMLOEXT-29]
     975           0 :     for (SCROW i = 1; i <= 10; ++i)
     976             :     {
     977           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,8));
     978           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,8));
     979           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     980             :     }
     981             :         //[AMLOEXT-30]
     982           0 :     for (SCROW i = 1; i <= 9; ++i)
     983             :     {
     984           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,9));
     985           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,9));
     986           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     987             :     }
     988             :     //[AMLOEXT-31]
     989           0 :     for (SCROW i = 1; i <= 10; ++i)
     990             :     {
     991           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,10));
     992           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,10));
     993           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
     994             :     }
     995             :     //[AMLOEXT-32]
     996           0 :     for (SCROW i = 1; i <= 10; ++i)
     997             :     {
     998           0 :         double fLibre = rDoc.GetValue(ScAddress(7,i,11));
     999           0 :         double fExcel = rDocRes.GetValue(ScAddress(7,i,11));
    1000           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1001             :     }
    1002             :     //[AMLOEXT-33]
    1003           0 :     for (SCROW i = 1; i <= 10; ++i)
    1004             :     {
    1005           0 :         double fLibre = rDoc.GetValue(ScAddress(5,i,12));
    1006           0 :         double fExcel = rDocRes.GetValue(ScAddress(5,i,12));
    1007           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1008             :     }
    1009             :     //[AMLOEXT-34]
    1010           0 :     for (SCROW i = 0; i <= 12; ++i)
    1011             :     {
    1012           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,13));
    1013           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,13));
    1014           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1015             :     }
    1016             :     //[AMLOEXT-35]
    1017           0 :     for (SCROW i = 1; i <= 10; ++i)
    1018             :     {
    1019           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,14));
    1020           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,14));
    1021           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1022             :     }
    1023             :     //[AMLOEXT-36]
    1024           0 :     for (SCROW i = 1; i <= 10; ++i)
    1025             :     {
    1026           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,15));
    1027           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,15));
    1028           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1029             :     }
    1030             :     //[AMLOEXT-37]
    1031           0 :     for (SCROW i = 1; i <= 10; ++i)
    1032             :     {
    1033           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,16));
    1034           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,16));
    1035           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1036             :     }
    1037             :     //[AMLOEXT-38]
    1038           0 :     for (SCROW i = 1; i <= 5; ++i)
    1039             :     {
    1040           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,17));
    1041           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,17));
    1042           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1043             :     }
    1044             :     //[AMLOEXT-39]
    1045           0 :     for (SCROW i = 0; i <= 10; ++i)
    1046             :     {
    1047           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,18));
    1048           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,18));
    1049           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1050             :     }
    1051             :     //[AMLOEXT-42]
    1052           0 :     for (SCROW i = 0; i <= 18; ++i)
    1053             :     {
    1054           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,19));
    1055           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,19));
    1056           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1057             :     }
    1058           0 :     xDocSh->DoClose();
    1059           0 :     xDocShRes->DoClose();
    1060             : }
    1061             : //[AMLOEXT-20]
    1062           2 : void ScOpenCLTest::testStatisticalFormulaCorrel()
    1063             : {
    1064           2 :     if (!detectOpenCLDevice())
    1065           4 :         return;
    1066             : 
    1067           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Correl.", ODS);
    1068           0 :     CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
    1069           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1070           0 :     enableOpenCL();
    1071           0 :     rDoc.CalcAll();
    1072             : 
    1073           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Correl.", ODS);
    1074           0 :     CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
    1075           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1076             :     // Check the results of formula cells in the shared formula range.
    1077           0 :     for (SCROW i = 1; i <= 20; ++i)
    1078             :     {
    1079           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    1080           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    1081           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1082             :     }
    1083           0 :     xDocSh->DoClose();
    1084           0 :     xDocShRes->DoClose();
    1085             : 
    1086             : }
    1087           2 : void ScOpenCLTest::testStatisticalFormulaFisher()
    1088             : {
    1089           2 :     if (!detectOpenCLDevice())
    1090           4 :         return;
    1091             : 
    1092           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Fisher.", XLS);
    1093           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1094           0 :     enableOpenCL();
    1095           0 :     rDoc.CalcAll();
    1096             : 
    1097           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Fisher.", XLS);
    1098           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1099             :     // Check the results of formula cells in the shared formula range.
    1100           0 :     for (SCROW i = 1; i <= 19; ++i)
    1101             :     {
    1102           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1103           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1104           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1105             :     }
    1106           0 :     xDocSh->DoClose();
    1107           0 :     xDocShRes->DoClose();
    1108             : }
    1109             : //[AMLOEXT-44]
    1110           2 : void ScOpenCLTest::testStatisticalFormulaFisherInv()
    1111             : {
    1112           2 :     if (!detectOpenCLDevice())
    1113           4 :         return;
    1114             : 
    1115           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/FisherInv.", XLS);
    1116           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1117           0 :     enableOpenCL();
    1118           0 :     rDoc.CalcAll();
    1119             : 
    1120           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/FisherInv.", XLS);
    1121           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1122             :     // Check the results of formula cells in the shared formula range.
    1123           0 :     for (SCROW i = 1; i <= 19; ++i)
    1124             :     {
    1125           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1126           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1127           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1128             :     }
    1129           0 :     xDocSh->DoClose();
    1130           0 :     xDocShRes->DoClose();
    1131             : }
    1132             : //[AMLOEXT-45]
    1133           2 : void ScOpenCLTest::testStatisticalFormulaGamma()
    1134             : {
    1135           2 :     if (!detectOpenCLDevice())
    1136           4 :         return;
    1137             : 
    1138           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Gamma.", XLS);
    1139           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1140           0 :     enableOpenCL();
    1141           0 :     rDoc.CalcAll();
    1142             : 
    1143           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Gamma.", XLS);
    1144           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1145             :     // Check the results of formula cells in the shared formula range.
    1146           0 :     for (SCROW i = 1; i <= 19; ++i)
    1147             :     {
    1148           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1149           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1150           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1151             :     }
    1152           0 :     xDocSh->DoClose();
    1153           0 :     xDocShRes->DoClose();
    1154             : }
    1155             : //[AMLOEXT-46]
    1156           2 : void ScOpenCLTest::testFinacialFvscheduleFormula()
    1157             : {
    1158           2 :     if (!detectOpenCLDevice())
    1159           4 :         return;
    1160           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Fvschedule.", XLS);
    1161           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1162           0 :     enableOpenCL();
    1163           0 :     rDoc.CalcAll();
    1164           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Fvschedule.", XLS);
    1165           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1166           0 :     for (SCROW i = 0; i <= 9; ++i)
    1167             :     {
    1168           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    1169           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    1170           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1171             :     }
    1172           0 :     xDocSh->DoClose();
    1173           0 :     xDocShRes->DoClose();
    1174             : }
    1175             : //[AMLOEXT-47]
    1176           2 : void ScOpenCLTest::testMathFormulaAbs()
    1177             : {
    1178           2 :     if (!detectOpenCLDevice())
    1179           4 :         return;
    1180           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/Abs.", ODS);
    1181           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1182           0 :     enableOpenCL();
    1183           0 :     rDoc.CalcAll();
    1184           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/Abs.", ODS);
    1185           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1186             : 
    1187             :     // Verify ABS Function
    1188           0 :     for (SCROW i = 1; i <= 1000; ++i)
    1189             :     {
    1190           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1191           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1192           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1193             :     }
    1194           0 :     xDocSh->DoClose();
    1195           0 :     xDocShRes->DoClose();
    1196             : }
    1197             : //[AMLOEXT-69]
    1198           2 : void ScOpenCLTest::testFinacialSYDFormula()
    1199             : {
    1200           2 :     if (!detectOpenCLDevice())
    1201           4 :         return;
    1202           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/SYD.", XLS);
    1203           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1204           0 :     enableOpenCL();
    1205           0 :     rDoc.CalcAll();
    1206           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/SYD.", XLS);
    1207           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1208           0 :     for (SCROW i = 0; i <= 9; ++i)
    1209             :     {
    1210           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    1211           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    1212           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1213             :     }
    1214           0 :     xDocSh->DoClose();
    1215           0 :     xDocShRes->DoClose();
    1216             : }
    1217             : 
    1218             : // this test has intermittent failures on OSX
    1219             : #if !defined MACOSX
    1220           2 : void ScOpenCLTest::testFinacialIRRFormula()
    1221             : {
    1222           2 :     if (!detectOpenCLDevice())
    1223           4 :         return;
    1224           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/IRR.", XLS);
    1225           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1226           0 :     enableOpenCL();
    1227           0 :     rDoc.CalcAll();
    1228           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/IRR.", XLS);
    1229           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1230           0 :     for (SCROW i = 0; i <= 6; ++i)
    1231             :     {
    1232           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    1233           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    1234           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1235             :     }
    1236           0 :     xDocSh->DoClose();
    1237           0 :     xDocShRes->DoClose();
    1238             : }
    1239             : #endif
    1240             : 
    1241             : //[AMLOEXT-49]
    1242           2 : void ScOpenCLTest::testStatisticalFormulaGammaLn()
    1243             : {
    1244           2 :     if (!detectOpenCLDevice())
    1245           4 :         return;
    1246           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaLn.", XLS);
    1247           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1248           0 :     enableOpenCL();
    1249           0 :     rDoc.CalcAll();
    1250             : 
    1251           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaLn.", XLS);
    1252           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1253             :     // Check the results of formula cells in the shared formula range.
    1254           0 :     for (SCROW i = 1; i <= 19; ++i)
    1255             :     {
    1256           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1257           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1258           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1259             :     }
    1260           0 :     xDocSh->DoClose();
    1261           0 :     xDocShRes->DoClose();
    1262             : }
    1263             : //[AMLOEXT-50]
    1264           2 : void ScOpenCLTest::testStatisticalFormulaGauss()
    1265             : {
    1266           2 :     if (!detectOpenCLDevice())
    1267           4 :         return;
    1268           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Gauss.", XLS);
    1269           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1270           0 :     enableOpenCL();
    1271           0 :     rDoc.CalcAll();
    1272           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Gauss.", XLS);
    1273           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1274             :     // Check the results of formula cells in the shared formula range.
    1275           0 :     for (SCROW i = 1; i <= 19; ++i)
    1276             :     {
    1277           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1278           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1279           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1280             :     }
    1281           0 :     xDocSh->DoClose();
    1282           0 :     xDocShRes->DoClose();
    1283             : }
    1284             : //[AMLOEXT-52]
    1285           2 : void ScOpenCLTest::testStatisticalFormulaGeoMean()
    1286             : {
    1287           2 :     if (!detectOpenCLDevice())
    1288           4 :         return;
    1289           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/GeoMean.", XLS);
    1290           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1291           0 :     enableOpenCL();
    1292           0 :     rDoc.CalcAll();
    1293             : 
    1294           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GeoMean.", XLS);
    1295           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1296             :     // Check the results of formula cells in the shared formula range.
    1297           0 :     for (SCROW i = 1; i <= 19; ++i)
    1298             :     {
    1299           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1300           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1301           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1302             :     }
    1303           0 :     xDocSh->DoClose();
    1304           0 :     xDocShRes->DoClose();
    1305             : }
    1306             : //[AMLOEXT-51]
    1307           2 : void ScOpenCLTest::testStatisticalFormulaHarMean()
    1308             : {
    1309           2 :     if (!detectOpenCLDevice())
    1310           4 :         return;
    1311           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/HarMean.", XLS);
    1312           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1313           0 :     enableOpenCL();
    1314           0 :     rDoc.CalcAll();
    1315             : 
    1316           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/HarMean.", XLS);
    1317           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1318             :     // Check the results of formula cells in the shared formula range.
    1319           0 :     for (SCROW i = 1; i <= 19; ++i)
    1320             :     {
    1321           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1322           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1323           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1324             :     }
    1325           0 :     xDocSh->DoClose();
    1326           0 :     xDocShRes->DoClose();
    1327             : }
    1328             : //[AMLOEXT-53]
    1329           2 : void ScOpenCLTest::testFinacialSLNFormula()
    1330             : {
    1331           2 :     if (!detectOpenCLDevice())
    1332           4 :         return;
    1333           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/SLN.", XLS);
    1334           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1335           0 :     enableOpenCL();
    1336           0 :     rDoc.CalcAll();
    1337           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/SLN.", XLS);
    1338           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1339           0 :     for (SCROW i = 0; i <= 9; ++i)
    1340             :     {
    1341           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    1342           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    1343           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1344             :     }
    1345           0 :     xDocSh->DoClose();
    1346           0 :     xDocShRes->DoClose();
    1347             : }
    1348             : 
    1349           2 : void ScOpenCLTest::testFinacialMIRRFormula()
    1350             : {
    1351           2 :     if (!detectOpenCLDevice())
    1352           4 :         return;
    1353           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/MIRR.", XLS);
    1354           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1355           0 :     enableOpenCL();
    1356           0 :     rDoc.CalcAll();
    1357           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/MIRR.", XLS);
    1358           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1359           0 :     for (SCROW i = 0; i <= 6; ++i)
    1360             :     {
    1361           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    1362           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    1363           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1364             :     }
    1365           0 :     xDocSh->DoClose();
    1366           0 :     xDocShRes->DoClose();
    1367             : }
    1368             : 
    1369             : // [AMLOEXT-55]
    1370           2 : void ScOpenCLTest::testFinancialCoupdaybsFormula()
    1371             : {
    1372           2 :     if (!detectOpenCLDevice())
    1373           4 :         return;
    1374           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdaybs.", XLS);
    1375           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1376           0 :     enableOpenCL();
    1377           0 :     rDoc.CalcAll();
    1378           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdaybs.", XLS);
    1379           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1380           0 :     for (SCROW i = 1; i <=10; ++i)
    1381             :     {
    1382           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    1383           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    1384           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1385             :     }
    1386           0 :     xDocSh->DoClose();
    1387           0 :     xDocShRes->DoClose();
    1388             : }
    1389             : //[AMLOEXT-56]
    1390           2 : void ScOpenCLTest::testFinacialDollardeFormula()
    1391             : {
    1392           2 :     if (!detectOpenCLDevice())
    1393           4 :         return;
    1394           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Dollarde.", XLS);
    1395           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1396           0 :     enableOpenCL();
    1397           0 :     rDoc.CalcAll();
    1398           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Dollarde.", XLS);
    1399           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1400           0 :     for (SCROW i = 0; i <= 9; ++i)
    1401             :     {
    1402           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    1403           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    1404           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1405             :     }
    1406           0 :     xDocSh->DoClose();
    1407           0 :     xDocShRes->DoClose();
    1408             : }
    1409             : //[AMLOEXT-70]
    1410           2 : void ScOpenCLTest::testFinancialCoupdaysFormula()
    1411             : {
    1412           2 :     if (!detectOpenCLDevice())
    1413           4 :         return;
    1414           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdays.", XLS);
    1415           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1416           0 :     enableOpenCL();
    1417           0 :     rDoc.CalcAll();
    1418           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdays.", XLS);
    1419           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1420           0 :     for (SCROW i = 1; i <=10; ++i)
    1421             :     {
    1422           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    1423           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    1424           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1425             :     }
    1426           0 :     xDocSh->DoClose();
    1427           0 :     xDocShRes->DoClose();
    1428             : }
    1429             : //[AMLOEXT-72]
    1430           2 : void ScOpenCLTest::testFinancialCoupdaysncFormula()
    1431             : {
    1432           2 :     if (!detectOpenCLDevice())
    1433           4 :         return;
    1434           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdaysnc.", XLS);
    1435           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1436           0 :     enableOpenCL();
    1437           0 :     rDoc.CalcAll();
    1438           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdaysnc.", XLS);
    1439           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1440           0 :     for (SCROW i = 1; i <=10; ++i)
    1441             :     {
    1442           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    1443           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    1444           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1445             :     }
    1446           0 :     xDocSh->DoClose();
    1447           0 :     xDocShRes->DoClose();
    1448             : }
    1449           2 : void ScOpenCLTest::testFinacialRateFormula()
    1450             : {
    1451           2 :     if (!detectOpenCLDevice())
    1452           4 :         return;
    1453           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/RATE.", XLS);
    1454           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1455           0 :     enableOpenCL();
    1456           0 :     rDoc.CalcAll();
    1457           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/RATE.", XLS);
    1458           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1459           0 :     for (SCROW i = 1; i <= 5; ++i)
    1460             :     {
    1461           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    1462           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    1463           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1464             :     }
    1465           0 :     xDocSh->DoClose();
    1466           0 :     xDocShRes->DoClose();
    1467             : }
    1468             : //[AMLOEXT-54]
    1469           2 : void ScOpenCLTest::testFinancialAccrintmFormula()
    1470             : {
    1471           2 :     if (!detectOpenCLDevice())
    1472           4 :         return;
    1473           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Accrintm.", XLS);
    1474           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1475           0 :     enableOpenCL();
    1476           0 :     rDoc.CalcAll();
    1477           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Accrintm.", XLS);
    1478           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1479           0 :     for (SCROW i = 1; i <= 10; ++i)
    1480             :     {
    1481           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    1482           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    1483           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1484             :     }
    1485           0 :     xDocSh->DoClose();
    1486           0 :     xDocShRes->DoClose();
    1487             : }
    1488             : //[AMLOEXT-74]
    1489           2 : void ScOpenCLTest::testFinancialCoupnumFormula()
    1490             : {
    1491           2 :    if (!detectOpenCLDevice())
    1492           4 :         return;
    1493           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupnum.", XLS);
    1494           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1495           0 :     enableOpenCL();
    1496           0 :     rDoc.CalcAll();
    1497           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupnum.", XLS);
    1498           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1499           0 :     for (SCROW i = 0; i <= 9; ++i)
    1500             :     {
    1501           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    1502           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    1503           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1504             :     }
    1505           0 :     xDocSh->DoClose();
    1506           0 :     xDocShRes->DoClose();
    1507             : }
    1508             : 
    1509             : //[AMLOEXT-57]
    1510           2 : void ScOpenCLTest::testStatisticalFormulaNegbinomdist()
    1511             : {
    1512           2 :     if (!detectOpenCLDevice())
    1513           4 :         return;
    1514           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Negbinomdist." ,XLS);
    1515           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1516           0 :     enableOpenCL();
    1517           0 :     rDoc.CalcAll();
    1518           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Negbinomdist." ,XLS);
    1519           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1520             :     // Check the results of formula cells in the shared formula range.
    1521           0 :     for (SCROW i = 0; i <= 9; ++i)
    1522             :     {
    1523           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    1524           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    1525           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1526             :     }
    1527           0 :     xDocSh->DoClose();
    1528           0 :     xDocShRes->DoClose();
    1529             : }
    1530             : //[AMLOEXT-58]
    1531           2 : void ScOpenCLTest::testMathFormulaSin()
    1532             : {
    1533           2 :     if (!detectOpenCLDevice())
    1534           4 :             return;
    1535           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sin.", XLS);
    1536           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1537           0 :     enableOpenCL();
    1538           0 :     rDoc.CalcAll();
    1539           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sin.", XLS);
    1540           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1541           0 :     for (SCROW i = 0; i <= 15; ++i)
    1542             :     {
    1543           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1544           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1545           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1546             :     }
    1547           0 :     xDocSh->DoClose();
    1548           0 :     xDocShRes->DoClose();
    1549             : }
    1550             : //[AMLOEXT-59]
    1551           2 : void ScOpenCLTest::testMathFormulaSumSQ()
    1552             : {
    1553           2 :     if (!detectOpenCLDevice())
    1554           4 :             return;
    1555           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sumsq.", XLS);
    1556           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1557           0 :     enableOpenCL();
    1558           0 :     rDoc.CalcAll();
    1559           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sumsq.", XLS);
    1560           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1561           0 :     for (SCROW i = 0; i < 20; ++i)
    1562             :     {
    1563           0 :         double fLibre = rDoc.GetValue(ScAddress(5,i,0));
    1564           0 :         double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
    1565           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1566             :     }
    1567           0 :     xDocSh->DoClose();
    1568           0 :     xDocShRes->DoClose();
    1569             : }
    1570             : //[AMLOEXT-60]
    1571           2 : void ScOpenCLTest::testMathFormulaTan()
    1572             : {
    1573           2 :     if (!detectOpenCLDevice())
    1574           4 :             return;
    1575           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/tan.", XLS);
    1576           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1577           0 :     enableOpenCL();
    1578           0 :     rDoc.CalcAll();
    1579           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/tan.", XLS);
    1580           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1581           0 :     for (SCROW i = 0; i <= 15; ++i)
    1582             :     {
    1583           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1584           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1585           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1586             :     }
    1587           0 :     xDocSh->DoClose();
    1588           0 :     xDocShRes->DoClose();
    1589             : }
    1590             : //[AMLOEXT-61]
    1591           2 : void ScOpenCLTest::testMathFormulaTanH()
    1592             : {
    1593           2 :     if (!detectOpenCLDevice())
    1594           4 :             return;
    1595           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/tanh.", XLS);
    1596           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1597           0 :     enableOpenCL();
    1598           0 :     rDoc.CalcAll();
    1599           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/tanh.", XLS);
    1600           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1601           0 :     for (SCROW i = 0; i <= 15; ++i)
    1602             :     {
    1603           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1604           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1605           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1606             :     }
    1607           0 :     xDocSh->DoClose();
    1608           0 :     xDocShRes->DoClose();
    1609             : }
    1610             : //[AMLOEXT-62]
    1611           2 : void ScOpenCLTest::testMathFormulaSqrt()
    1612             : {
    1613           2 :     if (!detectOpenCLDevice())
    1614           4 :             return;
    1615           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sqrt.", XLS);
    1616           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1617           0 :     enableOpenCL();
    1618           0 :     rDoc.CalcAll();
    1619           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sqrt.", XLS);
    1620           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1621           0 :     for (SCROW i = 0; i <= 15; ++i)
    1622             :     {
    1623           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1624           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1625           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1626             :     }
    1627           0 :     xDocSh->DoClose();
    1628           0 :     xDocShRes->DoClose();
    1629             : }
    1630             : //[AMLOEXT-63]
    1631           2 : void ScOpenCLTest::testFinacialPriceFormula()
    1632             : {
    1633           2 :     if (!detectOpenCLDevice())
    1634           4 :         return;
    1635           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Price.", XLS);
    1636           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1637           0 :     enableOpenCL();
    1638           0 :     rDoc.CalcAll();
    1639           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Price.", XLS);
    1640           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1641           0 :     for (SCROW i = 1; i <= 10; ++i)
    1642             :     {
    1643           0 :         double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
    1644           0 :         double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
    1645           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1646             :     }
    1647           0 :     xDocSh->DoClose();
    1648           0 :     xDocShRes->DoClose();
    1649             : }
    1650             : //[AMLOEXT-64]
    1651           2 : void ScOpenCLTest::testFinacialDollarfrFormula()
    1652             : {
    1653           2 :     if (!detectOpenCLDevice())
    1654           4 :         return;
    1655           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Dollarfr.", XLS);
    1656           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1657           0 :     enableOpenCL();
    1658           0 :     rDoc.CalcAll();
    1659           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Dollarfr.", XLS);
    1660           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1661           0 :     for (SCROW i = 0; i <= 9; ++i)
    1662             :     {
    1663           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    1664           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    1665           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1666             :     }
    1667           0 :     xDocSh->DoClose();
    1668           0 :     xDocShRes->DoClose();
    1669             : }
    1670             : //[AMLOEXT-65]
    1671           2 : void ScOpenCLTest::testFinacialPriceDiscFormula()
    1672             : {
    1673           2 :     if (!detectOpenCLDevice())
    1674           4 :         return;
    1675           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/PriceDisc.", XLS);
    1676           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1677           0 :     enableOpenCL();
    1678           0 :     rDoc.CalcAll();
    1679           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/PriceDisc.", XLS);
    1680           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1681           0 :     for (SCROW i = 0; i <= 10; ++i)
    1682             :     {
    1683           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    1684           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    1685           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1686             :     }
    1687           0 :     xDocSh->DoClose();
    1688           0 :     xDocShRes->DoClose();
    1689             : }
    1690             : //[AMLOEXT-67]
    1691           2 : void ScOpenCLTest::testFinacialODDLPRICEFormula()
    1692             : {
    1693           2 :     if (!detectOpenCLDevice())
    1694           4 :         return;
    1695           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Oddlprice.", XLS);
    1696           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1697           0 :     enableOpenCL();
    1698           0 :     rDoc.CalcAll();
    1699           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Oddlprice.", XLS);
    1700           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1701           0 :     for (SCROW i = 1; i <= 10; ++i)
    1702             :     {
    1703           0 :         double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
    1704           0 :         double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
    1705           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1706             :     }
    1707           0 :     xDocSh->DoClose();
    1708           0 :     xDocShRes->DoClose();
    1709             : }
    1710             : //[AMLOEXT-68]
    1711           2 : void ScOpenCLTest:: testFinacialOddlyieldFormula()
    1712             : {
    1713           2 :     if (!detectOpenCLDevice())
    1714           4 :         return;
    1715           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Oddlyield.", XLS);
    1716           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1717           0 :     enableOpenCL();
    1718           0 :     rDoc.CalcAll();
    1719           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Oddlyield.", XLS);
    1720           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1721           0 :     for (SCROW i = 0; i <= 6; ++i)
    1722             :     {
    1723           0 :         double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
    1724           0 :         double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
    1725           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1726             :     }
    1727           0 :     xDocSh->DoClose();
    1728           0 :     xDocShRes->DoClose();
    1729             : }
    1730             : //[AMLOEXT-71]
    1731           2 : void ScOpenCLTest::testFinacialDISCFormula()
    1732             : {
    1733           2 :     if (!detectOpenCLDevice())
    1734           4 :         return;
    1735           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/DISC.", XLS);
    1736           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1737           0 :     enableOpenCL();
    1738           0 :     rDoc.CalcAll();
    1739           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/DISC.", XLS);
    1740           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1741           0 :     for (SCROW i = 0; i <= 9; ++i)
    1742             :     {
    1743           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    1744           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    1745           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1746             :     }
    1747           0 :     xDocSh->DoClose();
    1748           0 :     xDocShRes->DoClose();
    1749             : }
    1750             : //[AMLOEXT-73]
    1751           2 : void ScOpenCLTest:: testFinacialPVFormula()
    1752             : {
    1753           2 :     if (!detectOpenCLDevice())
    1754           4 :         return;
    1755           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/PV.", XLS);
    1756           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1757           0 :     enableOpenCL();
    1758           0 :     rDoc.CalcAll();
    1759           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/PV.", XLS);
    1760           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1761           0 :     for (SCROW i = 0; i <= 9; ++i)
    1762             :     {
    1763           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    1764           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    1765           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1766             :     }
    1767           0 :     xDocSh->DoClose();
    1768           0 :     xDocShRes->DoClose();
    1769             : }
    1770             : //[AMLOEXT-75]
    1771           2 : void ScOpenCLTest::testFinacialINTRATEFormula()
    1772             : {
    1773           2 :     if (!detectOpenCLDevice())
    1774           4 :         return;
    1775           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/INTRATE.", XLS);
    1776           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1777           0 :     enableOpenCL();
    1778           0 :     rDoc.CalcAll();
    1779           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/INTRATE.", XLS);
    1780           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1781           0 :     for (SCROW i = 0; i <= 9; ++i)
    1782             :     {
    1783           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    1784           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    1785           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1786             :     }
    1787           0 :     xDocSh->DoClose();
    1788           0 :     xDocShRes->DoClose();
    1789             : }
    1790             : //[AMLOEXT-77]
    1791           2 : void ScOpenCLTest::testStatisticalFormulaStandard()
    1792             : {
    1793           2 :     if (!detectOpenCLDevice())
    1794           4 :         return;
    1795             : 
    1796           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Standard.", XLS);
    1797           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1798           0 :     enableOpenCL();
    1799           0 :     rDoc.CalcAll();
    1800             : 
    1801           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Standard.", XLS);
    1802           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1803             :     // Check the results of formula cells in the shared formula range.
    1804           0 :     for (SCROW i = 1; i <= 20; ++i)
    1805             :     {
    1806           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    1807           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    1808           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1809             :     }
    1810           0 :     xDocSh->DoClose();
    1811           0 :     xDocShRes->DoClose();
    1812             : }
    1813             : //[AMLOEXT-78]
    1814           2 : void ScOpenCLTest::testStatisticalFormulaWeibull()
    1815             : {
    1816           2 :     if (!detectOpenCLDevice())
    1817           4 :         return;
    1818             : 
    1819           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Weibull.", XLS);
    1820           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1821           0 :     enableOpenCL();
    1822           0 :     rDoc.CalcAll();
    1823             : 
    1824           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Weibull.", XLS);
    1825           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1826             :     // Check the results of formula cells in the shared formula range.
    1827           0 :     for (SCROW i = 1; i <= 20; ++i)
    1828             :     {
    1829           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    1830           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    1831           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
    1832           0 :             fExcel == 0?1e-4:fabs(1e-4*fExcel));
    1833             :     }
    1834           0 :     xDocSh->DoClose();
    1835           0 :     xDocShRes->DoClose();
    1836             : }
    1837             : //[AMLOEXT-79]
    1838           2 : void ScOpenCLTest::testStatisticalFormulaVar()
    1839             : {
    1840           2 :     if (!detectOpenCLDevice())
    1841           4 :         return;
    1842             : 
    1843           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Var.", XLS);
    1844           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1845           0 :     enableOpenCL();
    1846           0 :     rDoc.CalcAll();
    1847             : 
    1848           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Var.", XLS);
    1849           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1850             :     // Check the results of formula cells in the shared formula range.
    1851           0 :     for (SCROW i = 1; i <= 20; ++i)
    1852             :     {
    1853           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1854           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1855           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1856             :     }
    1857           0 :     xDocSh->DoClose();
    1858           0 :     xDocShRes->DoClose();
    1859             : }
    1860             : //[AMLOEXT-80]
    1861           2 : void ScOpenCLTest::testStatisticalFormulaSkew()
    1862             : {
    1863           2 :     if (!detectOpenCLDevice())
    1864           4 :         return;
    1865             : 
    1866           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Skew.", XLS);
    1867           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1868           0 :     enableOpenCL();
    1869           0 :     rDoc.CalcAll();
    1870             : 
    1871           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Skew.", XLS);
    1872           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1873             :     // Check the results of formula cells in the shared formula range.
    1874           0 :     for (SCROW i = 1; i <= 20; ++i)
    1875             :     {
    1876           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1877           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1878           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1879             :     }
    1880           0 :     xDocSh->DoClose();
    1881           0 :     xDocShRes->DoClose();
    1882             : }
    1883             : //[AMLOEXT-81]
    1884           2 : void ScOpenCLTest::testStatisticalFormulaSkewp()
    1885             : {
    1886           2 :     if (!detectOpenCLDevice())
    1887           4 :         return;
    1888             : 
    1889           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Skewp.", XLS);
    1890           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1891           0 :     enableOpenCL();
    1892           0 :     rDoc.CalcAll();
    1893             : 
    1894           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Skewp.", XLS);
    1895           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1896             :     // Check the results of formula cells in the shared formula range.
    1897           0 :     for (SCROW i = 1; i <= 20; ++i)
    1898             :     {
    1899           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1900           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1901           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1902             :     }
    1903           0 :     xDocSh->DoClose();
    1904           0 :     xDocShRes->DoClose();
    1905             : }
    1906             : //[AMLOEXT-82]
    1907           2 : void ScOpenCLTest::testStatisticalFormulaPearson()
    1908             : {
    1909           2 :     if (!detectOpenCLDevice())
    1910           4 :         return;
    1911           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Pearson.", XLS);
    1912           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1913           0 :     enableOpenCL();
    1914           0 :     rDoc.CalcAll();
    1915           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Pearson.", XLS);
    1916           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1917             :     // Check the results of formula cells in the shared formula range.
    1918           0 :     for (SCROW i = 1; i <= 9; ++i)
    1919             :     {
    1920           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    1921           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    1922           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1923             :     }
    1924           0 :     xDocSh->DoClose();
    1925           0 :     xDocShRes->DoClose();
    1926             : }
    1927             : //[AMLOEXT-83]
    1928           2 : void ScOpenCLTest::testStatisticalFormulaRsq()
    1929             : {
    1930           2 :     if (!detectOpenCLDevice())
    1931           4 :         return;
    1932           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Rsq.", XLS);
    1933           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1934           0 :     enableOpenCL();
    1935           0 :     rDoc.CalcAll();
    1936           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Rsq.", XLS);
    1937           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1938             :     // Check the results of formula cells in the shared formula range.
    1939           0 :     for (SCROW i = 1; i <= 9; ++i)
    1940             :     {
    1941           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    1942           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    1943           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1944             :     }
    1945           0 :     xDocSh->DoClose();
    1946           0 :     xDocShRes->DoClose();
    1947             : }
    1948             : //[AMLOEXT-84]
    1949           2 : void ScOpenCLTest::testMathFormulaTrunc()
    1950             : {
    1951           2 :     if (!detectOpenCLDevice())
    1952           4 :             return;
    1953           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/trunc.", XLS);
    1954           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1955           0 :     enableOpenCL();
    1956           0 :     rDoc.CalcAll();
    1957           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/trunc.", XLS);
    1958           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1959           0 :     for (SCROW i = 0; i <= 15; ++i)
    1960             :     {
    1961           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    1962           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    1963           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1964             :     }
    1965           0 :     xDocSh->DoClose();
    1966           0 :     xDocShRes->DoClose();
    1967             : }
    1968             : //[AMLOEXT-85]
    1969           2 : void ScOpenCLTest::testMathFormulaCosh()
    1970             : {
    1971           2 :     if (!detectOpenCLDevice())
    1972           4 :         return;
    1973             : 
    1974           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/cosh.", XLS);
    1975           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1976           0 :     enableOpenCL();
    1977           0 :     rDoc.CalcAll();
    1978           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/cosh.", XLS);
    1979           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    1980           0 :     for (SCROW i = 0; i <= 15; ++i)
    1981             :     {
    1982           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    1983           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    1984           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    1985             :     }
    1986           0 :     xDocSh->DoClose();
    1987           0 :     xDocShRes->DoClose();
    1988             : }
    1989           2 : void ScOpenCLTest::testStatisticalFormulaCovar()
    1990             : {
    1991           2 :     if (!detectOpenCLDevice())
    1992           4 :         return;
    1993             : 
    1994           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Covar.", XLS);
    1995           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    1996           0 :     enableOpenCL();
    1997           0 :     rDoc.CalcAll();
    1998             : 
    1999           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Covar.", XLS);
    2000           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2001             :     // Check the results of formula cells in the shared formula range.
    2002           0 :     for (SCROW i = 0; i <= 16; ++i)
    2003             :     {
    2004           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    2005           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    2006           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2007             :     }
    2008           0 :     xDocSh->DoClose();
    2009           0 :     xDocShRes->DoClose();
    2010             : }
    2011             : 
    2012             : //[AMLOEXT-87]
    2013           2 : void ScOpenCLTest::testStatisticalFormulaKurt()
    2014             : {
    2015           2 :     if (!detectOpenCLDevice())
    2016           4 :         return;
    2017           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Kurt.", XLS);
    2018           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2019           0 :     enableOpenCL();
    2020           0 :     rDoc.CalcAll();
    2021           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Kurt.", XLS);
    2022           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2023             :     // Check the results of formula cells in the shared formula range.
    2024           0 :     for (SCROW i = 1; i <= 19; ++i)
    2025             :     {
    2026           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2027           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2028           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2029             :     }
    2030           0 :     xDocSh->DoClose();
    2031           0 :     xDocShRes->DoClose();
    2032             : }
    2033             : //[AMLOEXT-88]
    2034           2 : void ScOpenCLTest::testMathFormulaCot()
    2035             : {
    2036           2 :     if (!detectOpenCLDevice())
    2037           4 :         return;
    2038             : 
    2039           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/cot.", ODS);
    2040           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2041           0 :     enableOpenCL();
    2042           0 :     rDoc.CalcAll();
    2043           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/cot.", ODS);
    2044           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2045           0 :     for (SCROW i = 0; i <= 15; ++i)
    2046             :     {
    2047           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2048           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2049           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2050             :     }
    2051           0 :     xDocSh->DoClose();
    2052           0 :     xDocShRes->DoClose();
    2053             : }
    2054             : //[AMLOEXT-89]
    2055           2 : void ScOpenCLTest::testStatisticalFormulaDevSq()
    2056             : {
    2057           2 :     if (!detectOpenCLDevice())
    2058           4 :         return;
    2059             : 
    2060           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/DevSq.", XLS);
    2061           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2062           0 :     enableOpenCL();
    2063           0 :     rDoc.CalcAll();
    2064             : 
    2065           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/DevSq.", XLS);
    2066           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2067             :     // Check the results of formula cells in the shared formula range.
    2068           0 :     for (SCROW i = 0; i <= 11; ++i)
    2069             :     {
    2070           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2071           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2072           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2073             :     }
    2074           0 :     xDocSh->DoClose();
    2075           0 :     xDocShRes->DoClose();
    2076             : }
    2077             : //[AMLOEXT-90]
    2078           2 : void ScOpenCLTest::testMathFormulaCsc()
    2079             : {
    2080           2 :     if (!detectOpenCLDevice())
    2081           4 :         return;
    2082           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/csc.", ODS);
    2083           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2084           0 :     enableOpenCL();
    2085           0 :     rDoc.CalcAll();
    2086           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/csc.", ODS);
    2087           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2088           0 :     for (SCROW i = 0; i <= 15; ++i)
    2089             :     {
    2090           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2091           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2092           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2093             :     }
    2094           0 :     xDocSh->DoClose();
    2095           0 :     xDocShRes->DoClose();
    2096             : }
    2097             : //[AMLOEXT-91]
    2098           2 : void ScOpenCLTest::testMathFormulaCoth()
    2099             : {
    2100           2 :     if (!detectOpenCLDevice())
    2101           4 :         return;
    2102             : 
    2103           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/coth.", ODS);
    2104           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2105           0 :     enableOpenCL();
    2106           0 :     rDoc.CalcAll();
    2107           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/coth.", ODS);
    2108           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2109           0 :     for (SCROW i = 0; i <= 15; ++i)
    2110             :     {
    2111           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2112           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2113           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2114             :     }
    2115           0 :     xDocSh->DoClose();
    2116           0 :     xDocShRes->DoClose();
    2117             : }
    2118             : //[AMLOEXT-92]
    2119           2 : void ScOpenCLTest::testFinacialXNPVFormula()
    2120             : {
    2121           2 :     if (!detectOpenCLDevice())
    2122           4 :         return;
    2123           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/XNPV.", XLS);
    2124           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2125           0 :     enableOpenCL();
    2126           0 :     rDoc.CalcAll();
    2127           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/XNPV.", XLS);
    2128           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2129           0 :     for (SCROW i = 1; i <= 9; ++i)
    2130             :     {
    2131           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    2132           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    2133           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2134             :     }
    2135             : 
    2136           0 :      for (SCROW i = 16; i <= 26; ++i)
    2137             :     {
    2138           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    2139           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    2140           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2141             :     }
    2142           0 :     xDocSh->DoClose();
    2143           0 :     xDocShRes->DoClose();
    2144             : }
    2145             : //[AMLOEXT-93]
    2146           2 : void ScOpenCLTest::testStatisticalFormulaIntercept()
    2147             : {
    2148           2 :     if (!detectOpenCLDevice())
    2149           4 :         return;
    2150             : 
    2151           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Intercept.", XLS);
    2152           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2153           0 :     enableOpenCL();
    2154           0 :     rDoc.CalcAll();
    2155           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Intercept.", XLS);
    2156           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2157           0 :     for (SCROW i = 1; i <= 19; ++i)
    2158             :     {
    2159           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    2160           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    2161           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2162             :     }
    2163           0 :     xDocSh->DoClose();
    2164           0 :     xDocShRes->DoClose();
    2165             : }
    2166             : //[AMLOEXT-98]
    2167           2 : void ScOpenCLTest::testFinancialAmordegrcFormula()
    2168             : {
    2169           2 :    if (!detectOpenCLDevice())
    2170           4 :         return;
    2171           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Amordegrc.", XLS);
    2172           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2173           0 :     enableOpenCL();
    2174           0 :     rDoc.CalcAll();
    2175           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Amordegrc.", XLS);
    2176           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2177           0 :     for (SCROW i = 0; i <= 9; ++i)
    2178             :     {
    2179           0 :         double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
    2180           0 :         double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
    2181           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2182             :     }
    2183           0 :     xDocSh->DoClose();
    2184           0 :     xDocShRes->DoClose();
    2185             : }
    2186             : //[AMLOEXT-99]
    2187           2 : void ScOpenCLTest:: testFinancialISPMTFormula()
    2188             : {
    2189           2 :     if (!detectOpenCLDevice())
    2190           4 :         return;
    2191           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/ISPMT.", XLS);
    2192           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2193           0 :     enableOpenCL();
    2194           0 :     rDoc.CalcAll();
    2195           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/ISPMT.", XLS);
    2196           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2197           0 :     for (SCROW i = 0; i <= 9; ++i)
    2198             :     {
    2199           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    2200           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    2201           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2202             :     }
    2203           0 :     xDocSh->DoClose();
    2204           0 :     xDocShRes->DoClose();
    2205             : }
    2206             : //[AMLOEXT-100]
    2207           2 : void ScOpenCLTest::testStatisticalFormulaMedian()
    2208             : {
    2209           2 :     if (!detectOpenCLDevice())
    2210           4 :         return;
    2211           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Median.",XLS);
    2212           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2213           0 :     enableOpenCL();
    2214           0 :     rDoc.CalcAll();
    2215           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Median.",XLS);
    2216           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2217             :     // Check the results of formula cells in the shared formula range.
    2218           0 :     for (SCROW i = 1; i <= 9; ++i)
    2219             :     {
    2220           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2221           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2222           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2223             :     }
    2224           0 :     xDocSh->DoClose();
    2225           0 :     xDocShRes->DoClose();
    2226             : }
    2227             : //[AMLOEXT-101]
    2228           2 : void ScOpenCLTest::testStatisticalFormulaNormdist()
    2229             : {
    2230           2 :     if (!detectOpenCLDevice())
    2231           4 :         return;
    2232           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normdist.",XLS);
    2233           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2234           0 :     enableOpenCL();
    2235           0 :     rDoc.CalcAll();
    2236           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normdist.",XLS);
    2237           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2238             :     // Check the results of formula cells in the shared formula range.
    2239           0 :     for (SCROW i = 1; i <= 19; ++i)
    2240             :     {
    2241           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    2242           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    2243           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2244             :     }
    2245           0 :     xDocSh->DoClose();
    2246           0 :     xDocShRes->DoClose();
    2247             : }
    2248             : //[AMLOEXT-102]
    2249           2 : void ScOpenCLTest::testStatisticalFormulaNormsdist()
    2250             : {
    2251           2 :     if (!detectOpenCLDevice())
    2252           4 :         return;
    2253           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normsdist.",XLS);
    2254           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2255           0 :     enableOpenCL();
    2256           0 :     rDoc.CalcAll();
    2257           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normsdist.",XLS);
    2258           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2259             :     // Check the results of formula cells in the shared formula range.
    2260           0 :     for (SCROW i = 1; i <= 19; ++i)
    2261             :     {
    2262           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2263           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2264           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2265             :     }
    2266           0 :     xDocSh->DoClose();
    2267           0 :     xDocShRes->DoClose();
    2268             : }
    2269             : //[AMLOEXT-103]
    2270           2 : void ScOpenCLTest::testStatisticalFormulaPermut()
    2271             : {
    2272           2 :     if (!detectOpenCLDevice())
    2273           4 :         return;
    2274           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Permut.",XLS);
    2275           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2276           0 :     enableOpenCL();
    2277           0 :     rDoc.CalcAll();
    2278           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Permut.",XLS);
    2279           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2280             :     // Check the results of formula cells in the shared formula range.
    2281           0 :     for (SCROW i = 1; i <= 19; ++i)
    2282             :     {
    2283           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    2284           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    2285           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2286             :     }
    2287           0 :     xDocSh->DoClose();
    2288           0 :     xDocShRes->DoClose();
    2289             : }
    2290             : //[AMLOEXT-104]
    2291           2 : void ScOpenCLTest::testStatisticalFormulaPermutation()
    2292             : {
    2293           2 :     if (!detectOpenCLDevice())
    2294           4 :         return;
    2295           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Permutation.",XLS);
    2296           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2297           0 :     enableOpenCL();
    2298           0 :     rDoc.CalcAll();
    2299           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Permutation.",XLS);
    2300           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2301             :     // Check the results of formula cells in the shared formula range.
    2302           0 :     for (SCROW i = 1; i <= 9; ++i)
    2303             :     {
    2304           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    2305           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    2306           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2307             :     }
    2308           0 :     xDocSh->DoClose();
    2309           0 :     xDocShRes->DoClose();
    2310             : }
    2311             : //[AMLOEXT-105]
    2312           2 : void ScOpenCLTest::testStatisticalFormulaPhi()
    2313             : {
    2314           2 :     if (!detectOpenCLDevice())
    2315           4 :         return;
    2316           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Phi.",XLS);
    2317           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2318           0 :     enableOpenCL();
    2319           0 :     rDoc.CalcAll();
    2320           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Phi.",XLS);
    2321           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2322             :     // Check the results of formula cells in the shared formula range.
    2323           0 :     for (SCROW i = 1; i <= 19; ++i)
    2324             :     {
    2325           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2326           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2327           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2328             :     }
    2329           0 :     xDocSh->DoClose();
    2330           0 :     xDocShRes->DoClose();
    2331             : }
    2332             : //[AMLOEXT-106]
    2333           2 : void ScOpenCLTest::testMathFormulaCscH()
    2334             : {
    2335           2 :     if (!detectOpenCLDevice())
    2336           4 :         return;
    2337           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/csch.", ODS);
    2338           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2339           0 :     enableOpenCL();
    2340           0 :     rDoc.CalcAll();
    2341           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/csch.", ODS);
    2342           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2343           0 :     for (SCROW i = 0; i <= 15; ++i)
    2344             :     {
    2345           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2346           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2347           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2348             :     }
    2349           0 :     xDocSh->DoClose();
    2350           0 :     xDocShRes->DoClose();
    2351             : }
    2352             : //[AMLOEXT-107]
    2353           2 : void ScOpenCLTest::testStatisticalFormulaLogInv()
    2354             : {
    2355           2 :     if (!detectOpenCLDevice())
    2356           4 :         return;
    2357             : 
    2358           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/LogInv.", XLS);
    2359           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2360           0 :     enableOpenCL();
    2361           0 :     rDoc.CalcAll();
    2362           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/LogInv.", XLS);
    2363           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2364             :     // Check the results of formula cells in the shared formula range.
    2365           0 :     for (SCROW i = 1; i <= 19; ++i)
    2366             :     {
    2367           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    2368           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    2369           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2370             :     }
    2371           0 :     xDocSh->DoClose();
    2372           0 :     xDocShRes->DoClose();
    2373             : }
    2374             : //[AMLOEXT-108]
    2375           2 : void ScOpenCLTest::testFinacialNPERFormula()
    2376             : {
    2377           2 :     if (!detectOpenCLDevice())
    2378           4 :         return;
    2379           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/NPER.", XLS);
    2380           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2381           0 :     enableOpenCL();
    2382           0 :     rDoc.CalcAll();
    2383           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPER.", XLS);
    2384           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2385           0 :     for (SCROW i = 0; i <= 10; ++i)
    2386             :     {
    2387           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    2388           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    2389           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2390             :     }
    2391           0 :     xDocSh->DoClose();
    2392           0 :     xDocShRes->DoClose();
    2393             : }
    2394             : //[AMLOEXT-109]
    2395           2 : void ScOpenCLTest::testStatisticalFormulaForecast()
    2396             : {
    2397           2 :     if (!detectOpenCLDevice())
    2398           4 :         return;
    2399             : 
    2400           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Forecast.", XLS);
    2401           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2402           0 :     enableOpenCL();
    2403           0 :     rDoc.CalcAll();
    2404           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Forecast.", XLS);
    2405           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2406             :     // Check the results of formula cells in the shared formula range.
    2407           0 :     for (SCROW i = 1; i <= 19; ++i)
    2408             :     {
    2409           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    2410           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    2411           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2412             :     }
    2413           0 :     xDocSh->DoClose();
    2414           0 :     xDocShRes->DoClose();
    2415             : }
    2416             : //[AMLOEXT-110]
    2417           2 : void ScOpenCLTest::testFinancialAmorlincFormula()
    2418             : {
    2419           2 :     if (!detectOpenCLDevice())
    2420           4 :         return;
    2421           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Amorlinc.", XLS);
    2422           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2423           0 :     enableOpenCL();
    2424           0 :     rDoc.CalcAll();
    2425           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Amorlinc.", XLS);
    2426           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2427           0 :     for (SCROW i = 0; i <= 9; ++i)
    2428             :     {
    2429           0 :         double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
    2430           0 :         double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
    2431           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2432             :     }
    2433           0 :     xDocSh->DoClose();
    2434           0 :     xDocShRes->DoClose();
    2435             : }
    2436             : //[AMLOEXT-124]
    2437           2 : void ScOpenCLTest::testFinancialDDBFormula()
    2438             : {
    2439           2 :    if (!detectOpenCLDevice())
    2440           4 :         return;
    2441           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/ddb.", XLS);
    2442           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2443           0 :     enableOpenCL();
    2444           0 :     rDoc.CalcAll();
    2445           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/ddb.", XLS);
    2446           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2447           0 :     for (SCROW i = 0; i <= 9; ++i)
    2448             :     {
    2449           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    2450           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    2451           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2452             :     }
    2453           0 :     xDocSh->DoClose();
    2454           0 :     xDocShRes->DoClose();
    2455             : }
    2456           2 : void ScOpenCLTest::testFinacialPriceMatFormula()
    2457             : {
    2458           2 :     if (!detectOpenCLDevice())
    2459           4 :         return;
    2460           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/PriceMat.", XLS);
    2461           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2462           0 :     enableOpenCL();
    2463           0 :     rDoc.CalcAll();
    2464           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/PriceMat.", XLS);
    2465           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2466           0 :     for (SCROW i = 0; i <= 9; ++i)
    2467             :     {
    2468           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    2469           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    2470           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2471             :     }
    2472           0 :     xDocSh->DoClose();
    2473           0 :     xDocShRes->DoClose();
    2474             : }
    2475           2 : void ScOpenCLTest::testFinacialFormulaReceived()
    2476             : {
    2477           2 :     if (!detectOpenCLDevice())
    2478           4 :         return;
    2479           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Received.", XLS);
    2480           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2481           0 :     enableOpenCL();
    2482           0 :     rDoc.CalcAll();
    2483           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Received.", XLS);
    2484           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2485             :     // Check the results of formula cells in the shared formula range.
    2486           0 :     for (SCROW i = 0; i < 10; ++i)
    2487             :     {
    2488           0 :         double fLibre = rDoc.GetValue(ScAddress(5,i,0));
    2489           0 :         double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
    2490           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2491             :     }
    2492           0 :     xDocSh->DoClose();
    2493           0 :     xDocShRes->DoClose();
    2494             : }
    2495           2 : void ScOpenCLTest::testFinancialFormulaCumipmt()
    2496             : {
    2497           2 :     if (!detectOpenCLDevice())
    2498           4 :         return;
    2499           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Cumipmt.", XLS);
    2500           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2501           0 :     enableOpenCL();
    2502           0 :     rDoc.CalcAll();
    2503           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Cumipmt.", XLS);
    2504           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2505             :     // Check the results of formula cells in the shared formula range.
    2506           0 :     for (SCROW i = 1; i <= 10; ++i)
    2507             :     {
    2508           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,0));
    2509           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
    2510           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2511             :     }
    2512           0 :     xDocSh->DoClose();
    2513           0 :     xDocShRes->DoClose();
    2514             : }
    2515           2 : void ScOpenCLTest::testFinancialFormulaCumprinc()
    2516             : {
    2517           2 :     if (!detectOpenCLDevice())
    2518           4 :         return;
    2519           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Cumprinc.", XLS);
    2520           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2521           0 :     enableOpenCL();
    2522           0 :     rDoc.CalcAll();
    2523           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Cumprinc.", XLS);
    2524           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2525             :     // Check the results of formula cells in the shared formula range.
    2526           0 :     for (SCROW i = 1; i <= 10; ++i)
    2527             :     {
    2528           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,0));
    2529           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
    2530           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2531             :     }
    2532           0 :     xDocSh->DoClose();
    2533           0 :     xDocShRes->DoClose();
    2534             : }
    2535           2 : void ScOpenCLTest::testFinacialRRIFormula()
    2536             : {
    2537           2 :     if (!detectOpenCLDevice())
    2538           4 :         return;
    2539           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/RRI.", XLS);
    2540           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2541           0 :     enableOpenCL();
    2542           0 :     rDoc.CalcAll();
    2543           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/RRI.", XLS);
    2544           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2545           0 :     for (SCROW i = 0; i <= 9; ++i)
    2546             :     {
    2547           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    2548           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    2549           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2550             :     }
    2551           0 :     xDocSh->DoClose();
    2552           0 :     xDocShRes->DoClose();
    2553             : }
    2554           2 : void ScOpenCLTest::testFinacialEFFECT_ADDFormula()
    2555             : {
    2556           2 :     if (!detectOpenCLDevice())
    2557           4 :         return;
    2558           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/EFFECT_ADD.", XLS);
    2559           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2560           0 :     enableOpenCL();
    2561           0 :     rDoc.CalcAll();
    2562           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/EFFECT_ADD.", XLS);
    2563           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2564           0 :     for (SCROW i = 0; i <= 9; ++i)
    2565             :     {
    2566           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    2567           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    2568           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2569             :     }
    2570           0 :     xDocSh->DoClose();
    2571           0 :     xDocShRes->DoClose();
    2572             : }
    2573           2 : void ScOpenCLTest::testFinacialNominalFormula()
    2574             : {
    2575           2 :     if (!detectOpenCLDevice())
    2576           4 :         return;
    2577           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Nominal.", XLS);
    2578           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2579           0 :     enableOpenCL();
    2580           0 :     rDoc.CalcAll();
    2581           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Nominal.", XLS);
    2582           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2583             :     // Check the results of formula cells in the shared formula range.
    2584           0 :     for (SCROW i = 1; i <= 19; ++i)
    2585             :     {
    2586           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    2587           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    2588           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2589             :     }
    2590           0 :     xDocSh->DoClose();
    2591           0 :     xDocShRes->DoClose();
    2592             : }
    2593           2 : void ScOpenCLTest::testFinacialTBILLEQFormula()
    2594             : {
    2595           2 :     if (!detectOpenCLDevice())
    2596           4 :         return;
    2597           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLEQ.", XLS);
    2598           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2599           0 :     enableOpenCL();
    2600           0 :     rDoc.CalcAll();
    2601           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLEQ.", XLS);
    2602           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2603           0 :     for (SCROW i = 0; i <= 6; ++i)
    2604             :     {
    2605           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    2606           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    2607           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2608             :     }
    2609           0 :     xDocSh->DoClose();
    2610           0 :     xDocShRes->DoClose();
    2611             : }
    2612           2 : void ScOpenCLTest::testFinacialTBILLPRICEFormula()
    2613             : {
    2614           2 :     if (!detectOpenCLDevice())
    2615           4 :         return;
    2616           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLPRICE.", XLS);
    2617           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2618           0 :     enableOpenCL();
    2619           0 :     rDoc.CalcAll();
    2620           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLPRICE.", XLS);
    2621           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2622           0 :     for (SCROW i = 0; i <= 6; ++i)
    2623             :     {
    2624           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    2625           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    2626           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2627             :     }
    2628           0 :     xDocSh->DoClose();
    2629           0 :     xDocShRes->DoClose();
    2630             : }
    2631           2 : void ScOpenCLTest::testFinacialTBILLYIELDFormula()
    2632             : {
    2633           2 :     if (!detectOpenCLDevice())
    2634           4 :         return;
    2635           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLYIELD.", XLS);
    2636           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2637           0 :     enableOpenCL();
    2638           0 :     rDoc.CalcAll();
    2639           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLYIELD.", XLS);
    2640           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2641           0 :     for (SCROW i = 0; i <= 6; ++i)
    2642             :     {
    2643           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    2644           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    2645           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2646             :     }
    2647           0 :     xDocSh->DoClose();
    2648           0 :     xDocShRes->DoClose();
    2649             : }
    2650           2 : void ScOpenCLTest::testFinacialYIELDFormula()
    2651             : {
    2652           2 :     if (!detectOpenCLDevice())
    2653           4 :         return;
    2654           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELD.", XLS);
    2655           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2656           0 :     enableOpenCL();
    2657           0 :     rDoc.CalcAll();
    2658           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELD.", XLS);
    2659           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2660           0 :     for (SCROW i = 0; i <= 6; ++i)
    2661             :     {
    2662           0 :         double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
    2663           0 :         double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
    2664           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2665             :     }
    2666           0 :     xDocSh->DoClose();
    2667           0 :     xDocShRes->DoClose();
    2668             : }
    2669             : 
    2670           2 : void ScOpenCLTest::testFinacialYIELDDISCFormula()
    2671             : {
    2672           2 :     if (!detectOpenCLDevice())
    2673           4 :         return;
    2674           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELDDISC.", XLS);
    2675           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2676           0 :     enableOpenCL();
    2677           0 :     rDoc.CalcAll();
    2678           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELDDISC.", XLS);
    2679           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2680           0 :     for (SCROW i = 0; i <= 6; ++i)
    2681             :     {
    2682           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    2683           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    2684           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2685             :     }
    2686           0 :     xDocSh->DoClose();
    2687           0 :     xDocShRes->DoClose();
    2688             : }
    2689             : 
    2690           2 : void ScOpenCLTest::testFinacialYIELDMATFormula()
    2691             : {
    2692           2 :     if (!detectOpenCLDevice())
    2693           4 :         return;
    2694           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELDMAT.", XLS);
    2695           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2696           0 :     enableOpenCL();
    2697           0 :     rDoc.CalcAll();
    2698           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELDMAT.", XLS);
    2699           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2700           0 :     for (SCROW i = 0; i <= 6; ++i)
    2701             :     {
    2702           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    2703           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    2704           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2705             :     }
    2706           0 :     xDocSh->DoClose();
    2707           0 :     xDocShRes->DoClose();
    2708             : }
    2709           2 : void ScOpenCLTest:: testFinacialPMTFormula()
    2710             : {
    2711           2 :     if (!detectOpenCLDevice())
    2712           4 :         return;
    2713           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/PMT.", XLS);
    2714           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2715           0 :     enableOpenCL();
    2716           0 :     rDoc.CalcAll();
    2717           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/PMT.", XLS);
    2718           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2719           0 :     for (SCROW i = 0; i <= 6; ++i)
    2720             :     {
    2721           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    2722           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    2723           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2724             :     }
    2725           0 :     xDocSh->DoClose();
    2726           0 :     xDocShRes->DoClose();
    2727             : }
    2728             : //[AMLOEXT-111]
    2729           2 : void ScOpenCLTest:: testFinancialDurationFormula()
    2730             : {
    2731           2 :     if (!detectOpenCLDevice())
    2732           4 :         return;
    2733           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration.", ODS);
    2734           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2735           0 :     enableOpenCL();
    2736           0 :     rDoc.CalcAll();
    2737           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration.", ODS);
    2738           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2739           0 :     for (SCROW i = 0; i <= 9; ++i)
    2740             :     {
    2741           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    2742           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    2743           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2744             :     }
    2745           0 :     xDocSh->DoClose();
    2746           0 :     xDocShRes->DoClose();
    2747             : }
    2748             : //[AMLOEXT-112]
    2749           2 : void ScOpenCLTest::testStatisticalFormulaLogNormDist()
    2750             : {
    2751           2 :     if (!detectOpenCLDevice())
    2752           4 :         return;
    2753             : 
    2754           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/LogNormDist.", ODS);
    2755           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2756           0 :     enableOpenCL();
    2757           0 :     rDoc.CalcAll();
    2758             : 
    2759           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/LogNormDist.", ODS);
    2760           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2761             :     // Check the results of formula cells in the shared formula range.
    2762           0 :     for (SCROW i = 1; i <= 19; ++i)
    2763             :     {
    2764           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    2765           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    2766           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2767             :     }
    2768           0 :     xDocSh->DoClose();
    2769           0 :     xDocShRes->DoClose();
    2770             : }
    2771             : //[AMLOEXT-113]
    2772           2 : void ScOpenCLTest::testMathFormulaArcCos()
    2773             : {
    2774           2 :     if (!detectOpenCLDevice())
    2775           4 :         return;
    2776           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCos.", ODS);
    2777           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2778           0 :     enableOpenCL();
    2779           0 :     rDoc.CalcAll();
    2780           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCos.", ODS);
    2781           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2782             :     // Verify ACos Function
    2783           0 :     for (SCROW i = 1; i <= 1000; ++i)
    2784             :     {
    2785           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2786           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2787           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2788             :     }
    2789           0 :     xDocSh->DoClose();
    2790           0 :     xDocShRes->DoClose();
    2791             : }
    2792             : //[AMLOEXT-117]
    2793           2 : void ScOpenCLTest::testMathFormulaPower()
    2794             : {
    2795           2 :     if (!detectOpenCLDevice())
    2796           4 :         return;
    2797           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/power.", ODS);
    2798           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2799           0 :     enableOpenCL();
    2800           0 :     rDoc.CalcAll();
    2801           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/power.", ODS);
    2802           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2803           0 :     for (SCROW i = 0; i <= 15; ++i)
    2804             :     {
    2805           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    2806           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    2807           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2808             :     }
    2809           0 :     xDocSh->DoClose();
    2810           0 :     xDocShRes->DoClose();
    2811             : }
    2812             : //[AMLOEXT-119]
    2813           2 : void ScOpenCLTest:: testFinacialPPMTFormula()
    2814             : {
    2815           2 :     if (!detectOpenCLDevice())
    2816           4 :         return;
    2817           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/PPMT.", XLS);
    2818           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2819           0 :     enableOpenCL();
    2820           0 :     rDoc.CalcAll();
    2821           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/PPMT.", XLS);
    2822           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2823           0 :     for (SCROW i = 0; i <= 6; ++i)
    2824             :     {
    2825           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    2826           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    2827           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2828             :     }
    2829           0 :     xDocSh->DoClose();
    2830           0 :     xDocShRes->DoClose();
    2831             : }
    2832             : //[AMLOEXT-120]
    2833           2 : void ScOpenCLTest:: testFinacialNPVFormula()
    2834             : {
    2835           2 :     if (!detectOpenCLDevice())
    2836           4 :         return;
    2837           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/NPV.", XLS);
    2838           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2839           0 :     enableOpenCL();
    2840           0 :     rDoc.CalcAll();
    2841           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPV.", XLS);
    2842           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2843           0 :     for (SCROW i = 0; i <= 6; ++i)
    2844             :     {
    2845           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    2846           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    2847           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2848             :     }
    2849           0 :     xDocSh->DoClose();
    2850           0 :     xDocShRes->DoClose();
    2851             : }
    2852             : //[AMLOEXT-121]
    2853           2 : void ScOpenCLTest:: testFinancialDuration_ADDFormula()
    2854             : {
    2855           2 :     if (!detectOpenCLDevice())
    2856           4 :         return;
    2857           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration_ADD.", XLS);
    2858           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2859           0 :     enableOpenCL();
    2860           0 :     rDoc.CalcAll();
    2861           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration_ADD.", XLS);
    2862           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2863           0 :     for (SCROW i = 0; i <= 9; ++i)
    2864             :     {
    2865           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    2866           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    2867           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2868             :     }
    2869           0 :     xDocSh->DoClose();
    2870           0 :     xDocShRes->DoClose();
    2871             : }
    2872             : //[AMLOEXT-122]
    2873           2 : void ScOpenCLTest::testStatisticalFormulaNorminv()
    2874             : {
    2875           2 :     if (!detectOpenCLDevice())
    2876           4 :         return;
    2877           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Norminv.", XLS);
    2878           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2879           0 :     enableOpenCL();
    2880           0 :     rDoc.CalcAll();
    2881           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Norminv.", XLS);
    2882           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2883             :     // Check the results of formula cells in the shared formula range.
    2884           0 :     for (SCROW i = 1; i <= 19; ++i)
    2885             :     {
    2886           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    2887           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    2888           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2889             :     }
    2890           0 :     xDocSh->DoClose();
    2891           0 :     xDocShRes->DoClose();
    2892             : }
    2893             : //[AMLOEXT-123]
    2894           2 : void ScOpenCLTest::testStatisticalFormulaNormsinv()
    2895             : {
    2896           2 :      if (!detectOpenCLDevice())
    2897           4 :         return;
    2898           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Normsinv.", XLS);
    2899           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2900           0 :     enableOpenCL();
    2901           0 :     rDoc.CalcAll();
    2902           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Normsinv.", XLS);
    2903           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2904             :     // Check the results of formula cells in the shared formula range.
    2905           0 :     for (SCROW i = 1; i <= 19; ++i)
    2906             :     {
    2907           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2908           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2909           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2910             :     }
    2911           0 :     xDocSh->DoClose();
    2912           0 :     xDocShRes->DoClose();
    2913             : }
    2914             : //[AMLOEXT-125]
    2915           2 : void ScOpenCLTest::testMathFormulaArcCosHyp()
    2916             : {
    2917           2 :     if (!detectOpenCLDevice())
    2918           4 :         return;
    2919           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCosHyp.", ODS);
    2920           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2921           0 :     enableOpenCL();
    2922           0 :     rDoc.CalcAll();
    2923           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCosHyp.", ODS);
    2924           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2925             :     // Verify ACosH Function
    2926           0 :     for (SCROW i = 1; i <= 1000; ++i)
    2927             :     {
    2928           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2929           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2930           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2931             :     }
    2932           0 :     xDocSh->DoClose();
    2933           0 :     xDocShRes->DoClose();
    2934             : }
    2935             : //[AMLOEXT-126]
    2936           2 : void ScOpenCLTest:: testFinancialMDurationFormula()
    2937             : {
    2938           2 :     if (!detectOpenCLDevice())
    2939           4 :         return;
    2940           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/MDuration.", XLS);
    2941           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2942           0 :     enableOpenCL();
    2943           0 :     rDoc.CalcAll();
    2944           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/MDuration.", XLS);
    2945           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2946           0 :     for (SCROW i = 0; i <= 9; ++i)
    2947             :     {
    2948           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    2949           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    2950           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2951             :     }
    2952           0 :     xDocSh->DoClose();
    2953           0 :     xDocShRes->DoClose();
    2954             : }
    2955             : //[AMLOEXT-127]
    2956           2 : void ScOpenCLTest::testMathFormulaArcCot()
    2957             : {
    2958           2 :     if (!detectOpenCLDevice())
    2959           4 :         return;
    2960           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCot.", ODS);
    2961           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2962           0 :     enableOpenCL();
    2963           0 :     rDoc.CalcAll();
    2964           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCot.", ODS);
    2965           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2966             :     // Verify ACot Function
    2967           0 :     for (SCROW i = 1; i <= 1000; ++i)
    2968             :     {
    2969           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    2970           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    2971           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2972             :     }
    2973           0 :     xDocSh->DoClose();
    2974           0 :     xDocShRes->DoClose();
    2975             : }
    2976             : //[AMLOEXT-131]
    2977           2 : void ScOpenCLTest:: testFinancialFVFormula()
    2978             : {
    2979           2 :     if (!detectOpenCLDevice())
    2980           4 :         return;
    2981           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/FV.", XLS);
    2982           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    2983           0 :     enableOpenCL();
    2984           0 :     rDoc.CalcAll();
    2985           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/FV.", XLS);
    2986           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    2987           0 :     for (SCROW i = 0; i <= 9; ++i)
    2988             :     {
    2989           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    2990           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    2991           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    2992             :     }
    2993           0 :     xDocSh->DoClose();
    2994           0 :     xDocShRes->DoClose();
    2995             : }
    2996             : //[AMLOEXT-132]
    2997           2 : void ScOpenCLTest::testFinancialDBFormula()
    2998             : {
    2999           2 :    if (!detectOpenCLDevice())
    3000           4 :         return;
    3001           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/db.", XLS);
    3002           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3003           0 :     enableOpenCL();
    3004           0 :     rDoc.CalcAll();
    3005           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/db.", XLS);
    3006           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3007           0 :     for (SCROW i = 0; i <= 9; ++i)
    3008             :     {
    3009           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    3010           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    3011           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3012             :     }
    3013           0 :     xDocSh->DoClose();
    3014           0 :     xDocShRes->DoClose();
    3015             : }
    3016             : //[AMLOEXT-135]
    3017           2 : void ScOpenCLTest::testFinancialCouppcdFormula()
    3018             : {
    3019           2 :     if (!detectOpenCLDevice())
    3020           4 :         return;
    3021           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Couppcd.", XLS);
    3022           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3023           0 :     enableOpenCL();
    3024           0 :     rDoc.CalcAll();
    3025           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Couppcd.", XLS);
    3026           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3027           0 :     for (SCROW i = 0; i <= 9; ++i)
    3028             :     {
    3029           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    3030           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    3031           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3032             :     }
    3033           0 :     xDocSh->DoClose();
    3034           0 :     xDocShRes->DoClose();
    3035             : }
    3036             : //[AMLOEXT-128]
    3037           2 : void ScOpenCLTest::testMathSumIfsFormula()
    3038             : {
    3039           2 :     if (!detectOpenCLDevice())
    3040           4 :         return;
    3041           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sumifs.", XLS);
    3042           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3043           0 :     sc::FormulaGroupInterpreter::enableOpenCL(true);
    3044           0 :     xDocSh->DoHardRecalc(true);
    3045           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sumifs.", XLS);
    3046           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3047           0 :     for (SCROW i = 2; i <= 11; ++i)
    3048             :     {
    3049           0 :         double fLibre = rDoc.GetValue(ScAddress(5,i,0));
    3050           0 :         double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
    3051           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3052             :     }
    3053           0 :     for (SCROW i = 2; i <= 11; ++i)
    3054             :     {
    3055           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,0));
    3056           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
    3057           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3058             :     }
    3059           0 :     for (SCROW i = 2; i <= 11; ++i)
    3060             :     {
    3061           0 :         double fLibre = rDoc.GetValue(ScAddress(7,i,0));
    3062           0 :         double fExcel = rDocRes.GetValue(ScAddress(7,i,0));
    3063           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3064             :     }
    3065           0 :     for (SCROW i = 2; i <= 11; ++i)
    3066             :     {
    3067           0 :         double fLibre = rDoc.GetValue(ScAddress(8,i,0));
    3068           0 :         double fExcel = rDocRes.GetValue(ScAddress(8,i,0));
    3069           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3070             :     }
    3071           0 :     xDocSh->DoClose();
    3072           0 :     xDocShRes->DoClose();
    3073             : }
    3074             : //[AMLOEXT-129]
    3075           2 : void ScOpenCLTest::testMathFormulaArcCotHyp()
    3076             : {
    3077           2 :     if (!detectOpenCLDevice())
    3078           4 :         return;
    3079           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcCotHyp.", ODS);
    3080           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3081           0 :     enableOpenCL();
    3082           0 :     rDoc.CalcAll();
    3083           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcCotHyp.", ODS);
    3084           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3085             :     // Verify ACotH Function
    3086           0 :     for (SCROW i = 1; i <= 1000; ++i)
    3087             :     {
    3088           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3089           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3090           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3091             :     }
    3092           0 :     xDocSh->DoClose();
    3093           0 :     xDocShRes->DoClose();
    3094             : }
    3095             : //[AMLOEXT-130]
    3096           2 : void ScOpenCLTest::testMathFormulaArcSin()
    3097             : {
    3098           2 :     if (!detectOpenCLDevice())
    3099           4 :         return;
    3100           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcSin.", ODS);
    3101           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3102           0 :     enableOpenCL();
    3103           0 :     rDoc.CalcAll();
    3104           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcSin.", ODS);
    3105           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3106             :     // Verify ACotH Function
    3107           0 :     for (SCROW i = 1; i <= 1000; ++i)
    3108             :     {
    3109           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3110           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3111           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3112             :     }
    3113           0 :     xDocSh->DoClose();
    3114           0 :     xDocShRes->DoClose();
    3115             : }
    3116             :  //[AMLOEXT-133]
    3117           2 : void ScOpenCLTest:: testFinancialVDBFormula()
    3118             : {
    3119           2 :     if (!detectOpenCLDevice())
    3120           4 :         return;
    3121           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/VDB.", XLS);
    3122           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3123           0 :     enableOpenCL();
    3124           0 :     rDoc.CalcAll();
    3125           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/VDB.", XLS);
    3126           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3127           0 :     for (SCROW i = 0; i <= 10; ++i)
    3128             :     {
    3129           0 :         double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
    3130           0 :         double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
    3131           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3132             :     }
    3133           0 :     for (SCROW i = 15; i <= 26; ++i)
    3134             :     {
    3135           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    3136           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    3137           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3138             :     }
    3139           0 :     for (SCROW i = 30; i <= 41; ++i)
    3140             :     {
    3141           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    3142           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    3143           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3144             :     }
    3145           0 :     xDocSh->DoClose();
    3146           0 :     xDocShRes->DoClose();
    3147             : }
    3148             : //[AMLOEXT-134]
    3149           2 : void ScOpenCLTest:: testFinancialIPMTFormula()
    3150             : {
    3151           2 :     if (!detectOpenCLDevice())
    3152           4 :         return;
    3153           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/IPMT.", XLS);
    3154           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3155           0 :     enableOpenCL();
    3156           0 :     rDoc.CalcAll();
    3157           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/IPMT.", XLS);
    3158           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3159           0 :     for (SCROW i = 0; i <= 9; ++i)
    3160             :     {
    3161           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    3162           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    3163           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3164             :     }
    3165           0 :     xDocSh->DoClose();
    3166           0 :     xDocShRes->DoClose();
    3167             : }
    3168             :   //[AMLOEXT-137]
    3169           2 : void ScOpenCLTest:: testFinancialXirrFormula()
    3170             : {
    3171           2 :     if (!detectOpenCLDevice())
    3172           4 :         return;
    3173             : 
    3174           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/XIRR.", ODS);
    3175           0 :     CPPUNIT_ASSERT(xDocSh.Is());
    3176           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3177           0 :     enableOpenCL();
    3178           0 :     rDoc.CalcAll();
    3179             : 
    3180           0 :     for (SCROW i = 1; i <= 10; ++i)
    3181             :     {
    3182           0 :         double fFormula  = rDoc.GetValue(ScAddress(2, i, 0));
    3183           0 :         double fExpected = rDoc.GetValue(ScAddress(3, i, 0));
    3184           0 :         CPPUNIT_ASSERT(rtl::math::approxEqual(fExpected, fFormula));
    3185             :     }
    3186           0 :     for (SCROW i = 18; i <= 27; ++i)
    3187             :     {
    3188           0 :         double fFormula = rDoc.GetValue(ScAddress(2, i, 0));
    3189           0 :         double fExpected = rDoc.GetValue(ScAddress(3, i, 0));
    3190           0 :         CPPUNIT_ASSERT(rtl::math::approxEqual(fExpected, fFormula));
    3191             :     }
    3192             : 
    3193           0 :     xDocSh->DoClose();
    3194             : }
    3195             : //[AMLOEXT-139]
    3196           2 : void ScOpenCLTest::testStatisticalFormulaChiSqDist()
    3197             : {
    3198           2 :     if (!detectOpenCLDevice())
    3199           4 :         return;
    3200           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/CHISQDIST.", ODS);
    3201           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3202           0 :     enableOpenCL();
    3203           0 :     rDoc.CalcAll();
    3204           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CHISQDIST.", ODS);
    3205           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3206             :     // Check the results of formula cells in the shared formula range.
    3207           0 :     for (SCROW i = 1; i <= 9; ++i)
    3208             :     {
    3209           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3210           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3211           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3212             :     }
    3213           0 :     for (SCROW i = 1; i <= 9; ++i)
    3214             :     {
    3215           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3216           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3217           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3218             :     }
    3219           0 :     xDocSh->DoClose();
    3220           0 :     xDocShRes->DoClose();
    3221             : }
    3222             : //[AMLOEXT-140]
    3223           2 : void ScOpenCLTest::testStatisticalFormulaConfidence()
    3224             : {
    3225           2 :     if (!detectOpenCLDevice())
    3226           4 :         return;
    3227             : 
    3228           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Confidence.", XLS);
    3229           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3230           0 :     enableOpenCL();
    3231           0 :     rDoc.CalcAll();
    3232             : 
    3233           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Confidence.", XLS);
    3234           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3235             :     // Check the results of formula cells in the shared formula range.
    3236           0 :     for (SCROW i = 0; i <= 9; ++i)
    3237             :     {
    3238           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3239           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3240           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3241             :     }
    3242           0 :     xDocSh->DoClose();
    3243           0 :     xDocShRes->DoClose();
    3244             : }
    3245             : //[AMLOEXT-141]
    3246           2 : void ScOpenCLTest::testStatisticalFormulaFDist()
    3247             : {
    3248           2 :     if (!detectOpenCLDevice())
    3249           4 :         return;
    3250           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Fdist.", XLS);
    3251           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3252           0 :     enableOpenCL();
    3253           0 :     rDoc.CalcAll();
    3254           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Fdist.", XLS);
    3255           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3256             :     // Check the results of formula cells in the shared formula range.
    3257           0 :     for (SCROW i = 0; i <= 9; ++i)
    3258             :     {
    3259           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3260           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3261           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3262             :     }
    3263           0 :     xDocSh->DoClose();
    3264           0 :     xDocShRes->DoClose();
    3265             : }
    3266             : //[AMLOEXT-136]
    3267           2 : void ScOpenCLTest::testFinancialCoupncdFormula()
    3268             : {
    3269           2 :     if (!detectOpenCLDevice())
    3270           4 :         return;
    3271           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupncd.", XLS);
    3272           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3273           0 :     enableOpenCL();
    3274           0 :     rDoc.CalcAll();
    3275           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupncd.", XLS);
    3276           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3277           0 :     for (SCROW i = 0; i <= 9; ++i)
    3278             :     {
    3279           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    3280           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    3281           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3282             :     }
    3283           0 :     xDocSh->DoClose();
    3284           0 :     xDocShRes->DoClose();
    3285             : }
    3286             : //[AMLOEXT-138]
    3287           2 : void ScOpenCLTest::testFinancialAccrintFormula()
    3288             : {
    3289           2 :     if (!detectOpenCLDevice())
    3290           4 :         return;
    3291           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/Accrint.", XLS);
    3292           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3293           0 :     enableOpenCL();
    3294           0 :     rDoc.CalcAll();
    3295           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/Accrint.", XLS);
    3296           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3297           0 :     for (SCROW i = 0; i <= 9; ++i)
    3298             :     {
    3299           0 :         double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
    3300           0 :         double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
    3301           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3302             :     }
    3303           0 :     xDocSh->DoClose();
    3304           0 :     xDocShRes->DoClose();
    3305             : }
    3306             : //[AMLOEXT-142]
    3307           2 : void ScOpenCLTest::testStatisticalFormulaCritBinom()
    3308             : {
    3309           2 :     if (!detectOpenCLDevice())
    3310           4 :         return;
    3311             : 
    3312           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/CritBinom.", XLS);
    3313           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3314           0 :     enableOpenCL();
    3315           0 :     rDoc.CalcAll();
    3316             : 
    3317           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CritBinom.", XLS);
    3318           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3319             :     // Check the results of formula cells in the shared formula range.
    3320           0 :     for (SCROW i = 0; i <= 9; ++i)
    3321             :     {
    3322           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3323           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3324           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3325             :     }
    3326           0 :     xDocSh->DoClose();
    3327           0 :     xDocShRes->DoClose();
    3328             : }
    3329             : //[AMLOEXT-143]
    3330           2 : void ScOpenCLTest::testMathFormulaArcSinHyp()
    3331             : {
    3332           2 :     if (!detectOpenCLDevice())
    3333           4 :         return;
    3334           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcSinHyp.", ODS);
    3335           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3336           0 :     enableOpenCL();
    3337           0 :     rDoc.CalcAll();
    3338           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcSinHyp.", ODS);
    3339           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3340             :     // Verify ASinH Function
    3341           0 :     for (SCROW i = 1; i <= 1000; ++i)
    3342             :     {
    3343           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3344           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3345           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3346             :     }
    3347           0 :     xDocSh->DoClose();
    3348           0 :     xDocShRes->DoClose();
    3349             : }
    3350             : //[AMLOEXT-144]
    3351           2 : void ScOpenCLTest::testMathFormulaArcTan()
    3352             : {
    3353           2 :     if (!detectOpenCLDevice())
    3354           4 :         return;
    3355           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcTan.", ODS);
    3356           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3357           0 :     enableOpenCL();
    3358           0 :     rDoc.CalcAll();
    3359           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcTan.", ODS);
    3360           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3361             :     // Verify ATan Function
    3362           0 :     for (SCROW i = 1; i <= 1000; ++i)
    3363             :     {
    3364           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3365           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3366           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3367             :     }
    3368           0 :     xDocSh->DoClose();
    3369           0 :     xDocShRes->DoClose();
    3370             : }
    3371             : //[AMLOEXT-145]
    3372           2 : void ScOpenCLTest::testMathFormulaArcTanHyp()
    3373             : {
    3374           2 :     if (!detectOpenCLDevice())
    3375           4 :         return;
    3376           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcTanHyp.", ODS);
    3377           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3378           0 :     enableOpenCL();
    3379           0 :     rDoc.CalcAll();
    3380           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcTanHyp.", ODS);
    3381           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3382             :     // Verify ATanH Function
    3383           0 :     for (SCROW i = 1; i <= 1000; ++i)
    3384             :     {
    3385           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3386           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3387           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3388             :     }
    3389           0 :     xDocSh->DoClose();
    3390           0 :     xDocShRes->DoClose();
    3391             : }
    3392             : //[AMLOEXT-146]
    3393           2 : void ScOpenCLTest:: testFinacialNPER1Formula()
    3394             : {
    3395           2 :     if (!detectOpenCLDevice())
    3396           4 :         return;
    3397           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/NPER1.", XLS);
    3398           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3399           0 :     enableOpenCL();
    3400           0 :     rDoc.CalcAll();
    3401           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/NPER1.", XLS);
    3402           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3403           0 :     for (SCROW i = 0; i <= 6; ++i)
    3404             :     {
    3405           0 :         double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
    3406           0 :         double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
    3407           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3408             :     }
    3409           0 :     xDocSh->DoClose();
    3410           0 :     xDocShRes->DoClose();
    3411             : }
    3412             : //[AMLOEXT-147]
    3413           2 : void ScOpenCLTest::testMathFormulaArcTan2()
    3414             : {
    3415           2 :     if (!detectOpenCLDevice())
    3416           4 :         return;
    3417           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ArcTan2.", ODS);
    3418           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3419           0 :     enableOpenCL();
    3420           0 :     rDoc.CalcAll();
    3421           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ArcTan2.", ODS);
    3422           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3423             :     // Verify ATan2 Function
    3424           0 :     for (SCROW i = 1; i <= 17; ++i)
    3425             :     {
    3426           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3427           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3428           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.000001);
    3429             :     }
    3430           0 :     xDocSh->DoClose();
    3431           0 :     xDocShRes->DoClose();
    3432             : }
    3433             : 
    3434             : //[AMLOEXT-148]
    3435           2 : void ScOpenCLTest::testStatisticalFormulaChiSqInv()
    3436             : {
    3437           2 :     if (!detectOpenCLDevice())
    3438           4 :         return;
    3439           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/CHISQINV.", ODS);
    3440           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3441           0 :     enableOpenCL();
    3442           0 :     rDoc.CalcAll();
    3443           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/CHISQINV.", ODS);
    3444           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3445             :     // Check the results of formula cells in the shared formula range.
    3446           0 :     for (SCROW i = 1; i <= 9; ++i)
    3447             :     {
    3448           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3449           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3450           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3451             :     }
    3452           0 :     xDocSh->DoClose();
    3453           0 :     xDocShRes->DoClose();
    3454             : }
    3455             : //[AMLOEXT-149]
    3456           2 : void ScOpenCLTest::testMathFormulaBitAnd()
    3457             : {
    3458           2 :     if (!detectOpenCLDevice())
    3459           4 :         return;
    3460           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/BitAnd.", ODS);
    3461           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3462           0 :     enableOpenCL();
    3463           0 :     rDoc.CalcAll();
    3464           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/BitAnd.", ODS);
    3465           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3466             :     // Verify BitAnd Function
    3467           0 :     for (SCROW i = 1; i <= 1000; ++i)
    3468             :     {
    3469           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3470           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3471           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3472             :     }
    3473           0 :     xDocSh->DoClose();
    3474           0 :     xDocShRes->DoClose();
    3475             : }
    3476             : //[AMLOEXT-150]
    3477           2 : void ScOpenCLTest::testStatisticalFormulaPoisson()
    3478             : {
    3479           2 :     if (!detectOpenCLDevice())
    3480           4 :         return;
    3481           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Poisson.", XLS);
    3482           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3483           0 :     enableOpenCL();
    3484           0 :     rDoc.CalcAll();
    3485           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Poisson.", XLS);
    3486           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3487             :     // Check the results of formula cells in the shared formula range.
    3488           0 :     for (SCROW i = 1; i <= 19; ++i)
    3489             :     {
    3490           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3491           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3492           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3493             :     }
    3494           0 :     xDocSh->DoClose();
    3495           0 :     xDocShRes->DoClose();
    3496             : }
    3497             : //[AMLOEXT-151]
    3498           2 : void ScOpenCLTest::testStatisticalFormulaExpondist()
    3499             : {
    3500           2 :     if (!detectOpenCLDevice())
    3501           4 :         return;
    3502           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Expondist.", XLS);
    3503           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3504           0 :     enableOpenCL();
    3505           0 :     rDoc.CalcAll();
    3506           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Expondist.", XLS);
    3507           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3508             :     // Check the results of formula cells in the shared formula range.
    3509           0 :     for (SCROW i = 0; i <= 9; ++i)
    3510             :     {
    3511           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3512           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3513           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3514             :     }
    3515           0 :     xDocSh->DoClose();
    3516           0 :     xDocShRes->DoClose();
    3517             : }
    3518             : //[AMLOEXT-152]
    3519           2 : void ScOpenCLTest::testMathFormulaBitOr()
    3520             : {
    3521           2 :     if (!detectOpenCLDevice())
    3522           4 :         return;
    3523           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/BitOr.", ODS);
    3524           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3525           0 :     enableOpenCL();
    3526           0 :     rDoc.CalcAll();
    3527           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/BitOr.", ODS);
    3528           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3529             :     // Verify BitOr Function
    3530           0 :     for (SCROW i = 1; i <= 20; ++i)
    3531             :     {
    3532           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3533           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3534           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3535             :     }
    3536           0 :     xDocSh->DoClose();
    3537           0 :     xDocShRes->DoClose();
    3538             : }
    3539             : 
    3540             : //[AMLOEXT-153]
    3541           2 : void ScOpenCLTest::testMathFormulaOdd()
    3542             : {
    3543           2 :     if (!detectOpenCLDevice())
    3544           4 :         return;
    3545           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/odd.", XLS);
    3546           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3547           0 :     enableOpenCL();
    3548           0 :     rDoc.CalcAll();
    3549           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/odd.", XLS);
    3550           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3551           0 :     for (SCROW i = 0; i <= 15; ++i)
    3552             :     {
    3553           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3554           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3555           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3556             :     }
    3557           0 :     xDocSh->DoClose();
    3558           0 :     xDocShRes->DoClose();
    3559             : }
    3560             : //[AMLOEXT-154]
    3561           2 : void ScOpenCLTest::testMathFormulaLN()
    3562             : {
    3563           2 :     if (!detectOpenCLDevice())
    3564           4 :         return;
    3565           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/LN.", XLS);
    3566           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3567           0 :     enableOpenCL();
    3568           0 :     rDoc.CalcAll();
    3569           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/LN.", XLS);
    3570           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3571             :     // Check the results of formula cells in the shared formula range.
    3572           0 :     for (SCROW i = 1; i <= 9; ++i)
    3573             :     {
    3574           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3575           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3576           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3577             :     }
    3578           0 :     xDocSh->DoClose();
    3579           0 :     xDocShRes->DoClose();
    3580             : }
    3581             : //AMLOEXT-155
    3582           2 : void ScOpenCLTest::testMathFormulaMod()
    3583             : {
    3584           2 :     if (!detectOpenCLDevice())
    3585           4 :         return;
    3586             : 
    3587           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/mod.", XLS);
    3588           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3589           0 :     enableOpenCL();
    3590           0 :     rDoc.CalcAll();
    3591           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/mod.", XLS);
    3592           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3593           0 :     for (SCROW i = 0; i <= 15; ++i)
    3594             :     {
    3595           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3596           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3597           0 :         if(fExcel == 0.0f)
    3598           0 :             CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 1e-10);
    3599             :         else
    3600           0 :             CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3601             :     }
    3602           0 :     xDocSh->DoClose();
    3603           0 :     xDocShRes->DoClose();
    3604             : }
    3605             : //[ AMLOEXT-156]
    3606           2 : void ScOpenCLTest::testMathFormulaRound()
    3607             : {
    3608           2 :     if (!detectOpenCLDevice())
    3609           4 :         return;
    3610           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/ROUND.", XLS);
    3611           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3612           0 :     enableOpenCL();
    3613           0 :     rDoc.CalcAll();
    3614           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/ROUND.", XLS);
    3615           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3616             :     // Check the results of formula cells in the shared formula range.
    3617           0 :     for (SCROW i = 1; i <= 9; ++i)
    3618             :     {
    3619           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3620           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3621           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3622             :     }
    3623           0 :     for (SCROW i = 15; i <= 25; ++i)
    3624             :     {
    3625           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3626           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3627           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3628             :     }
    3629           0 :     xDocSh->DoClose();
    3630           0 :     xDocShRes->DoClose();
    3631             : }
    3632             : //[AMLOEXT-157]
    3633           2 : void ScOpenCLTest::testStatisticalFormulaGammaDist()
    3634             : {
    3635           2 :     if (!detectOpenCLDevice())
    3636           4 :         return;
    3637             : 
    3638           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaDist.", XLS);
    3639           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3640           0 :     enableOpenCL();
    3641           0 :     rDoc.CalcAll();
    3642           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaDist.", XLS);
    3643           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3644             :     // Check the results of formula cells in the shared formula range.
    3645           0 :     for (SCROW i = 1; i <= 19; ++i)
    3646             :     {
    3647           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    3648           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    3649           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3650             :     }
    3651           0 :     xDocSh->DoClose();
    3652           0 :     xDocShRes->DoClose();
    3653             : }
    3654             : //[AMLOEXT-158]
    3655           2 : void ScOpenCLTest::testStatisticalFormulaGammaInv()
    3656             : {
    3657           2 :     if (!detectOpenCLDevice())
    3658           4 :         return;
    3659             : 
    3660           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaInv.", XLS);
    3661           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3662           0 :     enableOpenCL();
    3663           0 :     rDoc.CalcAll();
    3664           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaInv.", XLS);
    3665           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3666             :     // Check the results of formula cells in the shared formula range.
    3667           0 :     for (SCROW i = 1; i <= 19; ++i)
    3668             :     {
    3669           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3670           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3671           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3672           0 :         fLibre = rDoc.GetValue(ScAddress(4,i,0));
    3673           0 :         fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    3674           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3675             :     }
    3676           0 :     xDocSh->DoClose();
    3677           0 :     xDocShRes->DoClose();
    3678             : }
    3679             : //[AMLOEXT-159]
    3680           2 : void ScOpenCLTest::testStatisticalFormulaFInv()
    3681             : {
    3682           2 :     if (!detectOpenCLDevice())
    3683           4 :         return;
    3684             : 
    3685           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/FInv.", XLS);
    3686           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3687           0 :     enableOpenCL();
    3688           0 :     rDoc.CalcAll();
    3689           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/FInv.", XLS);
    3690           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3691             :     // Check the results of formula cells in the shared formula range.
    3692           0 :     for (SCROW i = 1; i <= 19; ++i)
    3693             :     {
    3694           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3695           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3696           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3697           0 :         fLibre = rDoc.GetValue(ScAddress(4,i,0));
    3698           0 :         fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    3699           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3700             :     }
    3701           0 :     xDocSh->DoClose();
    3702           0 :     xDocShRes->DoClose();
    3703             : }
    3704             : //[AMLOEXT-160]
    3705           2 : void ScOpenCLTest::testStatisticalFormulaFTest()
    3706             : {
    3707           2 :     if (!detectOpenCLDevice())
    3708           4 :         return;
    3709             : 
    3710           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/FTest.", XLS);
    3711           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3712           0 :     enableOpenCL();
    3713           0 :     rDoc.CalcAll();
    3714           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/FTest.", XLS);
    3715           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3716             :     // Check the results of formula cells in the shared formula range.
    3717           0 :     for (SCROW i = 1; i <= 19; ++i)
    3718             :     {
    3719           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3720           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3721           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3722             :     }
    3723           0 :     xDocSh->DoClose();
    3724           0 :     xDocShRes->DoClose();
    3725             : }
    3726             : //[AMLOEXT-161]
    3727           2 : void ScOpenCLTest::testStatisticalFormulaB()
    3728             : {
    3729           2 :     if (!detectOpenCLDevice())
    3730           4 :         return;
    3731           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/B.", XLS);
    3732           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3733           0 :     enableOpenCL();
    3734           0 :     rDoc.CalcAll();
    3735           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/B.", XLS);
    3736           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3737             :     // Check the results of formula cells in the shared formula range.
    3738           0 :     for (SCROW i = 1; i <= 19; ++i)
    3739             :     {
    3740           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    3741           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    3742           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3743           0 :         fLibre = rDoc.GetValue(ScAddress(5,i,0));
    3744           0 :         fExcel = rDocRes.GetValue(ScAddress(5,i,0));
    3745           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3746             :     }
    3747           0 :     xDocSh->DoClose();
    3748           0 :     xDocShRes->DoClose();
    3749             : }
    3750             : //[AMLOEXT-162]
    3751           2 : void ScOpenCLTest::testStatisticalFormulaBetaDist()
    3752             : {
    3753           2 :     if (!detectOpenCLDevice())
    3754           4 :         return;
    3755           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/BetaDist.", ODS);
    3756           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3757           0 :     enableOpenCL();
    3758           0 :     rDoc.CalcAll();
    3759           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/BetaDist.", ODS);
    3760           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3761             :     // Check the results of formula cells in the shared formula range.
    3762           0 :     for (SCROW i = 1; i <= 19; ++i)
    3763             :     {
    3764           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,0));
    3765           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
    3766           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3767           0 :         fLibre = rDoc.GetValue(ScAddress(7,i,0));
    3768           0 :         fExcel = rDocRes.GetValue(ScAddress(7,i,0));
    3769           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3770             :     }
    3771           0 :     xDocSh->DoClose();
    3772           0 :     xDocShRes->DoClose();
    3773             : }
    3774             : //AMLOEXT-164
    3775           2 : void ScOpenCLTest::testMathFormulaEven()
    3776             : {
    3777           2 :     if (!detectOpenCLDevice())
    3778           4 :         return;
    3779             : 
    3780           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/even.", XLS);
    3781           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3782           0 :     enableOpenCL();
    3783           0 :     rDoc.CalcAll();
    3784           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/even.", XLS);
    3785           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3786           0 :     for (SCROW i = 0; i <= 15; ++i)
    3787             :     {
    3788           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3789           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3790           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3791             :     }
    3792           0 :     xDocSh->DoClose();
    3793           0 :     xDocShRes->DoClose();
    3794             : }
    3795             : 
    3796             : //[AMLOEXT-165]
    3797           2 : void ScOpenCLTest::testMathFormulaExp()
    3798             : {
    3799           2 :     if (!detectOpenCLDevice())
    3800           4 :         return;
    3801           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/exp.", ODS);
    3802           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3803           0 :     enableOpenCL();
    3804           0 :     rDoc.CalcAll();
    3805           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/exp.", ODS);
    3806           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3807           0 :     for (SCROW i = 0; i <= 15; ++i)
    3808             :     {
    3809           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3810           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3811           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3812             :     }
    3813           0 :     xDocSh->DoClose();
    3814           0 :     xDocShRes->DoClose();
    3815             : }
    3816             : //[AMLOEXT-166]
    3817           2 : void ScOpenCLTest::testStatisticalFormulaChiDist()
    3818             : {
    3819           2 :     if (!detectOpenCLDevice())
    3820           4 :         return;
    3821           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/ChiDist.", XLS);
    3822           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3823           0 :     enableOpenCL();
    3824           0 :     rDoc.CalcAll();
    3825           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/ChiDist.", XLS);
    3826           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3827             :     // Check the results of formula cells in the shared formula range.
    3828           0 :     for (SCROW i = 1; i <= 19; ++i)
    3829             :     {
    3830           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3831           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3832           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3833             :     }
    3834           0 :     xDocSh->DoClose();
    3835           0 :     xDocShRes->DoClose();
    3836             : }
    3837             : //[AMLOEXT-167]
    3838           2 : void ScOpenCLTest::testMathFormulaBitLshift()
    3839             : {
    3840           2 :     if (!detectOpenCLDevice())
    3841           4 :         return;
    3842           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/BitLshift.", ODS);
    3843           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3844           0 :     enableOpenCL();
    3845           0 :     rDoc.CalcAll();
    3846           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/BitLshift.", ODS);
    3847           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3848             :     // Verify BitLshift Function
    3849           0 :     for (SCROW i = 1; i <= 20; ++i)
    3850             :     {
    3851           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3852           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3853           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3854             :     }
    3855           0 :     xDocSh->DoClose();
    3856           0 :     xDocShRes->DoClose();
    3857             : }
    3858             : //[AMLOEXT-168]
    3859           2 : void ScOpenCLTest::testMathFormulaBitRshift()
    3860             : {
    3861           2 :     if (!detectOpenCLDevice())
    3862           4 :         return;
    3863           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/BitRshift.", ODS);
    3864           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3865           0 :     enableOpenCL();
    3866           0 :     rDoc.CalcAll();
    3867           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/BitRshift.", ODS);
    3868           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3869             :     // Verify BitRshift Function
    3870           0 :     for (SCROW i = 1; i <= 20; ++i)
    3871             :     {
    3872           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3873           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3874           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3875             :     }
    3876           0 :     xDocSh->DoClose();
    3877           0 :     xDocShRes->DoClose();
    3878             : }
    3879             : //[AMLOEXT-169]
    3880           2 : void ScOpenCLTest::testMathFormulaFloor()
    3881             : {
    3882           2 :     if (!detectOpenCLDevice())
    3883           4 :         return;
    3884           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/floor.", ODS);
    3885           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3886           0 :     enableOpenCL();
    3887           0 :     rDoc.CalcAll();
    3888           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/floor.", ODS);
    3889           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3890           0 :     for (SCROW i = 0; i <= 9; ++i)
    3891             :     {
    3892           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    3893           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    3894           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3895             :     }
    3896           0 :     xDocSh->DoClose();
    3897           0 :     xDocShRes->DoClose();
    3898             : }
    3899             : //[AMLOEXT-170]
    3900           2 : void ScOpenCLTest::testMathFormulaLog()
    3901             : {
    3902           2 :     if (!detectOpenCLDevice())
    3903           4 :         return;
    3904             : 
    3905           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/log.", XLS);
    3906           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3907           0 :     enableOpenCL();
    3908           0 :     rDoc.CalcAll();
    3909           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/log.", XLS);
    3910           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3911           0 :     for (SCROW i = 0; i <= 47; ++i)
    3912             :     {
    3913           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3914           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3915           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3916             :     }
    3917           0 :     xDocSh->DoClose();
    3918           0 :     xDocShRes->DoClose();
    3919             : }
    3920             : //[AMLOEXT-171]
    3921           2 : void ScOpenCLTest::testSpreadSheetFormulaVLookup()
    3922             : {
    3923           2 :     if (!detectOpenCLDevice())
    3924           4 :         return;
    3925           0 :     ScDocShellRef xDocSh = loadDoc("opencl/spreadsheet/VLookup.", XLS);
    3926           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3927           0 :     enableOpenCL();
    3928           0 :     rDoc.CalcAll();
    3929           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/spreadsheet/VLookup.", XLS);
    3930           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3931             :     // Check the results of formula cells in the shared formula range.
    3932           0 :     for (SCROW i = 1; i <= 32; ++i)
    3933             :     {
    3934           0 :         double fLibre = rDoc.GetValue(ScAddress(5,i,0));
    3935           0 :         double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
    3936           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3937             :     }
    3938           0 :     for (SCROW i = 40; i <= 50; ++i)
    3939             :     {
    3940           0 :         double fLibre = rDoc.GetValue(ScAddress(5,i,0));
    3941           0 :         double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
    3942           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3943             :     }
    3944           0 :     xDocSh->DoClose();
    3945           0 :     xDocShRes->DoClose();
    3946             : }
    3947             : //[AMLOEXT-173]
    3948           2 : void ScOpenCLTest::testStatisticalFormulaChiInv()
    3949             : {
    3950           2 :     if (!detectOpenCLDevice())
    3951           4 :         return;
    3952           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/ChiInv.", XLS);
    3953           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3954           0 :     enableOpenCL();
    3955           0 :     rDoc.CalcAll();
    3956           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/ChiInv.", XLS);
    3957           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3958             :     // Check the results of formula cells in the shared formula range.
    3959           0 :     for (SCROW i = 1; i <= 10; ++i)
    3960             :     {
    3961           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    3962           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    3963           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3964             :     }
    3965           0 :     xDocSh->DoClose();
    3966           0 :     xDocShRes->DoClose();
    3967             : }
    3968             : //[AMLOEXT-175]
    3969           2 : void ScOpenCLTest::testMathFormulaConvert()
    3970             : {
    3971           2 :     if (!detectOpenCLDevice())
    3972           4 :         return;
    3973           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/convert.", XLS);
    3974           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3975           0 :     enableOpenCL();
    3976           0 :     rDoc.CalcAll();
    3977           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/convert.", XLS);
    3978           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3979           0 :     for (SCROW i = 0; i <= 3; ++i)
    3980             :     {
    3981           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    3982           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    3983           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    3984             :     }
    3985           0 :     xDocSh->DoClose();
    3986           0 :     xDocShRes->DoClose();
    3987             : }
    3988             : //[ AMLOEXT-176 ]
    3989           2 : void ScOpenCLTest::testMathCountIfsFormula()
    3990             : {
    3991           2 :     if (!detectOpenCLDevice())
    3992           4 :         return;
    3993           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/countifs.", XLS);
    3994           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    3995           0 :     sc::FormulaGroupInterpreter::enableOpenCL(true);
    3996           0 :     xDocSh->DoHardRecalc(true);
    3997           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/countifs.", XLS);
    3998           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    3999           0 :     for (SCROW i = 1; i < 10; ++i)
    4000             :     {
    4001           0 :         double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
    4002           0 :         double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
    4003           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4004             :     }
    4005           0 :     xDocSh->DoClose();
    4006           0 :     xDocShRes->DoClose();
    4007             : }
    4008             : //[AMLOEXT-178]
    4009           2 : void ScOpenCLTest::testMathFormulaBitXor()
    4010             : {
    4011           2 :     if (!detectOpenCLDevice())
    4012           4 :         return;
    4013           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/BitXor.", ODS);
    4014           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4015           0 :     enableOpenCL();
    4016           0 :     rDoc.CalcAll();
    4017           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/BitXor.", ODS);
    4018           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4019             :     // Verify BitXor Function
    4020           0 :     for (SCROW i = 1; i <= 20; ++i)
    4021             :     {
    4022           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4023           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4024           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4025             :     }
    4026           0 :     xDocSh->DoClose();
    4027           0 :     xDocShRes->DoClose();
    4028             : }
    4029             : //[ AMLOEXT-179]
    4030           2 : void ScOpenCLTest::testMathAverageIfsFormula()
    4031             : {
    4032           2 :     if (!detectOpenCLDevice())
    4033           4 :         return;
    4034           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/averageifs.", XLS);
    4035           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4036           0 :     sc::FormulaGroupInterpreter::enableOpenCL(true);
    4037           0 :     xDocSh->DoHardRecalc(true);
    4038           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/averageifs.", XLS);
    4039           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4040           0 :     for (SCROW i = 1; i <= 11; ++i)
    4041             :     {
    4042           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    4043           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    4044           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4045             :     }
    4046           0 :     xDocSh->DoClose();
    4047           0 :     xDocShRes->DoClose();
    4048             : }
    4049             : 
    4050             : //[AMLOEXT-180]
    4051           2 : void ScOpenCLTest::testMathFormulaLog10()
    4052             : {
    4053           2 :     if (!detectOpenCLDevice())
    4054           4 :         return;
    4055           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/log10.", ODS);
    4056           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4057           0 :     enableOpenCL();
    4058           0 :     rDoc.CalcAll();
    4059           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/log10.", ODS);
    4060           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4061           0 :     for (SCROW i = 0; i <= 15; ++i)
    4062             :     {
    4063           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4064           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4065           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4066             :     }
    4067           0 :     xDocSh->DoClose();
    4068           0 :     xDocShRes->DoClose();
    4069             : }
    4070             : //[AMLOEXT-174]
    4071           2 : void ScOpenCLTest::testMathFormulaCombina()
    4072             : {
    4073           2 :     if (!detectOpenCLDevice())
    4074           4 :         return;
    4075             : 
    4076           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/combina.", XLS);
    4077           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4078           0 :     enableOpenCL();
    4079           0 :     rDoc.CalcAll();
    4080           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/combina.", XLS);
    4081           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4082           0 :     for (SCROW i = 0; i <= 47; ++i)
    4083             :     {
    4084           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4085           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4086           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4087             :     }
    4088           0 :     xDocSh->DoClose();
    4089           0 :     xDocShRes->DoClose();
    4090             : }
    4091             : //[AMLOEXT-181]
    4092           2 : void ScOpenCLTest::testMathFormulaCeil()
    4093             : {
    4094           2 :     if (!detectOpenCLDevice())
    4095           4 :         return;
    4096           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/Ceil.", ODS);
    4097           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4098           0 :     enableOpenCL();
    4099           0 :     rDoc.CalcAll();
    4100           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/Ceil.", ODS);
    4101           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4102             :     // Verify Ceiling Function
    4103           0 :     for (SCROW i = 1; i <= 20; ++i)
    4104             :     {
    4105           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4106           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4107           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4108             :     }
    4109           0 :     xDocSh->DoClose();
    4110           0 :     xDocShRes->DoClose();
    4111             : }
    4112             : //[AMLOEXT-182]
    4113           2 : void ScOpenCLTest::testMathFormulaSqrtPi()
    4114             : {
    4115           2 :     if (!detectOpenCLDevice())
    4116           4 :             return;
    4117           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sqrtpi.", XLS);
    4118           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4119           0 :     enableOpenCL();
    4120           0 :     rDoc.CalcAll();
    4121           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sqrtpi.", XLS);
    4122           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4123           0 :     for (SCROW i = 0; i < 20; ++i)
    4124             :     {
    4125           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4126           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4127           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4128             :     }
    4129           0 :     xDocSh->DoClose();
    4130           0 :     xDocShRes->DoClose();
    4131             : }
    4132             : //[AMLOEXT-183]
    4133           2 : void ScOpenCLTest::testStatisticalFormulaVarP()
    4134             : {
    4135           2 :     if (!detectOpenCLDevice())
    4136           4 :         return;
    4137             : 
    4138           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarP.", XLS);
    4139           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4140           0 :     enableOpenCL();
    4141           0 :     rDoc.CalcAll();
    4142             : 
    4143           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarP.", XLS);
    4144           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4145             :     // Check the results of formula cells in the shared formula range.
    4146           0 :     for (SCROW i = 1; i <= 20; ++i)
    4147             :     {
    4148           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4149           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4150           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4151             :     }
    4152           0 :     xDocSh->DoClose();
    4153           0 :     xDocShRes->DoClose();
    4154             : }
    4155             : //[AMLOEXT-184]
    4156           2 : void ScOpenCLTest::testStatisticalFormulaStDev()
    4157             : {
    4158           2 :     if (!detectOpenCLDevice())
    4159           4 :         return;
    4160             : 
    4161           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDev.", XLS);
    4162           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4163           0 :     enableOpenCL();
    4164           0 :     rDoc.CalcAll();
    4165             : 
    4166           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDev.", XLS);
    4167           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4168             :     // Check the results of formula cells in the shared formula range.
    4169           0 :     for (SCROW i = 1; i <= 20; ++i)
    4170             :     {
    4171           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4172           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4173           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4174             :     }
    4175           0 :     xDocSh->DoClose();
    4176           0 :     xDocShRes->DoClose();
    4177             : }
    4178             : //[AMLOEXT-185]
    4179           2 : void ScOpenCLTest::testStatisticalFormulaStDevP()
    4180             : {
    4181           2 :     if (!detectOpenCLDevice())
    4182           4 :         return;
    4183             : 
    4184           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevP.", XLS);
    4185           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4186           0 :     enableOpenCL();
    4187           0 :     rDoc.CalcAll();
    4188             : 
    4189           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevP.", XLS);
    4190           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4191             :     // Check the results of formula cells in the shared formula range.
    4192           0 :     for (SCROW i = 1; i <= 20; ++i)
    4193             :     {
    4194           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4195           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4196           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4197             :     }
    4198           0 :     xDocSh->DoClose();
    4199           0 :     xDocShRes->DoClose();
    4200             : }
    4201             : //[AMLOEXT-186]
    4202           2 : void ScOpenCLTest::testStatisticalFormulaSlope()
    4203             : {
    4204           2 :     if (!detectOpenCLDevice())
    4205           4 :         return;
    4206             : 
    4207           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Slope.", XLS);
    4208           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4209           0 :     enableOpenCL();
    4210           0 :     rDoc.CalcAll();
    4211             : 
    4212           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Slope.", XLS);
    4213           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4214             :     // Check the results of formula cells in the shared formula range.
    4215           0 :     for (SCROW i = 1; i <= 20; ++i)
    4216             :     {
    4217           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4218           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4219           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4220             :     }
    4221           0 :     xDocSh->DoClose();
    4222           0 :     xDocShRes->DoClose();
    4223             : }
    4224             : //[AMLOEXT-187]
    4225           2 : void ScOpenCLTest::testStatisticalFormulaSTEYX()
    4226             : {
    4227           2 :     if (!detectOpenCLDevice())
    4228           4 :         return;
    4229             : 
    4230           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/STEYX.", XLS);
    4231           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4232           0 :     enableOpenCL();
    4233           0 :     rDoc.CalcAll();
    4234             : 
    4235           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/STEYX.", XLS);
    4236           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4237             :     // Check the results of formula cells in the shared formula range.
    4238           0 :     for (SCROW i = 1; i <= 20; ++i)
    4239             :     {
    4240           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4241           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4242           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4243             :     }
    4244           0 :     xDocSh->DoClose();
    4245           0 :     xDocShRes->DoClose();
    4246             : }
    4247             : //[AMLOEXT-188]
    4248           2 : void ScOpenCLTest::testStatisticalFormulaZTest()
    4249             : {
    4250           2 :     if (!detectOpenCLDevice())
    4251           4 :         return;
    4252             : 
    4253           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/ZTest.", XLS);
    4254           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4255           0 :     enableOpenCL();
    4256           0 :     rDoc.CalcAll();
    4257             : 
    4258           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/ZTest.", XLS);
    4259           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4260             :     // Check the results of formula cells in the shared formula range.
    4261           0 :     for (SCROW i = 1; i <= 20; ++i)
    4262             :     {
    4263           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    4264           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    4265           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4266             :     }
    4267           0 :     xDocSh->DoClose();
    4268           0 :     xDocShRes->DoClose();
    4269             : }
    4270             : //[AMLOEXT-189]
    4271           2 : void ScOpenCLTest::testStatisticalFormulaTTest()
    4272             : {
    4273           2 :     if (!detectOpenCLDevice())
    4274           4 :         return;
    4275             : 
    4276           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/TTest.", XLS);
    4277           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4278           0 :     enableOpenCL();
    4279           0 :     rDoc.CalcAll();
    4280             : 
    4281           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/TTest.", XLS);
    4282           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4283             :     // Check the results of formula cells in the shared formula range.
    4284           0 :     for (SCROW i = 1; i <= 20; ++i)
    4285             :     {
    4286           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    4287           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    4288           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4289             :     }
    4290           0 :     xDocSh->DoClose();
    4291           0 :     xDocShRes->DoClose();
    4292             : }
    4293             : //[AMLOEXT-190]
    4294           2 : void ScOpenCLTest::testStatisticalFormulaTDist()
    4295             : {
    4296           2 :     if (!detectOpenCLDevice())
    4297           4 :         return;
    4298             : 
    4299           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/TDist.", XLS);
    4300           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4301           0 :     enableOpenCL();
    4302           0 :     rDoc.CalcAll();
    4303             : 
    4304           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/TDist.", XLS);
    4305           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4306             :     // Check the results of formula cells in the shared formula range.
    4307           0 :     for (SCROW i = 1; i <= 20; ++i)
    4308             :     {
    4309           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    4310           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    4311           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4312             :     }
    4313           0 :     xDocSh->DoClose();
    4314           0 :     xDocShRes->DoClose();
    4315             : }
    4316             : //[AMLOEXT-191]
    4317           2 : void ScOpenCLTest::testStatisticalFormulaTInv()
    4318             : {
    4319           2 :     if (!detectOpenCLDevice())
    4320           4 :         return;
    4321             : 
    4322           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/TInv.", XLS);
    4323           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4324           0 :     enableOpenCL();
    4325           0 :     rDoc.CalcAll();
    4326             : 
    4327           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/TInv.", XLS);
    4328           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4329             :     // Check the results of formula cells in the shared formula range.
    4330           0 :     for (SCROW i = 1; i <= 20; ++i)
    4331             :     {
    4332           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4333           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4334           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4335             :     }
    4336           0 :     xDocSh->DoClose();
    4337           0 :     xDocShRes->DoClose();
    4338             : }
    4339             : //[AMLOEXT-192]
    4340           2 : void ScOpenCLTest::testStatisticalFormulaBinomDist()
    4341             : {
    4342           2 :     if (!detectOpenCLDevice())
    4343           4 :         return;
    4344           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/BinomDist.", XLS);
    4345           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4346           0 :     enableOpenCL();
    4347           0 :     rDoc.CalcAll();
    4348           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/BinomDist.", XLS);
    4349           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4350             :     // Check the results of formula cells in the shared formula range.
    4351           0 :     for (SCROW i = 1; i <= 9; ++i)
    4352             :     {
    4353           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    4354           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    4355           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4356             :     }
    4357           0 :     xDocSh->DoClose();
    4358           0 :     xDocShRes->DoClose();
    4359             : }
    4360             : //[AMLOEXT-193]
    4361           2 : void ScOpenCLTest::testMathFormulaProduct()
    4362             : {
    4363           2 :     if (!detectOpenCLDevice())
    4364           4 :         return;
    4365           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/product.", XLS);
    4366           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4367           0 :     enableOpenCL();
    4368           0 :     rDoc.CalcAll();
    4369           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/product.", XLS);
    4370           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4371           0 :     for (SCROW i = 0; i <= 3; ++i)
    4372             :     {
    4373           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4374           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4375           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4376             :     }
    4377           0 :     xDocSh->DoClose();
    4378           0 :     xDocShRes->DoClose();
    4379             : }
    4380             : //[AMLOEXT-194]
    4381             : #if 0 //Disabled temporarily
    4382             : void ScOpenCLTest::testMathFormulaKombin()
    4383             : {
    4384             :     if (!detectOpenCLDevice())
    4385             :         return;
    4386             :     ScDocShellRef xDocSh = loadDoc("opencl/math/Kombin.", ODS);
    4387             :     ScDocument& rDoc = xDocSh->GetDocument();
    4388             :     enableOpenCL();
    4389             :     rDoc.CalcAll();
    4390             :     ScDocShellRef xDocShRes = loadDoc("opencl/math/Kombin.", ODS);
    4391             :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4392             :     // Verify Combin Function
    4393             :     for (SCROW i = 1; i <= 20; ++i)
    4394             :     {
    4395             :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4396             :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4397             :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4398             :     }
    4399             :     xDocSh->DoClose();
    4400             :     xDocShRes->DoClose();
    4401             : }
    4402             : #endif
    4403             : //[AMLOEXT-198]
    4404           2 : void ScOpenCLTest:: testArrayFormulaSumX2MY2()
    4405             : {
    4406           2 :     if (!detectOpenCLDevice())
    4407           4 :         return;
    4408           0 :     ScDocShellRef xDocSh = loadDoc("opencl/array/SUMX2MY2.", XLS);
    4409           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4410           0 :     enableOpenCL();
    4411           0 :     rDoc.CalcAll();
    4412           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/array/SUMX2MY2.", XLS);
    4413           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4414           0 :     for (SCROW i = 0; i <= 9; ++i)
    4415             :     {
    4416           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4417           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4418           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4419             :     }
    4420           0 :     for (SCROW i = 20; i <= 26; ++i)
    4421             :     {
    4422           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4423           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4424           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4425             :     }
    4426           0 :     xDocSh->DoClose();
    4427           0 :     xDocShRes->DoClose();
    4428             : }
    4429             : //[AMLOEXT-199]
    4430           2 : void ScOpenCLTest::testStatisticalFormulaHypGeomDist()
    4431             : {
    4432           2 :     if (!detectOpenCLDevice())
    4433           4 :         return;
    4434           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/HypGeomDist.", XLS);
    4435           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4436           0 :     enableOpenCL();
    4437           0 :     rDoc.CalcAll();
    4438           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/HypGeomDist.", XLS);
    4439           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4440             :     // Check the results of formula cells in the shared formula range.
    4441           0 :     for (SCROW i = 1; i <= 19; ++i)
    4442             :     {
    4443           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,0));
    4444           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
    4445           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4446             :     }
    4447           0 :     xDocSh->DoClose();
    4448           0 :     xDocShRes->DoClose();
    4449             : }
    4450             : //[AMLOEXT-200]
    4451           2 : void ScOpenCLTest:: testArrayFormulaSumX2PY2()
    4452             : {
    4453           2 :     if (!detectOpenCLDevice())
    4454           4 :         return;
    4455           0 :     ScDocShellRef xDocSh = loadDoc("opencl/array/SUMX2PY2.", XLS);
    4456           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4457           0 :     enableOpenCL();
    4458           0 :     rDoc.CalcAll();
    4459           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/array/SUMX2PY2.", XLS);
    4460           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4461           0 :     for (SCROW i = 0; i <= 9; ++i)
    4462             :     {
    4463           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4464           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4465           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4466             :     }
    4467           0 :     for (SCROW i = 20; i <= 26; ++i)
    4468             :     {
    4469           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4470           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4471           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4472             :     }
    4473           0 :     xDocSh->DoClose();
    4474           0 :     xDocShRes->DoClose();
    4475             : }
    4476             : //[AMLOEXT-201]
    4477           2 : void ScOpenCLTest::testStatisticalFormulaBetainv()
    4478             : {
    4479           2 :     if (!detectOpenCLDevice())
    4480           4 :         return;
    4481           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Betainv.", XLS);
    4482           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4483           0 :     enableOpenCL();
    4484           0 :     rDoc.CalcAll();
    4485           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Betainv.", XLS);
    4486           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4487             :     // Check the results of formula cells in the shared formula range.
    4488           0 :     for (SCROW i = 1; i <= 19; ++i)
    4489             :     {
    4490           0 :         double fLibre = rDoc.GetValue(ScAddress(5,i,0));
    4491           0 :         double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
    4492           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4493             :     }
    4494           0 :     xDocSh->DoClose();
    4495           0 :     xDocShRes->DoClose();
    4496             : }
    4497             : //[AMLOEXT-202]
    4498           2 : void ScOpenCLTest::testStatisticalFormulaMina()
    4499             : {
    4500           2 :     if (!detectOpenCLDevice())
    4501           4 :         return;
    4502           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Mina.", XLS);
    4503           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4504           0 :     enableOpenCL();
    4505           0 :     rDoc.CalcAll();
    4506           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Mina.", XLS);
    4507           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4508           0 :     for (SCROW i = 0; i <= 9; ++i)
    4509             :     {
    4510           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    4511           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    4512           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4513             :     }
    4514           0 :     xDocSh->DoClose();
    4515           0 :     xDocShRes->DoClose();
    4516             : }
    4517             : //[  AMLOEXT-204]
    4518           2 : void ScOpenCLTest:: testArrayFormulaSumXMY2()
    4519             : {
    4520           2 :     if (!detectOpenCLDevice())
    4521           4 :         return;
    4522           0 :     ScDocShellRef xDocSh = loadDoc("opencl/array/SUMXMY2.", XLS);
    4523           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4524           0 :     enableOpenCL();
    4525           0 :     rDoc.CalcAll();
    4526           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/array/SUMXMY2.", XLS);
    4527           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4528           0 :     for (SCROW i = 0; i <= 9; ++i)
    4529             :     {
    4530           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4531           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4532           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4533             :     }
    4534           0 :     for (SCROW i = 20; i <= 26; ++i)
    4535             :     {
    4536           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4537           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4538           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4539             :     }
    4540           0 :     xDocSh->DoClose();
    4541           0 :     xDocShRes->DoClose();
    4542             : }
    4543             : //AMLOEXT-208
    4544           2 : void ScOpenCLTest::testStatisticalFormulaCountA()
    4545             : {
    4546           2 :     if (!detectOpenCLDevice())
    4547           4 :         return;
    4548           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/counta.", XLS);
    4549           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4550           0 :     enableOpenCL();
    4551           0 :     rDoc.CalcAll();
    4552           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/counta.", XLS);
    4553           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4554           0 :     for (SCROW i = 0; i <= 9; ++i)
    4555             :     {
    4556           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    4557           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    4558           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4559             :     }
    4560           0 :     xDocSh->DoClose();
    4561           0 :     xDocShRes->DoClose();
    4562             : }
    4563             : 
    4564             : //[AMLOEXT-213]
    4565           2 : void ScOpenCLTest::testStatisticalFormulaMaxa()
    4566             : {
    4567           2 :     if (!detectOpenCLDevice())
    4568           4 :         return;
    4569           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Maxa.", XLS);
    4570           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4571           0 :     enableOpenCL();
    4572           0 :     rDoc.CalcAll();
    4573           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Maxa.", XLS);
    4574           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4575           0 :     for (SCROW i = 0; i <= 9; ++i)
    4576             :     {
    4577           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    4578           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    4579           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4580             :     }
    4581           0 :     xDocSh->DoClose();
    4582           0 :     xDocShRes->DoClose();
    4583             : }
    4584             : 
    4585             : //[AMLOEXT-214]
    4586           2 : void ScOpenCLTest::testMathFormulaSumProduct()
    4587             : {
    4588           2 :     if (!detectOpenCLDevice())
    4589           4 :         return;
    4590           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sumproduct_mixSliding.", XLS);
    4591           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4592           0 :     enableOpenCL();
    4593           0 :     rDoc.CalcAll();
    4594           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sumproduct_mixSliding.", XLS);
    4595           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4596             :     // Check the results of formula cells in the shared formula range.
    4597           0 :     for (SCROW i = 0; i <= 9; ++i)
    4598             :     {
    4599           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    4600           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    4601           0 :         if ( i == 1 )
    4602           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(82,  fLibre, fabs(0.0001*fExcel));
    4603           0 :         else if ( i == 2 )
    4604           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(113, fLibre, fabs(0.0001*fExcel));
    4605           0 :         else if ( i == 4 )
    4606           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(175, fLibre, fabs(0.0001*fExcel));
    4607           0 :         else if ( i == 5 )
    4608           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(206, fLibre, fabs(0.0001*fExcel));
    4609           0 :         else if ( i == 6 )
    4610           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(237, fLibre, fabs(0.0001*fExcel));
    4611           0 :         else if ( i == 7 )
    4612           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(268, fLibre, fabs(0.0001*fExcel));
    4613             :         else
    4614           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4615             :     }
    4616           0 :     xDocSh->DoClose();
    4617           0 :     xDocShRes->DoClose();
    4618             : }
    4619             : //[AMLOEXT-215]
    4620           2 : void ScOpenCLTest::testMathFormulaAverageIf()
    4621             : {
    4622           2 :     if (!detectOpenCLDevice())
    4623           4 :         return;
    4624           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/averageif.", XLS);
    4625           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4626           0 :     enableOpenCL();
    4627           0 :     rDoc.CalcAll();
    4628           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/averageif.", XLS);
    4629           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4630           0 :     for (SCROW i = 2; i <= 21; ++i)
    4631             :     {
    4632           0 :         double fLibre = rDoc.GetValue(ScAddress(6,i,0));
    4633           0 :         double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
    4634           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4635             :     }
    4636           0 :     xDocSh->DoClose();
    4637           0 :     xDocShRes->DoClose();
    4638             : }
    4639             : //[AMLOEXT-216]
    4640           2 : void ScOpenCLTest::testStatisticalFormulaAverageA()
    4641             : {
    4642           2 :     if (!detectOpenCLDevice())
    4643           4 :         return;
    4644           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/AverageA.", XLS);
    4645           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4646           0 :     enableOpenCL();
    4647           0 :     rDoc.CalcAll();
    4648           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/AverageA.", XLS);
    4649           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4650           0 :     for (SCROW i = 0; i <= 9; ++i)
    4651             :     {
    4652           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    4653           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    4654           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4655             :     }
    4656           0 :     xDocSh->DoClose();
    4657           0 :     xDocShRes->DoClose();
    4658             : }
    4659             : //[AMLOEXT-217]
    4660           2 : void ScOpenCLTest:: testLogicalFormulaAnd()
    4661             : {
    4662           2 :     if (!detectOpenCLDevice())
    4663           4 :         return;
    4664           0 :     ScDocShellRef xDocSh = loadDoc("opencl/logical/and.", XLS);
    4665           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4666           0 :     enableOpenCL();
    4667           0 :     rDoc.CalcAll();
    4668           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/logical/and.", XLS);
    4669           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4670           0 :     for (SCROW i = 1; i <= 20; ++i)
    4671             :     {
    4672           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4673           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4674           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4675             :     }
    4676           0 :     for (SCROW i = 1; i <= 20; ++i)
    4677             :     {
    4678           0 :         double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
    4679           0 :         double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
    4680           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4681             :     }
    4682           0 :     xDocSh->DoClose();
    4683           0 :     xDocShRes->DoClose();
    4684             : }
    4685             : //[AMLOEXT-218]
    4686           2 : void ScOpenCLTest::testStatisticalFormulaVarA()
    4687             : {
    4688           2 :     if (!detectOpenCLDevice())
    4689           4 :         return;
    4690             : 
    4691           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarA.", XLS);
    4692           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4693           0 :     enableOpenCL();
    4694           0 :     rDoc.CalcAll();
    4695             : 
    4696           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarA.", XLS);
    4697           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4698             :     // Check the results of formula cells in the shared formula range.
    4699           0 :     for (SCROW i = 1; i <= 20; ++i)
    4700             :     {
    4701           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4702           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4703           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4704             :     }
    4705           0 :     xDocSh->DoClose();
    4706           0 :     xDocShRes->DoClose();
    4707             : }
    4708             : //[AMLOEXT-219]
    4709           2 : void ScOpenCLTest::testStatisticalFormulaVarPA()
    4710             : {
    4711           2 :     if (!detectOpenCLDevice())
    4712           4 :         return;
    4713             : 
    4714           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarPA.", XLS);
    4715           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4716           0 :     enableOpenCL();
    4717           0 :     rDoc.CalcAll();
    4718             : 
    4719           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarPA.", XLS);
    4720           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4721             :     // Check the results of formula cells in the shared formula range.
    4722           0 :     for (SCROW i = 1; i <= 20; ++i)
    4723             :     {
    4724           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4725           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4726           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4727             :     }
    4728           0 :     xDocSh->DoClose();
    4729           0 :     xDocShRes->DoClose();
    4730             : }
    4731             : //[AMLOEXT-220]
    4732           2 : void ScOpenCLTest::testStatisticalFormulaStDevA()
    4733             : {
    4734           2 :     if (!detectOpenCLDevice())
    4735           4 :         return;
    4736             : 
    4737           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevA.", XLS);
    4738           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4739           0 :     enableOpenCL();
    4740           0 :     rDoc.CalcAll();
    4741             : 
    4742           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevA.", XLS);
    4743           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4744             :     // Check the results of formula cells in the shared formula range.
    4745           0 :     for (SCROW i = 1; i <= 20; ++i)
    4746             :     {
    4747           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4748           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4749           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4750             :     }
    4751           0 :     xDocSh->DoClose();
    4752           0 :     xDocShRes->DoClose();
    4753             : }
    4754             : //[AMLOEXT-221]
    4755           2 : void ScOpenCLTest::testStatisticalFormulaStDevPA()
    4756             : {
    4757           2 :     if (!detectOpenCLDevice())
    4758           4 :         return;
    4759             : 
    4760           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevPA.", XLS);
    4761           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4762           0 :     enableOpenCL();
    4763           0 :     rDoc.CalcAll();
    4764             : 
    4765           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevPA.", XLS);
    4766           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4767             :     // Check the results of formula cells in the shared formula range.
    4768           0 :     for (SCROW i = 1; i <= 20; ++i)
    4769             :     {
    4770           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    4771           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    4772           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4773             :     }
    4774           0 :     xDocSh->DoClose();
    4775           0 :     xDocShRes->DoClose();
    4776             : }
    4777             : //[AMLOEXT-223]
    4778           2 : void ScOpenCLTest:: testFinancialMDurationFormula1()
    4779             : {
    4780           2 :     if (!detectOpenCLDevice())
    4781           4 :         return;
    4782           0 :     ScDocShellRef xDocSh = loadDoc("opencl/financial/MDuration1.", XLS);
    4783           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4784           0 :     enableOpenCL();
    4785           0 :     rDoc.CalcAll();
    4786           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/financial/MDuration1.", XLS);
    4787           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4788           0 :     for (SCROW i = 0; i <= 9; ++i)
    4789             :     {
    4790           0 :         double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
    4791           0 :         double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
    4792           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel,fLibre,fabs(0.00000000001*fExcel));
    4793             :     }
    4794           0 :     xDocSh->DoClose();
    4795           0 :     xDocShRes->DoClose();
    4796             : }
    4797             : //[AMLOEXT-245]
    4798           2 : void ScOpenCLTest::testMathFormulaSumProduct2()
    4799             : {
    4800           2 :     if (!detectOpenCLDevice())
    4801           4 :         return;
    4802           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sumproductTest.", XLS);
    4803           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4804           0 :     enableOpenCL();
    4805           0 :     rDoc.CalcAll();
    4806           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sumproductTest.", XLS);
    4807           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4808             :     // Check the results of formula cells in the shared formula range.
    4809           0 :     for (SCROW i = 2; i <= 12; ++i)
    4810             :     {
    4811           0 :         double fLibre = rDoc.GetValue(ScAddress(4,i,1));
    4812           0 :         double fExcel = rDocRes.GetValue(ScAddress(4,i,1));
    4813           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel,  fLibre, fabs(0.0001*fExcel));
    4814             :     }
    4815           0 :     xDocSh->DoClose();
    4816           0 :     xDocShRes->DoClose();
    4817             : }
    4818             : 
    4819             : //[AMLOEXT-243]
    4820           2 : void ScOpenCLTest:: testStatisticalParallelCountBug()
    4821             : {
    4822           2 :     if (!detectOpenCLDevice())
    4823           4 :         return;
    4824             :     ScDocShellRef xDocSh =
    4825           0 :         loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
    4826           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4827           0 :     enableOpenCL();
    4828           0 :     rDoc.CalcAll();
    4829             :     ScDocShellRef xDocShRes =
    4830           0 :         loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
    4831           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4832           0 :     for (SCROW i = 0; i < 13; ++i)
    4833             :     {
    4834           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4835           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4836           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4837             :     }
    4838           0 :     xDocSh->DoClose();
    4839           0 :     xDocShRes->DoClose();
    4840             : }
    4841             : //[AMLOEXT-264]
    4842           2 : void ScOpenCLTest:: testLogicalFormulaOr()
    4843             : {
    4844           2 :     if (!detectOpenCLDevice())
    4845           4 :         return;
    4846           0 :     ScDocShellRef xDocSh = loadDoc("opencl/logical/or.", XLS);
    4847           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4848           0 :     enableOpenCL();
    4849           0 :     rDoc.CalcAll();
    4850           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/logical/or.", XLS);
    4851           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4852           0 :     for (SCROW i = 0; i < 20; ++i)
    4853             :     {
    4854           0 :         double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
    4855           0 :         double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
    4856           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4857             :     }
    4858           0 :     xDocSh->DoClose();
    4859           0 :     xDocShRes->DoClose();
    4860             : }
    4861             : //[AMLOEXT-267]
    4862           2 : void ScOpenCLTest:: testLogicalFormulaNot()
    4863             : {
    4864           2 :     if (!detectOpenCLDevice())
    4865           4 :         return;
    4866           0 :     ScDocShellRef xDocSh = loadDoc("opencl/logical/not.", XLS);
    4867           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4868           0 :     enableOpenCL();
    4869           0 :     rDoc.CalcAll();
    4870           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/logical/not.", XLS);
    4871           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4872           0 :     for (SCROW i = 0; i < 3000; ++i)
    4873             :     {
    4874           0 :         double fLibre = rDoc.GetValue(ScAddress(1, i, 0));
    4875           0 :         double fExcel = rDocRes.GetValue(ScAddress(1, i, 0));
    4876           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4877             :     }
    4878           0 :     xDocSh->DoClose();
    4879           0 :     xDocShRes->DoClose();
    4880             : }
    4881             : //[AMLOEXT-272]
    4882           2 : void ScOpenCLTest:: testLogicalFormulaXor()
    4883             : {
    4884           2 :     if (!detectOpenCLDevice())
    4885           4 :         return;
    4886           0 :     ScDocShellRef xDocSh = loadDoc("opencl/logical/xor.", XLS);
    4887           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4888           0 :     enableOpenCL();
    4889           0 :     rDoc.CalcAll();
    4890           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/logical/xor.", XLS);
    4891           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4892           0 :     for (SCROW i = 0; i < 3000; ++i)
    4893             :     {
    4894           0 :         double fLibre = rDoc.GetValue(ScAddress(1, i, 0));
    4895           0 :         double fExcel = rDocRes.GetValue(ScAddress(1, i, 0));
    4896           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    4897             :     }
    4898           0 :     xDocSh->DoClose();
    4899           0 :     xDocShRes->DoClose();
    4900             : }
    4901             : //[AMLOEXT-333]
    4902           2 : void ScOpenCLTest::testDatabaseFormulaDcount()
    4903             : {
    4904           2 :     if (!detectOpenCLDevice())
    4905           4 :         return;
    4906           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dcount.", XLS);
    4907           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4908           0 :     enableOpenCL();
    4909           0 :     rDoc.CalcAll();
    4910           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dcount.", XLS);
    4911           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4912             :     // Check the results of formula cells in the shared formula range.
    4913           0 :     for (SCROW i = 1; i <= 32; ++i)
    4914             :     {
    4915           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    4916           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    4917           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    4918             :     }
    4919           0 :     xDocSh->DoClose();
    4920           0 :     xDocShRes->DoClose();
    4921             : }
    4922             : //[AMLOEXT-334]
    4923           2 : void ScOpenCLTest::testDatabaseFormulaDcountA()
    4924             : {
    4925           2 :     if (!detectOpenCLDevice())
    4926           4 :         return;
    4927           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dcountA.", XLS);
    4928           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4929           0 :     enableOpenCL();
    4930           0 :     rDoc.CalcAll();
    4931           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dcountA.", XLS);
    4932           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4933             :     // Check the results of formula cells in the shared formula range.
    4934           0 :     for (SCROW i = 1; i <= 32; ++i)
    4935             :     {
    4936           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    4937           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    4938           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    4939             :     }
    4940           0 :     xDocSh->DoClose();
    4941           0 :     xDocShRes->DoClose();
    4942             : }
    4943             : //[AMLOEXT-335]
    4944           2 : void ScOpenCLTest::testDatabaseFormulaDmax()
    4945             : {
    4946           2 :     if (!detectOpenCLDevice())
    4947           4 :         return;
    4948           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dmax.", XLS);
    4949           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4950           0 :     enableOpenCL();
    4951           0 :     rDoc.CalcAll();
    4952           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dmax.", XLS);
    4953           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4954             :     // Check the results of formula cells in the shared formula range.
    4955           0 :     for (SCROW i = 1; i <= 32; ++i)
    4956             :     {
    4957           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    4958           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    4959           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    4960             :     }
    4961           0 :     xDocSh->DoClose();
    4962           0 :     xDocShRes->DoClose();
    4963             : }
    4964             : 
    4965             : //[AMLOEXT-336]
    4966           2 : void ScOpenCLTest::testDatabaseFormulaDmin()
    4967             : {
    4968           2 :     if (!detectOpenCLDevice())
    4969           4 :         return;
    4970           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dmin.", XLS);
    4971           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4972           0 :     enableOpenCL();
    4973           0 :     rDoc.CalcAll();
    4974           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dmin.", XLS);
    4975           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4976             :     // Check the results of formula cells in the shared formula range.
    4977           0 :     for (SCROW i = 1; i <= 32; ++i)
    4978             :     {
    4979           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    4980           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    4981           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    4982             :     }
    4983           0 :     xDocSh->DoClose();
    4984           0 :     xDocShRes->DoClose();
    4985             : }
    4986             : 
    4987             : //[AMLOEXT-337]
    4988           2 : void ScOpenCLTest::testDatabaseFormulaDproduct()
    4989             : {
    4990           2 :     if (!detectOpenCLDevice())
    4991           4 :         return;
    4992           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dproduct.", XLS);
    4993           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    4994           0 :     enableOpenCL();
    4995           0 :     rDoc.CalcAll();
    4996           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dproduct.", XLS);
    4997           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    4998             :     // Check the results of formula cells in the shared formula range.
    4999           0 :     for (SCROW i = 1; i <= 32; ++i)
    5000             :     {
    5001           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    5002           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    5003           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    5004             :     }
    5005           0 :     xDocSh->DoClose();
    5006           0 :     xDocShRes->DoClose();
    5007             : }
    5008             : 
    5009             : //[AMLOEXT-338]
    5010           2 : void ScOpenCLTest::testDatabaseFormulaDaverage()
    5011             : {
    5012           2 :     if (!detectOpenCLDevice())
    5013           4 :         return;
    5014           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/daverage.", XLS);
    5015           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5016           0 :     enableOpenCL();
    5017           0 :     rDoc.CalcAll();
    5018           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/daverage.", XLS);
    5019           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5020             :     // Check the results of formula cells in the shared formula range.
    5021           0 :     for (SCROW i = 1; i <= 32; ++i)
    5022             :     {
    5023           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    5024           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    5025             :         //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5026           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    5027             :     }
    5028           0 :     xDocSh->DoClose();
    5029           0 :     xDocShRes->DoClose();
    5030             : }
    5031             : 
    5032             : //[AMLOEXT-339]
    5033           2 : void ScOpenCLTest::testDatabaseFormulaDstdev()
    5034             : {
    5035           2 :     if (!detectOpenCLDevice())
    5036           4 :         return;
    5037           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dstdev.", XLS);
    5038           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5039           0 :     enableOpenCL();
    5040           0 :     rDoc.CalcAll();
    5041           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dstdev.", XLS);
    5042           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5043             :     // Check the results of formula cells in the shared formula range.
    5044           0 :     for (SCROW i = 1; i <= 32; ++i)
    5045             :     {
    5046           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    5047           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    5048             :         //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5049           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    5050             :     }
    5051           0 :     xDocSh->DoClose();
    5052           0 :     xDocShRes->DoClose();
    5053             : }
    5054             : 
    5055             : //[AMLOEXT-340]
    5056           2 : void ScOpenCLTest::testDatabaseFormulaDstdevp()
    5057             : {
    5058           2 :     if (!detectOpenCLDevice())
    5059           4 :         return;
    5060           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dstdevp.", XLS);
    5061           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5062           0 :     enableOpenCL();
    5063           0 :     rDoc.CalcAll();
    5064           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dstdevp.", XLS);
    5065           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5066             :     // Check the results of formula cells in the shared formula range.
    5067           0 :     for (SCROW i = 1; i <= 32; ++i)
    5068             :     {
    5069           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    5070           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    5071             :         //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5072           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    5073             :     }
    5074           0 :     xDocSh->DoClose();
    5075           0 :     xDocShRes->DoClose();
    5076             : }
    5077             : 
    5078             : //[AMLOEXT-341]
    5079           2 : void ScOpenCLTest::testDatabaseFormulaDsum()
    5080             : {
    5081           2 :     if (!detectOpenCLDevice())
    5082           4 :         return;
    5083           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dsum.", XLS);
    5084           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5085           0 :     enableOpenCL();
    5086           0 :     rDoc.CalcAll();
    5087           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dsum.", XLS);
    5088           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5089             :     // Check the results of formula cells in the shared formula range.
    5090           0 :     for (SCROW i = 1; i <= 32; ++i)
    5091             :     {
    5092           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    5093           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    5094             :         //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5095           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    5096             :     }
    5097           0 :     xDocSh->DoClose();
    5098           0 :     xDocShRes->DoClose();
    5099             : }
    5100             : 
    5101             : //[AMLOEXT-342]
    5102           2 : void ScOpenCLTest::testDatabaseFormulaDvar()
    5103             : {
    5104           2 :     if (!detectOpenCLDevice())
    5105           4 :         return;
    5106           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dvar.", XLS);
    5107           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5108           0 :     enableOpenCL();
    5109           0 :     rDoc.CalcAll();
    5110           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dvar.", XLS);
    5111           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5112             :     // Check the results of formula cells in the shared formula range.
    5113           0 :     for (SCROW i = 1; i <= 32; ++i)
    5114             :     {
    5115           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    5116           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    5117             :         //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5118           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    5119             :     }
    5120           0 :     xDocSh->DoClose();
    5121           0 :     xDocShRes->DoClose();
    5122             : }
    5123             : 
    5124             : //[AMLOEXT-343]
    5125           2 : void ScOpenCLTest::testDatabaseFormulaDvarp()
    5126             : {
    5127           2 :     if (!detectOpenCLDevice())
    5128           4 :         return;
    5129           0 :     ScDocShellRef xDocSh = loadDoc("opencl/database/dvarp.", XLS);
    5130           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5131           0 :     enableOpenCL();
    5132           0 :     rDoc.CalcAll();
    5133           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/database/dvarp.", XLS);
    5134           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5135             :     // Check the results of formula cells in the shared formula range.
    5136           0 :     for (SCROW i = 1; i <= 32; ++i)
    5137             :     {
    5138           0 :         double fLibre = rDoc.GetValue(ScAddress(9,i,0));
    5139           0 :         double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
    5140           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
    5141             :     }
    5142           0 :     xDocSh->DoClose();
    5143           0 :     xDocShRes->DoClose();
    5144             : }
    5145             : //[AMLOEXT-351]
    5146           2 : void ScOpenCLTest::testMathFormulaRoundUp()
    5147             : {
    5148           2 :     if (!detectOpenCLDevice())
    5149           4 :         return;
    5150           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/roundup.", XLS);
    5151           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5152           0 :     enableOpenCL();
    5153           0 :     rDoc.CalcAll();
    5154           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/roundup.", XLS);
    5155           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5156             :     // Check the results of formula cells in the shared formula range.
    5157           0 :     for (SCROW i = 1; i <= 9; ++i)
    5158             :     {
    5159           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5160           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5161           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5162             :     }
    5163           0 :     xDocSh->DoClose();
    5164           0 :     xDocShRes->DoClose();
    5165             : }
    5166             : //[ AMLOEXT-352]
    5167           2 : void ScOpenCLTest::testMathFormulaRoundDown()
    5168             : {
    5169           2 :     if (!detectOpenCLDevice())
    5170           4 :         return;
    5171           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/rounddown.", XLS);
    5172           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5173           0 :     enableOpenCL();
    5174           0 :     rDoc.CalcAll();
    5175           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/rounddown.", XLS);
    5176           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5177             :     // Check the results of formula cells in the shared formula range.
    5178           0 :     for (SCROW i = 1; i <= 9; ++i)
    5179             :     {
    5180           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5181           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5182           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5183             :     }
    5184           0 :     xDocSh->DoClose();
    5185           0 :     xDocShRes->DoClose();
    5186             : }
    5187             : //[ AMLOEXT-353]
    5188           2 : void ScOpenCLTest::testMathFormulaInt()
    5189             : {
    5190           2 :     if (!detectOpenCLDevice())
    5191           4 :         return;
    5192           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/int.", XLS);
    5193           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5194           0 :     enableOpenCL();
    5195           0 :     rDoc.CalcAll();
    5196           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/int.", XLS);
    5197           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5198             :     // Check the results of formula cells in the shared formula range.
    5199           0 :     for (SCROW i = 1; i <= 9; ++i)
    5200             :     {
    5201           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5202           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5203           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5204             :     }
    5205           0 :     xDocSh->DoClose();
    5206           0 :     xDocShRes->DoClose();
    5207             : }
    5208             : //[ AMLOEXT-354]
    5209           2 : void ScOpenCLTest::testMathFormulaRadians()
    5210             : {
    5211           2 :     if (!detectOpenCLDevice())
    5212           4 :         return;
    5213           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/radians.", XLS);
    5214           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5215           0 :     enableOpenCL();
    5216           0 :     rDoc.CalcAll();
    5217           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/radians.", XLS);
    5218           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5219             :     // Check the results of formula cells in the shared formula range.
    5220           0 :     for (SCROW i = 1; i <= 9; ++i)
    5221             :     {
    5222           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5223           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5224           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5225             :     }
    5226           0 :     xDocSh->DoClose();
    5227           0 :     xDocShRes->DoClose();
    5228             : }
    5229             : //AMLOEXT-356
    5230           2 : void ScOpenCLTest::testMathFormulaDegrees()
    5231             : {
    5232           2 :     if (!detectOpenCLDevice())
    5233           4 :             return;
    5234           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/degrees.", XLS);
    5235           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5236           0 :     enableOpenCL();
    5237           0 :     rDoc.CalcAll();
    5238           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/degrees.", XLS);
    5239           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5240           0 :     for (SCROW i = 0; i <= 200; ++i)
    5241             :     {
    5242           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5243           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5244           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5245             :     }
    5246           0 :     xDocSh->DoClose();
    5247           0 :     xDocShRes->DoClose();
    5248             : }
    5249             : //[ AMLOEXT-357]
    5250           2 : void ScOpenCLTest::testMathFormulaIsEven()
    5251             : {
    5252           2 :     if (!detectOpenCLDevice())
    5253           4 :         return;
    5254           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/iseven.", XLS);
    5255           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5256           0 :     enableOpenCL();
    5257           0 :     rDoc.CalcAll();
    5258           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/iseven.", XLS);
    5259           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5260             :     // Check the results of formula cells in the shared formula range.
    5261           0 :     for (SCROW i = 1; i <= 9; ++i)
    5262             :     {
    5263           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5264           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5265           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5266             :     }
    5267           0 :     xDocSh->DoClose();
    5268           0 :     xDocShRes->DoClose();
    5269             : }
    5270             : //[AMLOEXT-360]
    5271           2 : void ScOpenCLTest::testMathFormulaCountIf()
    5272             : {
    5273           2 :     if (!detectOpenCLDevice())
    5274           4 :             return;
    5275           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/countif.", XLS);
    5276           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5277           0 :     enableOpenCL();
    5278           0 :     rDoc.CalcAll();
    5279           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/countif.", XLS);
    5280           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5281           0 :     for (SCROW i = 0; i <= 26; ++i)
    5282             :     {
    5283           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5284           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5285           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5286             :     }
    5287           0 :     xDocSh->DoClose();
    5288           0 :     xDocShRes->DoClose();
    5289             : }
    5290             : //[ AMLOEXT-361]
    5291           2 : void ScOpenCLTest::testMathFormulaIsOdd()
    5292             : {
    5293           2 :     if (!detectOpenCLDevice())
    5294           4 :         return;
    5295           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/isodd.", XLS);
    5296           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5297           0 :     enableOpenCL();
    5298           0 :     rDoc.CalcAll();
    5299           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/isodd.", XLS);
    5300           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5301             :     // Check the results of formula cells in the shared formula range.
    5302           0 :     for (SCROW i = 1; i <= 9; ++i)
    5303             :     {
    5304           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5305           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5306           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5307             :     }
    5308           0 :     xDocSh->DoClose();
    5309           0 :     xDocShRes->DoClose();
    5310             : }
    5311             : //[AMLOEXT-362]
    5312           2 : void ScOpenCLTest::testMathFormulaFact()
    5313             : {
    5314           2 :     if (!detectOpenCLDevice())
    5315           4 :         return;
    5316           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/fact.", XLS);
    5317           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5318           0 :     enableOpenCL();
    5319           0 :     rDoc.CalcAll();
    5320           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/fact.", XLS);
    5321           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5322           0 :     for (SCROW i = 0; i <= 18; ++i)
    5323             :     {
    5324           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5325           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5326           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5327             :     }
    5328           0 :     xDocSh->DoClose();
    5329           0 :     xDocShRes->DoClose();
    5330             : }
    5331             : //AMLOEXT-367
    5332           2 : void ScOpenCLTest::testMathFormulaSEC()
    5333             : {
    5334           2 :     if (!detectOpenCLDevice())
    5335           4 :         return;
    5336             : 
    5337           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sec.", ODS);
    5338           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5339           0 :     enableOpenCL();
    5340           0 :     rDoc.CalcAll();
    5341           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sec.", ODS);
    5342           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5343           0 :     for (SCROW i = 0; i <= 15; ++i)
    5344             :     {
    5345           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5346           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5347           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5348             :     }
    5349           0 :     xDocSh->DoClose();
    5350           0 :     xDocShRes->DoClose();
    5351             : }
    5352             : //AMLOEXT-368
    5353           2 : void ScOpenCLTest::testMathFormulaSECH()
    5354             : {
    5355           2 :     if (!detectOpenCLDevice())
    5356           4 :         return;
    5357             : 
    5358           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sech.", ODS);
    5359           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5360           0 :     enableOpenCL();
    5361           0 :     rDoc.CalcAll();
    5362           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sech.", ODS);
    5363           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5364           0 :     for (SCROW i = 0; i <= 15; ++i)
    5365             :     {
    5366           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5367           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5368           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5369             :     }
    5370           0 :     xDocSh->DoClose();
    5371           0 :     xDocShRes->DoClose();
    5372             : }
    5373             : //AMLOEXT-369
    5374           2 : void ScOpenCLTest::testMathFormulaMROUND()
    5375             : {
    5376           2 :     if (!detectOpenCLDevice())
    5377           4 :         return;
    5378             : 
    5379           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/MROUND.", XLS);
    5380           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5381           0 :     enableOpenCL();
    5382           0 :     rDoc.CalcAll();
    5383           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/MROUND.", XLS);
    5384           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5385           0 :     for (SCROW i = 0; i <= 13; ++i)
    5386             :     {
    5387           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    5388           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    5389           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5390             :     }
    5391           0 :     xDocSh->DoClose();
    5392           0 :     xDocShRes->DoClose();
    5393             : }
    5394             : //[AMLOEXT-372]
    5395           2 : void ScOpenCLTest::testMathFormulaQuotient()
    5396             : {
    5397           2 :     if (!detectOpenCLDevice())
    5398           4 :         return;
    5399           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/Quotient.", ODS);
    5400           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5401           0 :     enableOpenCL();
    5402           0 :     rDoc.CalcAll();
    5403           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/Quotient.", ODS);
    5404           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5405             :     // Verify BitAnd Function
    5406           0 :     for (SCROW i = 1; i <= 20; ++i)
    5407             :     {
    5408           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    5409           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    5410           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5411             :     }
    5412           0 :     xDocSh->DoClose();
    5413           0 :     xDocShRes->DoClose();
    5414             : }
    5415             : //[AMLOEXT-373]
    5416           2 : void ScOpenCLTest::testMathFormulaSeriesSum()
    5417             : {
    5418           2 :     if (!detectOpenCLDevice())
    5419           4 :             return;
    5420           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/seriessum.", XLS);
    5421           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5422           0 :     enableOpenCL();
    5423           0 :     rDoc.CalcAll();
    5424           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/seriessum.", XLS);
    5425           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5426           0 :     for (SCROW i = 0; i <= 15; ++i)
    5427             :     {
    5428           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5429           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5430           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5431             :     }
    5432           0 :     xDocSh->DoClose();
    5433           0 :     xDocShRes->DoClose();
    5434             : }
    5435             : //[AMLOEXT-377]
    5436           2 : void ScOpenCLTest::testMathFormulaSumIf()
    5437             : {
    5438           2 :     if (!detectOpenCLDevice())
    5439           4 :             return;
    5440           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/sumif.", XLS);
    5441           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5442           0 :     enableOpenCL();
    5443           0 :     rDoc.CalcAll();
    5444           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/sumif.", XLS);
    5445           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5446           0 :     for (SCROW i = 0; i <= 26; ++i)
    5447             :     {
    5448           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    5449           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    5450           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5451             :     }
    5452           0 :     xDocSh->DoClose();
    5453           0 :     xDocShRes->DoClose();
    5454             : }
    5455             : //[AMLOEXT-378]
    5456           2 : void ScOpenCLTest::testAddInFormulaBesseLJ()
    5457             : {
    5458           2 :     if (!detectOpenCLDevice())
    5459           4 :         return;
    5460             : 
    5461           0 :     ScDocShellRef xDocSh = loadDoc("opencl/addin/besselj.", XLS);
    5462           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5463           0 :     enableOpenCL();
    5464           0 :     rDoc.CalcAll();
    5465             : 
    5466           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/addin/besselj.", XLS);
    5467           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5468             :     // Check the results of formula cells in the shared formula range.
    5469           0 :     for (SCROW i = 1; i <= 20; ++i)
    5470             :     {
    5471           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    5472           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    5473           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5474             :     }
    5475           0 :     xDocSh->DoClose();
    5476           0 :     xDocShRes->DoClose();
    5477             : }
    5478             : //AMLOEXT-379
    5479           2 : void ScOpenCLTest::testStatisticalFormulaAvedev()
    5480             : {
    5481           2 :     if (!detectOpenCLDevice())
    5482           4 :         return;
    5483             : 
    5484           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Avedev.", XLS);
    5485           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5486           0 :     enableOpenCL();
    5487           0 :     rDoc.CalcAll();
    5488           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Avedev.", XLS);
    5489           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5490             :     // Check the results of formula cells in the shared formula range.
    5491           0 :     for (SCROW i = 1; i <= 19; ++i)
    5492             :     {
    5493           0 :         double fLibre = rDoc.GetValue(ScAddress(3,i,0));
    5494           0 :         double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
    5495           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5496             :     }
    5497           0 :     xDocSh->DoClose();
    5498           0 :     xDocShRes->DoClose();
    5499             : }
    5500             : 
    5501             : //[AMLOEXT-383]
    5502           2 : void ScOpenCLTest::testNegSub()
    5503             : {
    5504           2 :     if (!detectOpenCLDevice())
    5505           4 :         return;
    5506             : 
    5507           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/NegSub.", XLS);
    5508           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5509           0 :     enableOpenCL();
    5510           0 :     rDoc.CalcAll();
    5511             : 
    5512           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/NegSub.", XLS);
    5513           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5514             :     // Check the results of formula cells in the shared formula range.
    5515           0 :     for (SCROW i = 0; i <= 9; ++i)
    5516             :     {
    5517           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5518           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5519           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5520             :     }
    5521           0 :     xDocSh->DoClose();
    5522           0 :     xDocShRes->DoClose();
    5523             : }
    5524             : //[AMLOEXT-386]
    5525           2 : void ScOpenCLTest::testMathFormulaAverageIf_Mix()
    5526             : {
    5527           2 :     if (!detectOpenCLDevice())
    5528           4 :         return;
    5529           0 :     ScDocShellRef xDocSh = loadDoc("opencl/math/averageif_mix.", XLS);
    5530           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5531           0 :     enableOpenCL();
    5532           0 :     rDoc.CalcAll();
    5533           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/math/averageif_mix.", XLS);
    5534           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5535           0 :     for (SCROW i = 0; i <= 9; ++i)
    5536             :     {
    5537           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    5538           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    5539           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5540             :     }
    5541           0 :     xDocSh->DoClose();
    5542           0 :     xDocShRes->DoClose();
    5543             : }
    5544             : //[AMLOEXT-387]
    5545           2 : void ScOpenCLTest::testStatisticalFormulaKurt1()
    5546             : {
    5547           2 :     if (!detectOpenCLDevice())
    5548           4 :         return;
    5549           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/Kurt1.", XLS);
    5550           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5551           0 :     enableOpenCL();
    5552           0 :     rDoc.CalcAll();
    5553           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Kurt1.", XLS);
    5554           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5555             :     // Check the results of formula cells in the shared formula range.
    5556           0 :     for (SCROW i = 1; i <= 19; ++i)
    5557             :     {
    5558           0 :         double fLibre = rDoc.GetValue(ScAddress(2,i,0));
    5559           0 :         double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
    5560           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5561             :     }
    5562           0 :     xDocSh->DoClose();
    5563           0 :     xDocShRes->DoClose();
    5564             : }
    5565             : //[AMLOEXT-401]
    5566           2 : void ScOpenCLTest::testStatisticalFormulaHarMean1()
    5567             : {
    5568           2 :     if (!detectOpenCLDevice())
    5569           4 :         return;
    5570           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/HarMean1.", XLS);
    5571           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5572           0 :     enableOpenCL();
    5573           0 :     rDoc.CalcAll();
    5574           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/HarMean1.", XLS);
    5575           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5576             :     // Check the results of formula cells in the shared formula range.
    5577           0 :     for (SCROW i = 1; i <= 19; ++i)
    5578             :     {
    5579           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5580           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5581           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5582             :     }
    5583           0 :     xDocSh->DoClose();
    5584           0 :     xDocShRes->DoClose();
    5585             : }
    5586             : //[AMLOEXT-402]
    5587           2 : void ScOpenCLTest::testStatisticalFormulaVarA1()
    5588             : {
    5589           2 :     if (!detectOpenCLDevice())
    5590           4 :         return;
    5591             : 
    5592           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarA1.", XLS);
    5593           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5594           0 :     enableOpenCL();
    5595           0 :     rDoc.CalcAll();
    5596             : 
    5597           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarA1.", XLS);
    5598           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5599             :     // Check the results of formula cells in the shared formula range.
    5600           0 :     for (SCROW i = 1; i <= 20; ++i)
    5601             :     {
    5602           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5603           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5604           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5605             :     }
    5606           0 :     xDocSh->DoClose();
    5607           0 :     xDocShRes->DoClose();
    5608             : }
    5609             : //[AMLOEXT-403]
    5610           2 : void ScOpenCLTest::testStatisticalFormulaVarPA1()
    5611             : {
    5612           2 :     if (!detectOpenCLDevice())
    5613           4 :         return;
    5614             : 
    5615           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/VarPA1.", XLS);
    5616           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5617           0 :     enableOpenCL();
    5618           0 :     rDoc.CalcAll();
    5619             : 
    5620           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/VarPA1.", XLS);
    5621           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5622             :     // Check the results of formula cells in the shared formula range.
    5623           0 :     for (SCROW i = 1; i <= 20; ++i)
    5624             :     {
    5625           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5626           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5627           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5628             :     }
    5629           0 :     xDocSh->DoClose();
    5630           0 :     xDocShRes->DoClose();
    5631             : }
    5632             : //[AMLOEXT-404]
    5633           2 : void ScOpenCLTest::testStatisticalFormulaStDevA1()
    5634             : {
    5635           2 :     if (!detectOpenCLDevice())
    5636           4 :         return;
    5637             : 
    5638           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevA1.", XLS);
    5639           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5640           0 :     enableOpenCL();
    5641           0 :     rDoc.CalcAll();
    5642             : 
    5643           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevA1.", XLS);
    5644           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5645             :     // Check the results of formula cells in the shared formula range.
    5646           0 :     for (SCROW i = 1; i <= 20; ++i)
    5647             :     {
    5648           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5649           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5650           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5651             :     }
    5652           0 :     xDocSh->DoClose();
    5653           0 :     xDocShRes->DoClose();
    5654             : }
    5655             : //[AMLOEXT-405]
    5656           2 : void ScOpenCLTest::testStatisticalFormulaStDevPA1()
    5657             : {
    5658           2 :     if (!detectOpenCLDevice())
    5659           4 :         return;
    5660             : 
    5661           0 :     ScDocShellRef xDocSh = loadDoc("opencl/statistical/StDevPA1.", XLS);
    5662           0 :     ScDocument& rDoc = xDocSh->GetDocument();
    5663           0 :     enableOpenCL();
    5664           0 :     rDoc.CalcAll();
    5665             : 
    5666           0 :     ScDocShellRef xDocShRes = loadDoc("opencl/statistical/StDevPA1.", XLS);
    5667           0 :     ScDocument& rDocRes = xDocShRes->GetDocument();
    5668             :     // Check the results of formula cells in the shared formula range.
    5669           0 :     for (SCROW i = 1; i <= 20; ++i)
    5670             :     {
    5671           0 :         double fLibre = rDoc.GetValue(ScAddress(1,i,0));
    5672           0 :         double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
    5673           0 :         CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
    5674             :     }
    5675           0 :     xDocSh->DoClose();
    5676           0 :     xDocShRes->DoClose();
    5677             : }
    5678         446 : ScOpenCLTest::ScOpenCLTest()
    5679         446 :       : ScBootstrapFixture( "/sc/qa/unit/data" )
    5680             : {
    5681         446 : }
    5682             : 
    5683         446 : void ScOpenCLTest::setUp()
    5684             : {
    5685         446 :     test::BootstrapFixture::setUp();
    5686             :     // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
    5687             :     // which is a private symbol to us, gets called
    5688         892 :     m_xCalcComponent =
    5689         892 :         getMultiServiceFactory()->
    5690         892 :             createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
    5691         446 :     CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is());
    5692         446 : }
    5693             : 
    5694         446 : void ScOpenCLTest::tearDown()
    5695             : {
    5696             :     uno::Reference< lang::XComponent >
    5697         446 :         ( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
    5698         446 :     test::BootstrapFixture::tearDown();
    5699         446 : }
    5700             : 
    5701           2 : CPPUNIT_TEST_SUITE_REGISTRATION(ScOpenCLTest);
    5702             : 
    5703           8 : CPPUNIT_PLUGIN_IMPLEMENT();
    5704             : 
    5705             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10