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

Generated by: LCOV version 1.10