Bump version to 5.0-14
[LibreOffice.git] / sc / qa / unit / opencl-test.cxx
blobaee109ea0ad94bf77fc83024e61841f20dedcb78
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is added by mcw.
4 */
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>
12 #include "scdll.hxx"
13 #include <opencl/platforminfo.hxx>
14 #include <sfx2/app.hxx>
15 #include <sfx2/docfilt.hxx>
16 #include <sfx2/docfile.hxx>
17 #include <sfx2/sfxmodelfactory.hxx>
18 #include <svl/stritem.hxx>
20 #include "helper/qahelper.hxx"
22 #include "calcconfig.hxx"
23 #include "interpre.hxx"
25 #include "docsh.hxx"
26 #include "postit.hxx"
27 #include "patattr.hxx"
28 #include "scitems.hxx"
29 #include "document.hxx"
30 #include "cellform.hxx"
31 #include "drwlayer.hxx"
32 #include "userdat.hxx"
33 #include "formulacell.hxx"
34 #include "formulagroup.hxx"
36 #include <svx/svdpage.hxx>
38 using namespace ::com::sun::star;
39 using namespace ::com::sun::star::uno;
41 /* Implementation of Filters test */
43 class ScOpenCLTest
44 : public test::FiltersTest
45 , public ScBootstrapFixture
47 public:
48 ScOpenCLTest();
50 /**
51 * Try to auto-detect OpenCL device if one is available.
53 * @return true if a usable OpenCL device is found, false otherwise.
55 bool detectOpenCLDevice();
57 /**
58 * Turn on OpenCL group interpreter. Call this after the document is
59 * loaded and before performing formula calculation.
61 void enableOpenCL();
63 virtual void setUp() SAL_OVERRIDE;
64 virtual void tearDown() SAL_OVERRIDE;
66 virtual bool load( const OUString &rFilter, const OUString &rURL,
67 const OUString &rUserData, SfxFilterFlags nFilterFlags,
68 SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) SAL_OVERRIDE;
69 void testSystematic();
70 void testSharedFormulaXLS();
71 #if 0
72 void testSharedFormulaXLSGroundWater();
73 void testSharedFormulaXLSStockHistory();
74 #endif
75 void testFinacialFormula();
76 void testStatisticalFormulaFisher();
77 void testStatisticalFormulaFisherInv();
78 void testStatisticalFormulaGamma();
79 void testFinacialFvscheduleFormula();
80 // this test has intermittent failures on OSX
81 #if !defined MACOSX
82 void testFinacialIRRFormula();
83 #endif
84 void testFinacialMIRRFormula();
85 void testFinacialRateFormula();
86 void testFinancialAccrintmFormula();
87 void testFinancialAccrintFormula();
88 void testCompilerHorizontal();
89 void testCompilerNested();
90 void testFinacialSLNFormula();
91 void testStatisticalFormulaGammaLn();
92 void testStatisticalFormulaGauss();
93 void testStatisticalFormulaGeoMean();
94 void testStatisticalFormulaHarMean();
95 void testFinancialCoupdaybsFormula();
96 void testFinacialDollardeFormula();
97 void testCompilerString();
98 void testCompilerInEq();
99 void testFinacialDollarfrFormula();
100 void testFinacialSYDFormula();
101 void testStatisticalFormulaCorrel();
102 void testFinancialCoupdaysFormula();
103 void testFinancialCoupdaysncFormula();
104 void testFinacialDISCFormula();
105 void testFinacialINTRATEFormula();
106 void testMathFormulaCos();
107 void testMathFormulaCsc();
108 void testStatisticalFormulaRsq();
109 void testStatisticalFormulaPearson();
110 void testStatisticalFormulaNegbinomdist();
111 void testFinacialXNPVFormula();
112 void testFinacialPriceMatFormula();
113 void testFinacialFormulaReceived();
114 void testFinancialFormulaCumipmt();
115 void testFinancialFormulaCumprinc();
116 void testFinacialRRIFormula();
117 void testFinacialEFFECT_ADDFormula();
118 void testFinacialNominalFormula();
119 void testFinacialTBILLEQFormula();
120 void testFinacialTBILLPRICEFormula();
121 void testFinacialTBILLYIELDFormula();
122 void testFinacialYIELDFormula();
123 void testFinacialYIELDDISCFormula();
124 void testFinacialYIELDMATFormula();
125 void testFinacialPMTFormula();
126 void testFinacialPPMTFormula();
127 void testFinancialISPMTFormula();
128 void testFinacialPriceFormula();
129 void testFinancialDurationFormula();
130 void testFinancialCoupnumFormula();
131 void testMathFormulaSinh();
132 void testMathFormulaAbs();
133 void testFinacialPVFormula();
134 void testMathFormulaSin();
135 void testMathFormulaTan();
136 void testMathFormulaTanH();
137 void testStatisticalFormulaStandard();
138 void testStatisticalFormulaWeibull();
139 void testStatisticalFormulaMedian();
140 void testFinancialDuration_ADDFormula();
141 void testFinancialAmordegrcFormula();
142 void testFinancialAmorlincFormula();
143 void testFinancialDDBFormula();
144 void testFinancialFVFormula();
145 void testFinancialMDurationFormula();
146 void testMathSumIfsFormula();
147 void testFinancialVDBFormula();
148 void testStatisticalFormulaKurt();
149 void testFinacialNPERFormula();
150 void testStatisticalFormulaNormdist();
151 void testMathFormulaArcCos();
152 void testMathFormulaSqrt();
153 void testMathFormulaArcCosHyp();
154 void testFinancialXirrFormula();
155 void testFinacialNPVFormula();
156 void testStatisticalFormulaNormsdist();
157 void testStatisticalFormulaNorminv();
158 void testStatisticalFormulaNormsinv();
159 void testStatisticalFormulaPermut();
160 void testStatisticalFormulaPermutation();
161 void testStatisticalFormulaPhi();
162 void testFinancialIPMTFormula();
163 void testStatisticalFormulaConfidence();
164 void testStatisticalFormulaIntercept();
165 void testFinacialODDLPRICEFormula();
166 void testFinacialOddlyieldFormula();
167 void testFinacialPriceDiscFormula();
168 void testFinancialDBFormula();
169 void testFinancialCouppcdFormula();
170 void testFinancialCoupncdFormula();
171 void testStatisticalFormulaLogInv();
172 void testMathFormulaArcCot();
173 void testMathFormulaCosh();
174 void testStatisticalFormulaCritBinom();
175 void testMathFormulaArcCotHyp();
176 void testMathFormulaArcSin();
177 void testMathFormulaArcSinHyp();
178 void testMathFormulaArcTan();
179 void testMathFormulaArcTanHyp();
180 void testMathFormulaBitAnd();
181 void testStatisticalFormulaForecast();
182 void testStatisticalFormulaLogNormDist();
183 void testStatisticalFormulaGammaDist();
184 void testMathFormulaLN();
185 void testMathFormulaRound();
186 void testMathFormulaCot();
187 void testMathFormulaCoth();
188 void testFinacialNPER1Formula();
189 void testStatisticalFormulaFDist();
190 void testStatisticalFormulaVar();
191 void testStatisticalFormulaChiDist();
192 void testMathFormulaPower();
193 void testMathFormulaOdd();
194 void testStatisticalFormulaChiSqDist();
195 void testStatisticalFormulaChiSqInv();
196 void testStatisticalFormulaGammaInv();
197 void testMathFormulaFloor();
198 void testStatisticalFormulaFInv();
199 void testStatisticalFormulaFTest();
200 void testStatisticalFormulaB();
201 void testStatisticalFormulaBetaDist();
202 void testMathFormulaCscH();
203 void testMathFormulaExp();
204 void testMathFormulaLog10();
205 void testStatisticalFormulaExpondist();
206 void testMathAverageIfsFormula();
207 void testMathCountIfsFormula();
208 void testMathFormulaCombina();
209 void testMathFormulaEven();
210 void testMathFormulaLog();
211 void testMathFormulaMod();
212 void testMathFormulaTrunc();
213 void testStatisticalFormulaSkew();
214 void testMathFormulaArcTan2();
215 void testMathFormulaBitOr();
216 void testMathFormulaBitLshift();
217 void testMathFormulaBitRshift();
218 void testMathFormulaBitXor();
219 void testStatisticalFormulaChiInv();
220 void testStatisticalFormulaPoisson();
221 void testMathFormulaSumSQ();
222 void testStatisticalFormulaSkewp();
223 void testMathFormulaSqrtPi();
224 void testStatisticalFormulaBinomDist();
225 void testStatisticalFormulaVarP();
226 void testMathFormulaCeil();
227 // void testMathFormulaKombin();
228 void testStatisticalFormulaDevSq();
229 void testStatisticalFormulaStDev();
230 void testStatisticalFormulaSlope();
231 void testStatisticalFormulaSTEYX();
232 void testStatisticalFormulaZTest();
233 void testMathFormulaPi();
234 void testMathFormulaRandom();
235 void testMathFormulaConvert();
236 void testMathFormulaProduct();
237 void testStatisticalFormulaHypGeomDist();
238 void testArrayFormulaSumX2MY2();
239 void testArrayFormulaSumX2PY2();
240 void testStatisticalFormulaBetainv();
241 void testStatisticalFormulaTTest();
242 void testStatisticalFormulaTDist();
243 void testStatisticalFormulaTInv();
244 void testArrayFormulaSumXMY2();
245 void testStatisticalFormulaStDevP();
246 void testStatisticalFormulaCovar();
247 void testLogicalFormulaAnd();
248 void testLogicalFormulaOr();
249 void testMathFormulaSumProduct();
250 void testMathFormulaSumProduct2();
251 void testStatisticalParallelCountBug();
252 void testSpreadSheetFormulaVLookup();
253 void testLogicalFormulaNot();
254 void testLogicalFormulaXor();
255 void testDatabaseFormulaDmax();
256 void testDatabaseFormulaDmin();
257 void testDatabaseFormulaDproduct();
258 void testDatabaseFormulaDaverage();
259 void testDatabaseFormulaDstdev();
260 void testDatabaseFormulaDstdevp();
261 void testDatabaseFormulaDsum();
262 void testDatabaseFormulaDvar();
263 void testDatabaseFormulaDvarp();
264 void testMathFormulaAverageIf();
265 void testDatabaseFormulaDcount();
266 void testDatabaseFormulaDcountA();
267 void testMathFormulaDegrees();
268 void testMathFormulaRoundUp();
269 void testMathFormulaRoundDown();
270 void testMathFormulaInt();
271 void testMathFormulaRadians();
272 void testMathFormulaCountIf();
273 void testMathFormulaIsEven();
274 void testMathFormulaIsOdd();
275 void testMathFormulaFact();
276 void testStatisticalFormulaMina();
277 void testStatisticalFormulaCountA();
278 void testStatisticalFormulaMaxa();
279 void testStatisticalFormulaAverageA();
280 void testStatisticalFormulaVarA();
281 void testStatisticalFormulaVarPA();
282 void testStatisticalFormulaStDevA();
283 void testStatisticalFormulaStDevPA();
284 void testMathFormulaSEC();
285 void testMathFormulaSECH();
286 void testMathFormulaMROUND();
287 void testMathFormulaSeriesSum();
288 void testMathFormulaQuotient();
289 void testMathFormulaSumIf();
290 void testAddInFormulaBesseLJ();
291 void testNegSub();
292 void testStatisticalFormulaAvedev();
293 void testMathFormulaAverageIf_Mix();
294 void testStatisticalFormulaKurt1();
295 void testStatisticalFormulaHarMean1();
296 void testStatisticalFormulaVarA1();
297 void testStatisticalFormulaVarPA1();
298 void testStatisticalFormulaStDevA1();
299 void testStatisticalFormulaStDevPA1();
300 void testFinancialMDurationFormula1();
302 CPPUNIT_TEST_SUITE(ScOpenCLTest);
303 CPPUNIT_TEST(testSystematic);
304 CPPUNIT_TEST(testSharedFormulaXLS);
305 CPPUNIT_TEST(testFinacialFormula);
306 CPPUNIT_TEST(testStatisticalFormulaFisher);
307 CPPUNIT_TEST(testStatisticalFormulaFisherInv);
308 CPPUNIT_TEST(testStatisticalFormulaGamma);
309 CPPUNIT_TEST(testFinacialFvscheduleFormula);
310 // this test has intermittent failures on OSX
311 #if !defined MACOSX
312 CPPUNIT_TEST(testFinacialIRRFormula);
313 #endif
314 CPPUNIT_TEST(testFinacialMIRRFormula);
315 CPPUNIT_TEST(testFinacialRateFormula);
316 CPPUNIT_TEST(testCompilerHorizontal);
317 CPPUNIT_TEST(testCompilerNested);
318 CPPUNIT_TEST(testFinacialSLNFormula);
319 CPPUNIT_TEST(testFinancialAccrintmFormula);
320 CPPUNIT_TEST(testStatisticalFormulaGammaLn);
321 CPPUNIT_TEST(testStatisticalFormulaGauss);
322 CPPUNIT_TEST(testStatisticalFormulaGeoMean);
323 CPPUNIT_TEST(testStatisticalFormulaHarMean);
324 CPPUNIT_TEST(testFinancialCoupdaybsFormula);
325 CPPUNIT_TEST(testFinacialDollardeFormula);
326 CPPUNIT_TEST(testCompilerString);
327 CPPUNIT_TEST(testCompilerInEq);
328 CPPUNIT_TEST(testFinacialDollarfrFormula);
329 CPPUNIT_TEST(testFinacialSYDFormula);
330 CPPUNIT_TEST(testStatisticalFormulaCorrel);
331 CPPUNIT_TEST(testFinancialCoupdaysFormula);
332 CPPUNIT_TEST(testFinancialCoupdaysncFormula);
333 CPPUNIT_TEST(testFinacialDISCFormula);
334 CPPUNIT_TEST(testFinacialINTRATEFormula);
335 CPPUNIT_TEST(testMathFormulaCos);
336 CPPUNIT_TEST(testStatisticalFormulaNegbinomdist);
337 CPPUNIT_TEST(testStatisticalFormulaRsq);
338 CPPUNIT_TEST(testStatisticalFormulaPearson);
339 CPPUNIT_TEST(testMathFormulaCsc);
340 CPPUNIT_TEST(testFinacialPriceMatFormula);
341 CPPUNIT_TEST(testFinacialXNPVFormula);
342 CPPUNIT_TEST(testFinacialFormulaReceived);
343 CPPUNIT_TEST(testFinancialFormulaCumipmt);
344 CPPUNIT_TEST(testFinancialFormulaCumprinc);
345 CPPUNIT_TEST(testFinacialRRIFormula);
346 CPPUNIT_TEST(testFinacialEFFECT_ADDFormula);
347 CPPUNIT_TEST(testFinacialNominalFormula);
348 CPPUNIT_TEST(testFinacialTBILLEQFormula);
349 CPPUNIT_TEST(testFinacialTBILLPRICEFormula);
350 CPPUNIT_TEST(testFinacialTBILLYIELDFormula);
351 CPPUNIT_TEST(testFinacialYIELDFormula);
352 CPPUNIT_TEST(testFinacialYIELDDISCFormula);
353 CPPUNIT_TEST(testFinacialYIELDMATFormula);
354 CPPUNIT_TEST(testFinacialPPMTFormula);
355 CPPUNIT_TEST(testFinacialPMTFormula);
356 CPPUNIT_TEST(testFinancialISPMTFormula);
357 CPPUNIT_TEST(testFinacialPriceFormula);
358 CPPUNIT_TEST(testFinancialDurationFormula);
359 CPPUNIT_TEST(testFinancialCoupnumFormula);
360 CPPUNIT_TEST(testMathFormulaSinh);
361 CPPUNIT_TEST(testMathFormulaAbs);
362 CPPUNIT_TEST(testFinacialPVFormula);
363 CPPUNIT_TEST(testMathFormulaSin);
364 CPPUNIT_TEST(testMathFormulaTan);
365 CPPUNIT_TEST(testMathFormulaTanH);
366 CPPUNIT_TEST(testStatisticalFormulaStandard);
367 CPPUNIT_TEST(testStatisticalFormulaWeibull);
368 CPPUNIT_TEST(testStatisticalFormulaMedian);
369 CPPUNIT_TEST(testFinancialDuration_ADDFormula);
370 CPPUNIT_TEST(testFinancialAmordegrcFormula);
371 CPPUNIT_TEST(testFinancialAmorlincFormula);
372 CPPUNIT_TEST(testFinancialDDBFormula);
373 CPPUNIT_TEST(testFinancialFVFormula);
374 CPPUNIT_TEST(testFinancialMDurationFormula);
375 CPPUNIT_TEST(testMathSumIfsFormula);
376 CPPUNIT_TEST(testFinancialVDBFormula);
377 CPPUNIT_TEST(testStatisticalFormulaKurt);
378 CPPUNIT_TEST(testFinacialNPERFormula);
379 CPPUNIT_TEST(testStatisticalFormulaNormdist);
380 CPPUNIT_TEST(testMathFormulaArcCos);
381 CPPUNIT_TEST(testMathFormulaSqrt);
382 CPPUNIT_TEST(testMathFormulaArcCosHyp);
383 CPPUNIT_TEST(testFinancialXirrFormula);
384 CPPUNIT_TEST(testFinacialNPVFormula);
385 CPPUNIT_TEST(testStatisticalFormulaNormsdist);
386 CPPUNIT_TEST(testStatisticalFormulaNorminv);
387 CPPUNIT_TEST(testStatisticalFormulaNormsinv);
388 CPPUNIT_TEST(testStatisticalFormulaPermut);
389 CPPUNIT_TEST(testStatisticalFormulaPermutation);
390 CPPUNIT_TEST(testStatisticalFormulaPhi);
391 CPPUNIT_TEST(testFinancialIPMTFormula);
392 CPPUNIT_TEST(testStatisticalFormulaConfidence);
393 CPPUNIT_TEST(testStatisticalFormulaIntercept);
394 CPPUNIT_TEST(testFinacialODDLPRICEFormula);
395 CPPUNIT_TEST(testFinacialOddlyieldFormula);
396 CPPUNIT_TEST(testFinacialPriceDiscFormula);
397 CPPUNIT_TEST(testFinancialDBFormula);
398 CPPUNIT_TEST(testFinancialCouppcdFormula);
399 CPPUNIT_TEST(testFinancialCoupncdFormula);
400 CPPUNIT_TEST(testFinancialAccrintFormula);
401 CPPUNIT_TEST(testStatisticalFormulaLogInv);
402 CPPUNIT_TEST(testMathFormulaArcCot);
403 CPPUNIT_TEST(testMathFormulaCosh);
404 CPPUNIT_TEST(testStatisticalFormulaCritBinom);
405 CPPUNIT_TEST(testMathFormulaArcCotHyp);
406 CPPUNIT_TEST(testMathFormulaArcSin);
407 CPPUNIT_TEST(testMathFormulaArcSinHyp);
408 CPPUNIT_TEST(testMathFormulaArcTan);
409 CPPUNIT_TEST(testMathFormulaArcTanHyp);
410 CPPUNIT_TEST(testMathFormulaBitAnd);
411 CPPUNIT_TEST(testStatisticalFormulaForecast);
412 CPPUNIT_TEST(testStatisticalFormulaLogNormDist);
413 CPPUNIT_TEST(testStatisticalFormulaGammaDist);
414 CPPUNIT_TEST(testMathFormulaLN);
415 CPPUNIT_TEST(testMathFormulaRound);
416 CPPUNIT_TEST(testMathFormulaCot);
417 CPPUNIT_TEST(testMathFormulaCoth);
418 CPPUNIT_TEST(testFinacialNPER1Formula);
419 CPPUNIT_TEST(testStatisticalFormulaFDist);
420 CPPUNIT_TEST(testStatisticalFormulaVar);
421 CPPUNIT_TEST(testStatisticalFormulaChiDist);
422 CPPUNIT_TEST(testMathFormulaPower);
423 CPPUNIT_TEST(testMathFormulaOdd);
424 CPPUNIT_TEST(testStatisticalFormulaChiSqDist);
425 CPPUNIT_TEST(testStatisticalFormulaChiSqInv);
426 CPPUNIT_TEST(testStatisticalFormulaGammaInv);
427 CPPUNIT_TEST(testMathFormulaFloor);
428 CPPUNIT_TEST(testStatisticalFormulaFInv);
429 CPPUNIT_TEST(testStatisticalFormulaFTest);
430 CPPUNIT_TEST(testStatisticalFormulaB);
431 CPPUNIT_TEST(testStatisticalFormulaBetaDist);
432 CPPUNIT_TEST(testMathFormulaCscH);
433 CPPUNIT_TEST(testMathFormulaExp);
434 CPPUNIT_TEST(testMathFormulaLog10);
435 CPPUNIT_TEST(testStatisticalFormulaExpondist);
436 CPPUNIT_TEST(testMathAverageIfsFormula);
437 CPPUNIT_TEST(testMathCountIfsFormula);
438 CPPUNIT_TEST(testMathFormulaCombina);
439 CPPUNIT_TEST(testMathFormulaEven);
440 CPPUNIT_TEST(testMathFormulaLog);
441 CPPUNIT_TEST(testMathFormulaMod);
442 CPPUNIT_TEST(testMathFormulaTrunc);
443 CPPUNIT_TEST(testStatisticalFormulaSkew);
444 CPPUNIT_TEST(testMathFormulaArcTan2);
445 CPPUNIT_TEST(testMathFormulaBitOr);
446 CPPUNIT_TEST(testMathFormulaBitLshift);
447 CPPUNIT_TEST(testMathFormulaBitRshift);
448 CPPUNIT_TEST(testMathFormulaBitXor);
449 CPPUNIT_TEST(testStatisticalFormulaChiInv);
450 CPPUNIT_TEST(testStatisticalFormulaPoisson);
451 CPPUNIT_TEST(testMathFormulaSumSQ);
452 CPPUNIT_TEST(testStatisticalFormulaSkewp);
453 CPPUNIT_TEST(testMathFormulaSqrtPi);
454 CPPUNIT_TEST(testStatisticalFormulaBinomDist);
455 CPPUNIT_TEST(testStatisticalFormulaVarP);
456 CPPUNIT_TEST(testMathFormulaCeil);
457 // This test fails MacOS 10.8. Disabled temporarily
458 // CPPUNIT_TEST(testMathFormulaKombin);
459 CPPUNIT_TEST(testStatisticalFormulaDevSq);
460 CPPUNIT_TEST(testStatisticalFormulaStDev);
461 CPPUNIT_TEST(testStatisticalFormulaSlope);
462 CPPUNIT_TEST(testStatisticalFormulaSTEYX);
463 CPPUNIT_TEST(testStatisticalFormulaZTest);
464 CPPUNIT_TEST(testMathFormulaPi);
465 CPPUNIT_TEST(testMathFormulaRandom);
466 CPPUNIT_TEST(testMathFormulaConvert);
467 CPPUNIT_TEST(testMathFormulaProduct);
468 CPPUNIT_TEST(testStatisticalFormulaHypGeomDist);
469 CPPUNIT_TEST(testArrayFormulaSumX2MY2);
470 CPPUNIT_TEST(testArrayFormulaSumX2PY2);
471 CPPUNIT_TEST(testStatisticalFormulaBetainv);
472 CPPUNIT_TEST(testStatisticalFormulaTTest);
473 CPPUNIT_TEST(testStatisticalFormulaTDist);
474 CPPUNIT_TEST(testStatisticalFormulaTInv);
475 CPPUNIT_TEST(testArrayFormulaSumXMY2);
476 CPPUNIT_TEST(testStatisticalFormulaStDevP);
477 CPPUNIT_TEST(testStatisticalFormulaCovar);
478 CPPUNIT_TEST(testLogicalFormulaAnd);
479 CPPUNIT_TEST(testMathFormulaSumProduct);
480 CPPUNIT_TEST(testMathFormulaSumProduct2);
481 CPPUNIT_TEST(testStatisticalParallelCountBug);
482 CPPUNIT_TEST(testSpreadSheetFormulaVLookup);
483 CPPUNIT_TEST(testLogicalFormulaOr);
484 CPPUNIT_TEST(testLogicalFormulaNot);
485 CPPUNIT_TEST(testLogicalFormulaXor);
486 CPPUNIT_TEST(testDatabaseFormulaDmax);
487 CPPUNIT_TEST(testDatabaseFormulaDmin);
488 CPPUNIT_TEST(testDatabaseFormulaDproduct);
489 CPPUNIT_TEST(testDatabaseFormulaDaverage);
490 CPPUNIT_TEST(testDatabaseFormulaDstdev);
491 CPPUNIT_TEST(testDatabaseFormulaDstdevp);
492 CPPUNIT_TEST(testDatabaseFormulaDsum);
493 CPPUNIT_TEST(testDatabaseFormulaDvar);
494 CPPUNIT_TEST(testDatabaseFormulaDvarp);
495 CPPUNIT_TEST(testMathFormulaAverageIf);
496 CPPUNIT_TEST(testDatabaseFormulaDcount);
497 CPPUNIT_TEST(testDatabaseFormulaDcountA);
498 CPPUNIT_TEST(testMathFormulaDegrees);
499 CPPUNIT_TEST(testMathFormulaRoundUp);
500 CPPUNIT_TEST(testMathFormulaRoundDown);
501 CPPUNIT_TEST(testMathFormulaInt);
502 CPPUNIT_TEST(testMathFormulaRadians);
503 CPPUNIT_TEST(testMathFormulaCountIf);
504 CPPUNIT_TEST(testMathFormulaIsEven);
505 CPPUNIT_TEST(testMathFormulaIsOdd);
506 CPPUNIT_TEST(testMathFormulaFact);
507 CPPUNIT_TEST(testStatisticalFormulaMaxa);
508 CPPUNIT_TEST(testStatisticalFormulaMina);
509 CPPUNIT_TEST(testStatisticalFormulaCountA);
510 CPPUNIT_TEST(testStatisticalFormulaAverageA);
511 CPPUNIT_TEST(testStatisticalFormulaVarA);
512 CPPUNIT_TEST(testStatisticalFormulaVarPA);
513 CPPUNIT_TEST(testStatisticalFormulaStDevA);
514 CPPUNIT_TEST(testStatisticalFormulaStDevPA);
515 CPPUNIT_TEST(testMathFormulaSEC);
516 CPPUNIT_TEST(testMathFormulaSECH);
517 CPPUNIT_TEST(testMathFormulaMROUND);
518 CPPUNIT_TEST(testMathFormulaQuotient);
519 CPPUNIT_TEST(testMathFormulaSeriesSum);
520 CPPUNIT_TEST(testMathFormulaSumIf);
521 CPPUNIT_TEST(testAddInFormulaBesseLJ);
522 CPPUNIT_TEST(testNegSub);
523 CPPUNIT_TEST(testStatisticalFormulaAvedev);
524 CPPUNIT_TEST(testMathFormulaAverageIf_Mix);
525 CPPUNIT_TEST(testStatisticalFormulaKurt1);
526 CPPUNIT_TEST(testStatisticalFormulaHarMean1);
527 CPPUNIT_TEST(testStatisticalFormulaVarA1);
528 CPPUNIT_TEST(testStatisticalFormulaVarPA1);
529 CPPUNIT_TEST(testStatisticalFormulaStDevA1);
530 CPPUNIT_TEST(testStatisticalFormulaStDevPA1);
531 CPPUNIT_TEST(testFinancialMDurationFormula1);
532 CPPUNIT_TEST_SUITE_END();
534 private:
535 uno::Reference<uno::XInterface> m_xCalcComponent;
537 // Test env variables and methods
538 ScDocShellRef xDocSh;
539 ScDocShellRef xDocShRes;
540 bool initTestEnv(const OUString& fileName, sal_Int32 nFormat,
541 bool bReadWrite);
544 bool ScOpenCLTest::initTestEnv(const OUString& fileName, sal_Int32 nFormat,
545 bool bReadWrite)
547 if(!detectOpenCLDevice())
548 return false;
550 xDocSh = loadDoc(fileName, nFormat, bReadWrite);
551 CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is());
552 enableOpenCL();
554 xDocShRes = loadDoc(fileName, nFormat, bReadWrite);
555 CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is());
557 return true;
560 bool ScOpenCLTest::load(const OUString &rFilter, const OUString &rURL,
561 const OUString &rUserData, SfxFilterFlags nFilterFlags,
562 SotClipboardFormatId nClipboardID, unsigned int nFilterVersion)
564 ScDocShellRef xDocShRef = ScBootstrapFixture::load(rURL, rFilter, rUserData,
565 OUString(), nFilterFlags, nClipboardID, nFilterVersion );
566 bool bLoaded = xDocShRef.Is();
567 //reference counting of ScDocShellRef is very confused.
568 if (bLoaded)
569 xDocShRef->DoClose();
570 return bLoaded;
573 bool ScOpenCLTest::detectOpenCLDevice()
575 sc::FormulaGroupInterpreter::enableOpenCL_UnitTestsOnly();
576 return sc::FormulaGroupInterpreter::switchOpenCLDevice(OUString(),true);
579 void ScOpenCLTest::enableOpenCL()
581 sc::FormulaGroupInterpreter::enableOpenCL_UnitTestsOnly();
584 void ScOpenCLTest::testCompilerHorizontal()
586 if(!initTestEnv("opencl/compiler/horizontal.", ODS, false))
587 return;
588 ScDocument& rDoc = xDocSh->GetDocument();
589 ScDocument& rDocRes = xDocShRes->GetDocument();
590 rDoc.CalcAll();
592 // Check the results of formula cells in the shared formula range.
593 for (SCROW i = 1; i < 5; ++i)
595 double fLibre = rDoc.GetValue(ScAddress(12, i, 0));
596 double fExcel = rDocRes.GetValue(ScAddress(12, i, 0));
597 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
598 fLibre = rDoc.GetValue(ScAddress(13, i, 0));
599 fExcel = rDocRes.GetValue(ScAddress(13, i, 0));
600 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
601 fLibre = rDoc.GetValue(ScAddress(14, i, 0));
602 fExcel = rDocRes.GetValue(ScAddress(14, i, 0));
603 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
607 void ScOpenCLTest::testCompilerNested()
609 if(!initTestEnv("opencl/compiler/nested.", ODS, false))
610 return;
611 ScDocument& rDoc = xDocSh->GetDocument();
612 ScDocument& rDocRes = xDocShRes->GetDocument();
613 rDoc.CalcAll();
615 // Check the results of formula cells in the shared formula range.
616 for (SCROW i = 1; i < 5; ++i)
618 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
619 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
620 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
624 void ScOpenCLTest::testCompilerString()
626 if(!initTestEnv("opencl/compiler/string.", ODS, false))
627 return;
628 ScDocument& rDoc = xDocSh->GetDocument();
629 ScDocument& rDocRes = xDocShRes->GetDocument();
630 rDoc.CalcAll();
632 // Check the results of formula cells in the shared formula range.
633 for (SCROW i = 1; i < 5; ++i)
635 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
636 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
637 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
639 fLibre = rDoc.GetValue(ScAddress(3, i, 0));
640 fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
641 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
645 void ScOpenCLTest::testCompilerInEq()
647 if(!initTestEnv("opencl/compiler/ineq.", ODS, false))
648 return;
649 ScDocument& rDoc = xDocSh->GetDocument();
650 ScDocument& rDocRes = xDocShRes->GetDocument();
651 rDoc.CalcAll();
653 // Check the results of formula cells in the shared formula range.
654 for (SCROW i = 1; i < 7; ++i)
656 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
657 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
658 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
662 #if 0
663 void ScOpenCLTest::testSharedFormulaXLSStockHistory()
665 if(!initTestEnv("stock-history.", XLS, false))
666 return;
667 ScDocument& rDoc = xDocSh->GetDocument();
668 ScDocument& rDocRes = xDocShRes->GetDocument();
669 xDocSh->DoHardRecalc(true);
671 // Check the results of formula cells in the shared formula range.
672 for (SCROW i = 33; i < 44; ++i)
673 { // Cell H34:H44 in S&P 500 (tab 1)
674 double fLibre = rDoc.GetValue(ScAddress(7, i, 1));
675 double fExcel = rDocRes.GetValue(ScAddress(7, i, 1));
676 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
679 for (SCROW i = 33; i < 44; ++i)
680 { // Cell J34:J44 in S&P 500 (tab 1)
681 double fLibre = rDoc.GetValue(ScAddress(9, i, 1));
682 double fExcel = rDocRes.GetValue(ScAddress(9, i, 1));
683 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
687 void ScOpenCLTest::testSharedFormulaXLSGroundWater()
689 if(!initTestEnv("ground-water-daily.", XLS, false))
690 return;
691 ScDocument& rDoc = xDocSh->GetDocument();
692 ScDocument& rDocRes = xDocShRes->GetDocument();
693 xDocSh->DoHardRecalc(true);
695 // Check the results of formula cells in the shared formula range.
696 for (SCROW i = 5; i <= 77; ++i)
698 double fLibre = rDoc.GetValue(ScAddress(11,i,1));
699 double fExcel = rDocRes.GetValue(ScAddress(11,i,1));
700 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
705 #endif
707 void ScOpenCLTest::testSystematic()
709 if(!initTestEnv("systematic.", XLS, false))
710 return;
712 ScDocument& rDoc = xDocSh->GetDocument();
713 rDoc.CalcAll();
715 int nAVertBegin(0), nAVertEnd(0), nBVertBegin(0), nBVertEnd(0);
716 int nAHorEnd(0), nBHorEnd(0);
718 int nRow, nCol;
719 for (nRow = 0; nRow < 1000; ++nRow)
721 if (rDoc.GetString(ScAddress(0, nRow, 0)) == "a")
723 nAVertBegin = nRow + 1;
725 for (nCol = 0; nCol < 1000; ++nCol)
727 if (rDoc.GetString(ScAddress(nCol, nRow, 0)) != "a")
729 nAHorEnd = nCol;
730 break;
733 break;
736 for (; nRow < 1000; ++nRow)
738 if (rDoc.GetString(ScAddress(0, nRow, 0)) != "a")
740 nAVertEnd = nRow;
741 break;
745 for (; nRow < 1000; ++nRow)
747 if (rDoc.GetString(ScAddress(0, nRow, 0)) == "b")
749 nBVertBegin = nRow + 1;
751 for (nCol = 0; nCol < 1000; ++nCol)
753 if (rDoc.GetString(ScAddress(nCol, nRow, 0)) != "b")
755 nBHorEnd = nCol;
756 break;
759 break;
762 for (; nRow < 1000; ++nRow)
764 if (rDoc.GetString(ScAddress(0, nRow, 0)) != "b")
766 nBVertEnd = nRow;
767 break;
771 CPPUNIT_ASSERT(nAVertBegin != 0);
772 CPPUNIT_ASSERT(nBVertBegin != 0);
773 CPPUNIT_ASSERT(nAVertEnd > nAVertBegin + 100);
774 CPPUNIT_ASSERT(nBVertEnd > nBVertBegin + 100);
775 CPPUNIT_ASSERT((nAVertEnd-nAVertBegin) == (nBVertEnd-nBVertBegin));
776 CPPUNIT_ASSERT(nAHorEnd > 10);
777 CPPUNIT_ASSERT(nBHorEnd > 10);
778 CPPUNIT_ASSERT(nAHorEnd == nBHorEnd);
780 (void) nBVertEnd;
781 (void) nBHorEnd;
783 for (SCROW i = nAVertBegin; i < nAVertEnd; ++i)
785 for (int j = 1; j < nAHorEnd; ++j)
787 double fLibre = rDoc.GetValue(ScAddress(j, i, 0));
788 double fExcel = rDoc.GetValue(ScAddress(j, nBVertBegin + (i - nAVertBegin), 0));
790 const OString sFailedMessage =
791 OString(static_cast<sal_Char>('A'+j)) +
792 OString::number(i+1) +
793 "!=" +
794 OString(static_cast<sal_Char>('A'+j)) +
795 OString::number(nBVertBegin+(i-nAVertBegin)+1);
796 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(sFailedMessage.getStr(), fExcel, fLibre, 1e-10);
802 void ScOpenCLTest::testSharedFormulaXLS()
804 if(!initTestEnv("sum_ex.", XLS, false))
805 return;
806 ScDocument& rDoc = xDocSh->GetDocument();
807 ScDocument& rDocRes = xDocShRes->GetDocument();
808 rDoc.CalcAll();
810 // Check the results of formula cells in the shared formula range.
811 for (SCROW i = 0; i < 5; ++i)
813 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
814 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
815 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
818 for (SCROW i = 6; i < 14; ++i)
820 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
821 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
822 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
825 for (SCROW i = 15; i < 18; ++i)
827 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
828 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
829 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
832 for (SCROW i = 19; i < 22; ++i)
834 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
835 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
836 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
839 for (SCROW i = 23; i < 25; ++i)
841 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
842 //double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
843 // There seems to be a bug in LibreOffice beta
844 ASSERT_DOUBLES_EQUAL(/*fExcel*/ 60.0, fLibre);
847 for (SCROW i = 25; i < 27; ++i)
849 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
850 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
851 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
854 for (SCROW i = 28; i < 35; ++i)
856 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
857 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
858 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
861 // workaround for a Calc beta bug
862 ASSERT_DOUBLES_EQUAL(25.0, rDoc.GetValue(ScAddress(2, 35, 0)));
863 ASSERT_DOUBLES_EQUAL(24.0, rDoc.GetValue(ScAddress(2, 36, 0)));
865 for (SCROW i = 38; i < 43; ++i)
867 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
868 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
869 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
872 for (SCROW i = 5; i < 10; ++i)
874 double fLibre = rDoc.GetValue(ScAddress(5, i, 1));
875 double fExcel = rDocRes.GetValue(ScAddress(5, i, 1));
876 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
879 for (SCROW i = 5; i < 10; ++i)
881 for (SCCOL j = 6; j < 11; ++j)
883 double fLibre = rDoc.GetValue(ScAddress(j, i, 1));
884 double fExcel = rDocRes.GetValue(ScAddress(j, i, 1));
885 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
886 fabs(fExcel*0.0001));
891 void ScOpenCLTest::testMathFormulaCos()
893 if(!initTestEnv("opencl/math/cos.", XLS, false))
894 return;
895 ScDocument& rDoc = xDocSh->GetDocument();
896 ScDocument& rDocRes = xDocShRes->GetDocument();
897 rDoc.CalcAll();
899 for (SCROW i = 0; i <= 15; ++i)
901 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
902 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
903 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
907 void ScOpenCLTest::testMathFormulaSinh()
909 if(!initTestEnv("opencl/math/sinh.", XLS, false))
910 return;
911 ScDocument& rDoc = xDocSh->GetDocument();
912 ScDocument& rDocRes = xDocShRes->GetDocument();
913 xDocSh->DoHardRecalc(true);
915 for (SCROW i = 0; i <= 15; ++i)
917 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
918 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
919 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
923 void ScOpenCLTest::testMathFormulaPi()
925 if(!initTestEnv("opencl/math/pi.", XLS, false))
926 return;
927 ScDocument& rDoc = xDocSh->GetDocument();
928 ScDocument& rDocRes = xDocShRes->GetDocument();
929 rDoc.CalcAll();
931 for (SCROW i = 0; i <= 15; ++i)
933 double fLibre = rDoc.GetValue(ScAddress(0,i,0));
934 double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
935 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
939 void ScOpenCLTest::testMathFormulaRandom()
941 if(!initTestEnv("opencl/math/random.", XLS, false))
942 return;
943 ScDocument& rDoc = xDocSh->GetDocument();
944 ScDocument& rDocRes = xDocShRes->GetDocument();
945 rDoc.CalcAll();
947 for (SCROW i = 0; i <= 15; ++i)
949 double fLibre = rDoc.GetValue(ScAddress(0,i,0));
950 double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
951 //because the random numbers will always change,so give the test "true"
952 (void) fLibre;
953 (void) fExcel;
954 CPPUNIT_ASSERT(true);
957 void ScOpenCLTest::testFinacialFormula()
959 if(!initTestEnv("opencl/financial/general.", XLS, false))
960 return;
961 ScDocument& rDoc = xDocSh->GetDocument();
962 ScDocument& rDocRes = xDocShRes->GetDocument();
963 rDoc.CalcAll();
965 // Check the results of formula cells in the shared formula range.
966 for (SCROW i = 1; i <= 10; ++i)
968 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
969 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
970 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
973 for (SCROW i = 1; i <= 10; ++i)
975 double fLibre = rDoc.GetValue(ScAddress(6,i,1));
976 double fExcel = rDocRes.GetValue(ScAddress(6,i,1));
977 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
980 for (SCROW i = 1; i <= 10; ++i)
982 double fLibre = rDoc.GetValue(ScAddress(2,i,2));
983 double fExcel = rDocRes.GetValue(ScAddress(2,i,2));
984 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
987 for (SCROW i = 1; i <= 10; ++i)
989 double fLibre = rDoc.GetValue(ScAddress(6,i,3));
990 double fExcel = rDocRes.GetValue(ScAddress(6,i,3));
991 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
994 for (SCROW i = 0; i <= 9; ++i)
996 double fLibre = rDoc.GetValue(ScAddress(3,i,4));
997 double fExcel = rDocRes.GetValue(ScAddress(3,i,4));
998 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1001 for (SCROW i = 0; i <= 9; ++i)
1003 double fLibre = rDoc.GetValue(ScAddress(3,i,5));
1004 double fExcel = rDocRes.GetValue(ScAddress(3,i,5));
1005 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1008 for (SCROW i = 0; i < 10; ++i)
1010 double fLibre = rDoc.GetValue(ScAddress(5,i,6));
1011 double fExcel = rDocRes.GetValue(ScAddress(5,i,6));
1012 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1015 for (SCROW i = 1; i <= 9; ++i)
1017 double fLibre = rDoc.GetValue(ScAddress(3,i,7));
1018 double fExcel = rDocRes.GetValue(ScAddress(3,i,7));
1019 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1022 for (SCROW i = 1; i <= 10; ++i)
1024 double fLibre = rDoc.GetValue(ScAddress(3,i,8));
1025 double fExcel = rDocRes.GetValue(ScAddress(3,i,8));
1026 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1029 for (SCROW i = 1; i <= 9; ++i)
1031 double fLibre = rDoc.GetValue(ScAddress(3,i,9));
1032 double fExcel = rDocRes.GetValue(ScAddress(3,i,9));
1033 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1036 for (SCROW i = 1; i <= 10; ++i)
1038 double fLibre = rDoc.GetValue(ScAddress(2,i,10));
1039 double fExcel = rDocRes.GetValue(ScAddress(2,i,10));
1040 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1043 for (SCROW i = 1; i <= 10; ++i)
1045 double fLibre = rDoc.GetValue(ScAddress(7,i,11));
1046 double fExcel = rDocRes.GetValue(ScAddress(7,i,11));
1047 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1050 for (SCROW i = 1; i <= 10; ++i)
1052 double fLibre = rDoc.GetValue(ScAddress(5,i,12));
1053 double fExcel = rDocRes.GetValue(ScAddress(5,i,12));
1054 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1057 for (SCROW i = 0; i <= 12; ++i)
1059 double fLibre = rDoc.GetValue(ScAddress(6,i,13));
1060 double fExcel = rDocRes.GetValue(ScAddress(6,i,13));
1061 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1064 for (SCROW i = 1; i <= 10; ++i)
1066 double fLibre = rDoc.GetValue(ScAddress(3,i,14));
1067 double fExcel = rDocRes.GetValue(ScAddress(3,i,14));
1068 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1071 for (SCROW i = 1; i <= 10; ++i)
1073 double fLibre = rDoc.GetValue(ScAddress(6,i,15));
1074 double fExcel = rDocRes.GetValue(ScAddress(6,i,15));
1075 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1078 for (SCROW i = 1; i <= 10; ++i)
1080 double fLibre = rDoc.GetValue(ScAddress(6,i,16));
1081 double fExcel = rDocRes.GetValue(ScAddress(6,i,16));
1082 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1085 for (SCROW i = 1; i <= 5; ++i)
1087 double fLibre = rDoc.GetValue(ScAddress(6,i,17));
1088 double fExcel = rDocRes.GetValue(ScAddress(6,i,17));
1089 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1092 for (SCROW i = 0; i <= 10; ++i)
1094 double fLibre = rDoc.GetValue(ScAddress(3,i,18));
1095 double fExcel = rDocRes.GetValue(ScAddress(3,i,18));
1096 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1099 for (SCROW i = 0; i <= 18; ++i)
1101 double fLibre = rDoc.GetValue(ScAddress(3,i,19));
1102 double fExcel = rDocRes.GetValue(ScAddress(3,i,19));
1103 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1107 void ScOpenCLTest::testStatisticalFormulaCorrel()
1109 if(!initTestEnv("opencl/statistical/Correl.", ODS, false))
1110 return;
1111 ScDocument& rDoc = xDocSh->GetDocument();
1112 ScDocument& rDocRes = xDocShRes->GetDocument();
1113 rDoc.CalcAll();
1115 // Check the results of formula cells in the shared formula range.
1116 for (SCROW i = 1; i <= 20; ++i)
1118 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1119 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1120 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1123 void ScOpenCLTest::testStatisticalFormulaFisher()
1125 if(!initTestEnv("opencl/statistical/Fisher.", XLS, false))
1126 return;
1127 ScDocument& rDoc = xDocSh->GetDocument();
1128 ScDocument& rDocRes = xDocShRes->GetDocument();
1129 rDoc.CalcAll();
1131 // Check the results of formula cells in the shared formula range.
1132 for (SCROW i = 1; i <= 19; ++i)
1134 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1135 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1136 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1140 void ScOpenCLTest::testStatisticalFormulaFisherInv()
1142 if(!initTestEnv("opencl/statistical/FisherInv.", XLS, false))
1143 return;
1144 ScDocument& rDoc = xDocSh->GetDocument();
1145 ScDocument& rDocRes = xDocShRes->GetDocument();
1146 rDoc.CalcAll();
1148 // Check the results of formula cells in the shared formula range.
1149 for (SCROW i = 1; i <= 19; ++i)
1151 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1152 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1153 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1157 void ScOpenCLTest::testStatisticalFormulaGamma()
1159 if(!initTestEnv("opencl/statistical/Gamma.", XLS, false))
1160 return;
1161 ScDocument& rDoc = xDocSh->GetDocument();
1162 ScDocument& rDocRes = xDocShRes->GetDocument();
1163 rDoc.CalcAll();
1165 // Check the results of formula cells in the shared formula range.
1166 for (SCROW i = 1; i <= 19; ++i)
1168 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1169 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1170 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1174 void ScOpenCLTest::testFinacialFvscheduleFormula()
1176 if(!initTestEnv("opencl/financial/Fvschedule.", XLS, false))
1177 return;
1178 ScDocument& rDoc = xDocSh->GetDocument();
1179 ScDocument& rDocRes = xDocShRes->GetDocument();
1180 rDoc.CalcAll();
1182 for (SCROW i = 0; i <= 9; ++i)
1184 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
1185 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
1186 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1190 void ScOpenCLTest::testMathFormulaAbs()
1192 if(!initTestEnv("opencl/math/Abs.", ODS, false))
1193 return;
1194 ScDocument& rDoc = xDocSh->GetDocument();
1195 ScDocument& rDocRes = xDocShRes->GetDocument();
1196 rDoc.CalcAll();
1198 // Verify ABS Function
1199 for (SCROW i = 1; i <= 1000; ++i)
1201 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1202 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1203 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1207 void ScOpenCLTest::testFinacialSYDFormula()
1209 if(!initTestEnv("opencl/financial/SYD.", XLS, false))
1210 return;
1211 ScDocument& rDoc = xDocSh->GetDocument();
1212 ScDocument& rDocRes = xDocShRes->GetDocument();
1213 rDoc.CalcAll();
1215 for (SCROW i = 0; i <= 9; ++i)
1217 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1218 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1219 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1223 // this test has intermittent failures on OSX
1224 #if !defined MACOSX
1225 void ScOpenCLTest::testFinacialIRRFormula()
1227 if(!initTestEnv("opencl/financial/IRR.", XLS, false))
1228 return;
1229 ScDocument& rDoc = xDocSh->GetDocument();
1230 ScDocument& rDocRes = xDocShRes->GetDocument();
1231 rDoc.CalcAll();
1233 for (SCROW i = 0; i <= 6; ++i)
1235 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
1236 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
1237 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1240 #endif
1242 void ScOpenCLTest::testStatisticalFormulaGammaLn()
1244 if(!initTestEnv("opencl/statistical/GammaLn.", XLS, false))
1245 return;
1246 ScDocument& rDoc = xDocSh->GetDocument();
1247 ScDocument& rDocRes = xDocShRes->GetDocument();
1248 rDoc.CalcAll();
1250 // Check the results of formula cells in the shared formula range.
1251 for (SCROW i = 1; i <= 19; ++i)
1253 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1254 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1255 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1259 void ScOpenCLTest::testStatisticalFormulaGauss()
1261 if(!initTestEnv("opencl/statistical/Gauss.", XLS, false))
1262 return;
1263 ScDocument& rDoc = xDocSh->GetDocument();
1264 ScDocument& rDocRes = xDocShRes->GetDocument();
1265 rDoc.CalcAll();
1267 // Check the results of formula cells in the shared formula range.
1268 for (SCROW i = 1; i <= 19; ++i)
1270 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1271 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1272 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1276 void ScOpenCLTest::testStatisticalFormulaGeoMean()
1278 if(!initTestEnv("opencl/statistical/GeoMean.", XLS, false))
1279 return;
1280 ScDocument& rDoc = xDocSh->GetDocument();
1281 ScDocument& rDocRes = xDocShRes->GetDocument();
1282 rDoc.CalcAll();
1284 // Check the results of formula cells in the shared formula range.
1285 for (SCROW i = 1; i <= 19; ++i)
1287 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1288 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1289 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1293 void ScOpenCLTest::testStatisticalFormulaHarMean()
1295 if(!initTestEnv("opencl/statistical/HarMean.", XLS, false))
1296 return;
1297 ScDocument& rDoc = xDocSh->GetDocument();
1298 ScDocument& rDocRes = xDocShRes->GetDocument();
1299 rDoc.CalcAll();
1301 // Check the results of formula cells in the shared formula range.
1302 for (SCROW i = 1; i <= 19; ++i)
1304 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1305 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1306 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1310 void ScOpenCLTest::testFinacialSLNFormula()
1312 if(!initTestEnv("opencl/financial/SLN.", XLS, false))
1313 return;
1314 ScDocument& rDoc = xDocSh->GetDocument();
1315 ScDocument& rDocRes = xDocShRes->GetDocument();
1316 rDoc.CalcAll();
1318 for (SCROW i = 0; i <= 9; ++i)
1320 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1321 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1322 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1326 void ScOpenCLTest::testFinacialMIRRFormula()
1328 if(!initTestEnv("opencl/financial/MIRR.", XLS, false))
1329 return;
1330 ScDocument& rDoc = xDocSh->GetDocument();
1331 ScDocument& rDocRes = xDocShRes->GetDocument();
1332 rDoc.CalcAll();
1334 for (SCROW i = 0; i <= 6; ++i)
1336 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1337 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1338 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1342 void ScOpenCLTest::testFinancialCoupdaybsFormula()
1344 if(!initTestEnv("opencl/financial/Coupdaybs.", XLS, false))
1345 return;
1346 ScDocument& rDoc = xDocSh->GetDocument();
1347 ScDocument& rDocRes = xDocShRes->GetDocument();
1348 rDoc.CalcAll();
1350 for (SCROW i = 1; i <=10; ++i)
1352 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1353 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1354 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1358 void ScOpenCLTest::testFinacialDollardeFormula()
1360 if(!initTestEnv("opencl/financial/Dollarde.", XLS, false))
1361 return;
1362 ScDocument& rDoc = xDocSh->GetDocument();
1363 ScDocument& rDocRes = xDocShRes->GetDocument();
1364 rDoc.CalcAll();
1366 for (SCROW i = 0; i <= 9; ++i)
1368 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
1369 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
1370 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1374 void ScOpenCLTest::testFinancialCoupdaysFormula()
1376 if(!initTestEnv("opencl/financial/Coupdays.", XLS, false))
1377 return;
1378 ScDocument& rDoc = xDocSh->GetDocument();
1379 ScDocument& rDocRes = xDocShRes->GetDocument();
1380 rDoc.CalcAll();
1382 for (SCROW i = 1; i <=10; ++i)
1384 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1385 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1386 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1391 void ScOpenCLTest::testFinancialCoupdaysncFormula()
1393 if(!initTestEnv("opencl/financial/Coupdaysnc.", XLS, false))
1394 return;
1395 ScDocument& rDoc = xDocSh->GetDocument();
1396 ScDocument& rDocRes = xDocShRes->GetDocument();
1397 rDoc.CalcAll();
1399 for (SCROW i = 1; i <=10; ++i)
1401 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1402 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1403 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1406 void ScOpenCLTest::testFinacialRateFormula()
1408 if(!initTestEnv("opencl/financial/RATE.", XLS, false))
1409 return;
1410 ScDocument& rDoc = xDocSh->GetDocument();
1411 ScDocument& rDocRes = xDocShRes->GetDocument();
1412 rDoc.CalcAll();
1414 for (SCROW i = 1; i <= 5; ++i)
1416 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
1417 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
1418 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1422 void ScOpenCLTest::testFinancialAccrintmFormula()
1424 if(!initTestEnv("opencl/financial/Accrintm.", XLS, false))
1425 return;
1426 ScDocument& rDoc = xDocSh->GetDocument();
1427 ScDocument& rDocRes = xDocShRes->GetDocument();
1428 rDoc.CalcAll();
1430 for (SCROW i = 1; i <= 10; ++i)
1432 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1433 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1434 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1438 void ScOpenCLTest::testFinancialCoupnumFormula()
1440 if(!initTestEnv("opencl/financial/Coupnum.", XLS, false))
1441 return;
1442 ScDocument& rDoc = xDocSh->GetDocument();
1443 ScDocument& rDocRes = xDocShRes->GetDocument();
1444 rDoc.CalcAll();
1446 for (SCROW i = 0; i <= 9; ++i)
1448 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1449 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1450 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1454 void ScOpenCLTest::testStatisticalFormulaNegbinomdist()
1456 if(!initTestEnv("opencl/statistical/Negbinomdist.", XLS, false))
1457 return;
1458 ScDocument& rDoc = xDocSh->GetDocument();
1459 ScDocument& rDocRes = xDocShRes->GetDocument();
1460 rDoc.CalcAll();
1462 // Check the results of formula cells in the shared formula range.
1463 for (SCROW i = 0; i <= 9; ++i)
1465 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
1466 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
1467 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1471 void ScOpenCLTest::testMathFormulaSin()
1473 if(!initTestEnv("opencl/math/sin.", XLS, false))
1474 return;
1475 ScDocument& rDoc = xDocSh->GetDocument();
1476 ScDocument& rDocRes = xDocShRes->GetDocument();
1477 rDoc.CalcAll();
1479 for (SCROW i = 0; i <= 15; ++i)
1481 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1482 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1483 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1487 void ScOpenCLTest::testMathFormulaSumSQ()
1489 if(!initTestEnv("opencl/math/sumsq.", XLS, false))
1490 return;
1491 ScDocument& rDoc = xDocSh->GetDocument();
1492 ScDocument& rDocRes = xDocShRes->GetDocument();
1493 rDoc.CalcAll();
1495 for (SCROW i = 0; i < 20; ++i)
1497 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
1498 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
1499 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1503 void ScOpenCLTest::testMathFormulaTan()
1505 if(!initTestEnv("opencl/math/tan.", XLS, false))
1506 return;
1507 ScDocument& rDoc = xDocSh->GetDocument();
1508 ScDocument& rDocRes = xDocShRes->GetDocument();
1509 rDoc.CalcAll();
1511 for (SCROW i = 0; i <= 15; ++i)
1513 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1514 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1515 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1519 void ScOpenCLTest::testMathFormulaTanH()
1521 if(!initTestEnv("opencl/math/tanh.", XLS, false))
1522 return;
1523 ScDocument& rDoc = xDocSh->GetDocument();
1524 ScDocument& rDocRes = xDocShRes->GetDocument();
1525 rDoc.CalcAll();
1527 for (SCROW i = 0; i <= 15; ++i)
1529 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1530 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1531 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1535 void ScOpenCLTest::testMathFormulaSqrt()
1537 if(!initTestEnv("opencl/math/sqrt.", XLS, false))
1538 return;
1539 ScDocument& rDoc = xDocSh->GetDocument();
1540 ScDocument& rDocRes = xDocShRes->GetDocument();
1541 rDoc.CalcAll();
1543 for (SCROW i = 0; i <= 15; ++i)
1545 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1546 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1547 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1551 void ScOpenCLTest::testFinacialPriceFormula()
1553 if(!initTestEnv("opencl/financial/Price.", XLS, false))
1554 return;
1555 ScDocument& rDoc = xDocSh->GetDocument();
1556 ScDocument& rDocRes = xDocShRes->GetDocument();
1557 rDoc.CalcAll();
1559 for (SCROW i = 1; i <= 10; ++i)
1561 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
1562 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
1563 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1567 void ScOpenCLTest::testFinacialDollarfrFormula()
1569 if(!initTestEnv("opencl/financial/Dollarfr.", XLS, false))
1570 return;
1571 ScDocument& rDoc = xDocSh->GetDocument();
1572 ScDocument& rDocRes = xDocShRes->GetDocument();
1573 rDoc.CalcAll();
1575 for (SCROW i = 0; i <= 9; ++i)
1577 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
1578 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
1579 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1583 void ScOpenCLTest::testFinacialPriceDiscFormula()
1585 if(!initTestEnv("opencl/financial/PriceDisc.", XLS, false))
1586 return;
1587 ScDocument& rDoc = xDocSh->GetDocument();
1588 ScDocument& rDocRes = xDocShRes->GetDocument();
1589 rDoc.CalcAll();
1591 for (SCROW i = 0; i <= 10; ++i)
1593 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1594 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1595 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1599 void ScOpenCLTest::testFinacialODDLPRICEFormula()
1601 if(!initTestEnv("opencl/financial/Oddlprice.", XLS, false))
1602 return;
1603 ScDocument& rDoc = xDocSh->GetDocument();
1604 ScDocument& rDocRes = xDocShRes->GetDocument();
1605 rDoc.CalcAll();
1607 for (SCROW i = 1; i <= 10; ++i)
1609 double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
1610 double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
1611 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1615 void ScOpenCLTest:: testFinacialOddlyieldFormula()
1617 if(!initTestEnv("opencl/financial/Oddlyield.", XLS, false))
1618 return;
1619 ScDocument& rDoc = xDocSh->GetDocument();
1620 ScDocument& rDocRes = xDocShRes->GetDocument();
1621 rDoc.CalcAll();
1623 for (SCROW i = 0; i <= 6; ++i)
1625 double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
1626 double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
1627 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1631 void ScOpenCLTest::testFinacialDISCFormula()
1633 if(!initTestEnv("opencl/financial/DISC.", XLS, false))
1634 return;
1635 ScDocument& rDoc = xDocSh->GetDocument();
1636 ScDocument& rDocRes = xDocShRes->GetDocument();
1637 rDoc.CalcAll();
1639 for (SCROW i = 0; i <= 9; ++i)
1641 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1642 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1643 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1647 void ScOpenCLTest:: testFinacialPVFormula()
1649 if(!initTestEnv("opencl/financial/PV.", XLS, false))
1650 return;
1651 ScDocument& rDoc = xDocSh->GetDocument();
1652 ScDocument& rDocRes = xDocShRes->GetDocument();
1653 rDoc.CalcAll();
1655 for (SCROW i = 0; i <= 9; ++i)
1657 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1658 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1659 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1663 void ScOpenCLTest::testFinacialINTRATEFormula()
1665 if(!initTestEnv("opencl/financial/INTRATE.", XLS, false))
1666 return;
1667 ScDocument& rDoc = xDocSh->GetDocument();
1668 ScDocument& rDocRes = xDocShRes->GetDocument();
1669 rDoc.CalcAll();
1671 for (SCROW i = 0; i <= 9; ++i)
1673 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1674 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1675 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1679 void ScOpenCLTest::testStatisticalFormulaStandard()
1681 if(!initTestEnv("opencl/statistical/Standard.", XLS, false))
1682 return;
1683 ScDocument& rDoc = xDocSh->GetDocument();
1684 ScDocument& rDocRes = xDocShRes->GetDocument();
1685 rDoc.CalcAll();
1687 // Check the results of formula cells in the shared formula range.
1688 for (SCROW i = 1; i <= 20; ++i)
1690 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
1691 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
1692 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1696 void ScOpenCLTest::testStatisticalFormulaWeibull()
1698 if(!initTestEnv("opencl/statistical/Weibull.", XLS, false))
1699 return;
1700 ScDocument& rDoc = xDocSh->GetDocument();
1701 ScDocument& rDocRes = xDocShRes->GetDocument();
1702 rDoc.CalcAll();
1704 // Check the results of formula cells in the shared formula range.
1705 for (SCROW i = 1; i <= 20; ++i)
1707 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
1708 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
1709 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
1710 fExcel == 0?1e-4:fabs(1e-4*fExcel));
1714 void ScOpenCLTest::testStatisticalFormulaVar()
1716 if(!initTestEnv("opencl/statistical/Var.", XLS, false))
1717 return;
1718 ScDocument& rDoc = xDocSh->GetDocument();
1719 ScDocument& rDocRes = xDocShRes->GetDocument();
1720 rDoc.CalcAll();
1722 // Check the results of formula cells in the shared formula range.
1723 for (SCROW i = 1; i <= 20; ++i)
1725 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1726 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1727 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1731 void ScOpenCLTest::testStatisticalFormulaSkew()
1733 if(!initTestEnv("opencl/statistical/Skew.", XLS, false))
1734 return;
1735 ScDocument& rDoc = xDocSh->GetDocument();
1736 ScDocument& rDocRes = xDocShRes->GetDocument();
1737 rDoc.CalcAll();
1739 // Check the results of formula cells in the shared formula range.
1740 for (SCROW i = 1; i <= 20; ++i)
1742 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1743 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1744 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1748 void ScOpenCLTest::testStatisticalFormulaSkewp()
1750 if(!initTestEnv("opencl/statistical/Skewp.", XLS, false))
1751 return;
1752 ScDocument& rDoc = xDocSh->GetDocument();
1753 ScDocument& rDocRes = xDocShRes->GetDocument();
1754 rDoc.CalcAll();
1756 // Check the results of formula cells in the shared formula range.
1757 for (SCROW i = 1; i <= 20; ++i)
1759 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1760 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1761 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1765 void ScOpenCLTest::testStatisticalFormulaPearson()
1767 if(!initTestEnv("opencl/statistical/Pearson.", XLS, false))
1768 return;
1769 ScDocument& rDoc = xDocSh->GetDocument();
1770 ScDocument& rDocRes = xDocShRes->GetDocument();
1771 rDoc.CalcAll();
1773 // Check the results of formula cells in the shared formula range.
1774 for (SCROW i = 1; i <= 9; ++i)
1776 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1777 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1778 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1782 void ScOpenCLTest::testStatisticalFormulaRsq()
1784 if(!initTestEnv("opencl/statistical/Rsq.", XLS, false))
1785 return;
1786 ScDocument& rDoc = xDocSh->GetDocument();
1787 ScDocument& rDocRes = xDocShRes->GetDocument();
1788 rDoc.CalcAll();
1790 // Check the results of formula cells in the shared formula range.
1791 for (SCROW i = 1; i <= 9; ++i)
1793 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1794 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1795 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1799 void ScOpenCLTest::testMathFormulaTrunc()
1801 if(!initTestEnv("opencl/math/trunc.", XLS, false))
1802 return;
1803 ScDocument& rDoc = xDocSh->GetDocument();
1804 ScDocument& rDocRes = xDocShRes->GetDocument();
1805 rDoc.CalcAll();
1807 for (SCROW i = 0; i <= 15; ++i)
1809 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1810 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1811 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1815 void ScOpenCLTest::testMathFormulaCosh()
1817 if(!initTestEnv("opencl/math/cosh.", XLS, false))
1818 return;
1819 ScDocument& rDoc = xDocSh->GetDocument();
1820 ScDocument& rDocRes = xDocShRes->GetDocument();
1821 rDoc.CalcAll();
1823 for (SCROW i = 0; i <= 15; ++i)
1825 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1826 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1827 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1830 void ScOpenCLTest::testStatisticalFormulaCovar()
1832 if(!initTestEnv("opencl/statistical/Covar.", XLS, false))
1833 return;
1834 ScDocument& rDoc = xDocSh->GetDocument();
1835 ScDocument& rDocRes = xDocShRes->GetDocument();
1836 rDoc.CalcAll();
1838 // Check the results of formula cells in the shared formula range.
1839 for (SCROW i = 0; i <= 16; ++i)
1841 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1842 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1843 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1847 void ScOpenCLTest::testStatisticalFormulaKurt()
1849 if(!initTestEnv("opencl/statistical/Kurt.", XLS, false))
1850 return;
1851 ScDocument& rDoc = xDocSh->GetDocument();
1852 ScDocument& rDocRes = xDocShRes->GetDocument();
1853 rDoc.CalcAll();
1855 // Check the results of formula cells in the shared formula range.
1856 for (SCROW i = 1; i <= 19; ++i)
1858 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1859 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1860 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1864 void ScOpenCLTest::testMathFormulaCot()
1866 if(!initTestEnv("opencl/math/cot.", ODS, false))
1867 return;
1868 ScDocument& rDoc = xDocSh->GetDocument();
1869 ScDocument& rDocRes = xDocShRes->GetDocument();
1870 rDoc.CalcAll();
1872 for (SCROW i = 0; i <= 15; ++i)
1874 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1875 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1876 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1880 void ScOpenCLTest::testStatisticalFormulaDevSq()
1882 if(!initTestEnv("opencl/statistical/DevSq.", XLS, false))
1883 return;
1884 ScDocument& rDoc = xDocSh->GetDocument();
1885 ScDocument& rDocRes = xDocShRes->GetDocument();
1886 rDoc.CalcAll();
1888 // Check the results of formula cells in the shared formula range.
1889 for (SCROW i = 0; i <= 11; ++i)
1891 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1892 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1893 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1897 void ScOpenCLTest::testMathFormulaCsc()
1899 if(!initTestEnv("opencl/math/csc.", ODS, false))
1900 return;
1901 ScDocument& rDoc = xDocSh->GetDocument();
1902 ScDocument& rDocRes = xDocShRes->GetDocument();
1903 rDoc.CalcAll();
1905 for (SCROW i = 0; i <= 15; ++i)
1907 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1908 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1909 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1913 void ScOpenCLTest::testMathFormulaCoth()
1915 if(!initTestEnv("opencl/math/coth.", ODS, false))
1916 return;
1917 ScDocument& rDoc = xDocSh->GetDocument();
1918 ScDocument& rDocRes = xDocShRes->GetDocument();
1919 rDoc.CalcAll();
1921 for (SCROW i = 0; i <= 15; ++i)
1923 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1924 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1925 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1929 void ScOpenCLTest::testFinacialXNPVFormula()
1931 if(!initTestEnv("opencl/financial/XNPV.", XLS, false))
1932 return;
1933 ScDocument& rDoc = xDocSh->GetDocument();
1934 ScDocument& rDocRes = xDocShRes->GetDocument();
1935 rDoc.CalcAll();
1937 for (SCROW i = 1; i <= 9; ++i)
1939 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1940 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1941 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1944 for (SCROW i = 16; i <= 26; ++i)
1946 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1947 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1948 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1952 void ScOpenCLTest::testStatisticalFormulaIntercept()
1954 if(!initTestEnv("opencl/statistical/Intercept.", XLS, false))
1955 return;
1956 ScDocument& rDoc = xDocSh->GetDocument();
1957 ScDocument& rDocRes = xDocShRes->GetDocument();
1958 rDoc.CalcAll();
1960 for (SCROW i = 1; i <= 19; ++i)
1962 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1963 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1964 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1968 void ScOpenCLTest::testFinancialAmordegrcFormula()
1970 if(!initTestEnv("opencl/financial/Amordegrc.", XLS, false))
1971 return;
1972 ScDocument& rDoc = xDocSh->GetDocument();
1973 ScDocument& rDocRes = xDocShRes->GetDocument();
1974 rDoc.CalcAll();
1976 for (SCROW i = 0; i <= 9; ++i)
1978 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
1979 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
1980 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1984 void ScOpenCLTest:: testFinancialISPMTFormula()
1986 if(!initTestEnv("opencl/financial/ISPMT.", XLS, false))
1987 return;
1988 ScDocument& rDoc = xDocSh->GetDocument();
1989 ScDocument& rDocRes = xDocShRes->GetDocument();
1990 rDoc.CalcAll();
1992 for (SCROW i = 0; i <= 9; ++i)
1994 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1995 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1996 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2000 void ScOpenCLTest::testStatisticalFormulaMedian()
2002 if(!initTestEnv("opencl/statistical/Median.", XLS, false))
2003 return;
2004 ScDocument& rDoc = xDocSh->GetDocument();
2005 ScDocument& rDocRes = xDocShRes->GetDocument();
2006 rDoc.CalcAll();
2008 // Check the results of formula cells in the shared formula range.
2009 for (SCROW i = 1; i <= 9; ++i)
2011 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2012 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2013 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2017 void ScOpenCLTest::testStatisticalFormulaNormdist()
2019 if(!initTestEnv("opencl/statistical/Normdist.", XLS, false))
2020 return;
2021 ScDocument& rDoc = xDocSh->GetDocument();
2022 ScDocument& rDocRes = xDocShRes->GetDocument();
2023 rDoc.CalcAll();
2025 // Check the results of formula cells in the shared formula range.
2026 for (SCROW i = 1; i <= 19; ++i)
2028 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
2029 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
2030 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2034 void ScOpenCLTest::testStatisticalFormulaNormsdist()
2036 if(!initTestEnv("opencl/statistical/Normsdist.", XLS, false))
2037 return;
2038 ScDocument& rDoc = xDocSh->GetDocument();
2039 ScDocument& rDocRes = xDocShRes->GetDocument();
2040 rDoc.CalcAll();
2042 // Check the results of formula cells in the shared formula range.
2043 for (SCROW i = 1; i <= 19; ++i)
2045 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2046 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2047 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2051 void ScOpenCLTest::testStatisticalFormulaPermut()
2053 if(!initTestEnv("opencl/statistical/Permut.", XLS, false))
2054 return;
2055 ScDocument& rDoc = xDocSh->GetDocument();
2056 ScDocument& rDocRes = xDocShRes->GetDocument();
2057 rDoc.CalcAll();
2059 // Check the results of formula cells in the shared formula range.
2060 for (SCROW i = 1; i <= 19; ++i)
2062 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2063 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2064 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2068 void ScOpenCLTest::testStatisticalFormulaPermutation()
2070 if(!initTestEnv("opencl/statistical/Permutation.", XLS, false))
2071 return;
2072 ScDocument& rDoc = xDocSh->GetDocument();
2073 ScDocument& rDocRes = xDocShRes->GetDocument();
2074 rDoc.CalcAll();
2076 // Check the results of formula cells in the shared formula range.
2077 for (SCROW i = 1; i <= 9; ++i)
2079 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2080 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2081 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2085 void ScOpenCLTest::testStatisticalFormulaPhi()
2087 if(!initTestEnv("opencl/statistical/Phi.", XLS, false))
2088 return;
2089 ScDocument& rDoc = xDocSh->GetDocument();
2090 ScDocument& rDocRes = xDocShRes->GetDocument();
2091 rDoc.CalcAll();
2093 // Check the results of formula cells in the shared formula range.
2094 for (SCROW i = 1; i <= 19; ++i)
2096 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2097 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2098 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2102 void ScOpenCLTest::testMathFormulaCscH()
2104 if(!initTestEnv("opencl/math/csch.", ODS, false))
2105 return;
2106 ScDocument& rDoc = xDocSh->GetDocument();
2107 ScDocument& rDocRes = xDocShRes->GetDocument();
2108 rDoc.CalcAll();
2110 for (SCROW i = 0; i <= 15; ++i)
2112 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2113 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2114 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2118 void ScOpenCLTest::testStatisticalFormulaLogInv()
2120 if(!initTestEnv("opencl/statistical/LogInv.", XLS, false))
2121 return;
2122 ScDocument& rDoc = xDocSh->GetDocument();
2123 ScDocument& rDocRes = xDocShRes->GetDocument();
2124 rDoc.CalcAll();
2126 // Check the results of formula cells in the shared formula range.
2127 for (SCROW i = 1; i <= 19; ++i)
2129 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2130 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2131 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2135 void ScOpenCLTest::testFinacialNPERFormula()
2137 if(!initTestEnv("opencl/financial/NPER.", XLS, false))
2138 return;
2139 ScDocument& rDoc = xDocSh->GetDocument();
2140 ScDocument& rDocRes = xDocShRes->GetDocument();
2141 rDoc.CalcAll();
2143 for (SCROW i = 0; i <= 10; ++i)
2145 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2146 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2147 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2151 void ScOpenCLTest::testStatisticalFormulaForecast()
2153 if(!initTestEnv("opencl/statistical/Forecast.", XLS, false))
2154 return;
2155 ScDocument& rDoc = xDocSh->GetDocument();
2156 ScDocument& rDocRes = xDocShRes->GetDocument();
2157 rDoc.CalcAll();
2159 // Check the results of formula cells in the shared formula range.
2160 for (SCROW i = 1; i <= 19; ++i)
2162 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2163 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2164 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2168 void ScOpenCLTest::testFinancialAmorlincFormula()
2170 if(!initTestEnv("opencl/financial/Amorlinc.", XLS, false))
2171 return;
2172 ScDocument& rDoc = xDocSh->GetDocument();
2173 ScDocument& rDocRes = xDocShRes->GetDocument();
2174 rDoc.CalcAll();
2176 for (SCROW i = 0; i <= 9; ++i)
2178 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
2179 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
2180 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2184 void ScOpenCLTest::testFinancialDDBFormula()
2186 if(!initTestEnv("opencl/financial/ddb.", XLS, false))
2187 return;
2188 ScDocument& rDoc = xDocSh->GetDocument();
2189 ScDocument& rDocRes = xDocShRes->GetDocument();
2190 rDoc.CalcAll();
2192 for (SCROW i = 0; i <= 9; ++i)
2194 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2195 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2196 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2199 void ScOpenCLTest::testFinacialPriceMatFormula()
2201 if(!initTestEnv("opencl/financial/PriceMat.", XLS, false))
2202 return;
2203 ScDocument& rDoc = xDocSh->GetDocument();
2204 ScDocument& rDocRes = xDocShRes->GetDocument();
2205 rDoc.CalcAll();
2207 for (SCROW i = 0; i <= 9; ++i)
2209 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2210 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2211 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2214 void ScOpenCLTest::testFinacialFormulaReceived()
2216 if(!initTestEnv("opencl/financial/Received.", XLS, false))
2217 return;
2218 ScDocument& rDoc = xDocSh->GetDocument();
2219 ScDocument& rDocRes = xDocShRes->GetDocument();
2220 rDoc.CalcAll();
2222 // Check the results of formula cells in the shared formula range.
2223 for (SCROW i = 0; i < 10; ++i)
2225 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
2226 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
2227 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2230 void ScOpenCLTest::testFinancialFormulaCumipmt()
2232 if(!initTestEnv("opencl/financial/Cumipmt.", XLS, false))
2233 return;
2234 ScDocument& rDoc = xDocSh->GetDocument();
2235 ScDocument& rDocRes = xDocShRes->GetDocument();
2236 rDoc.CalcAll();
2238 // Check the results of formula cells in the shared formula range.
2239 for (SCROW i = 1; i <= 10; ++i)
2241 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
2242 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
2243 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2246 void ScOpenCLTest::testFinancialFormulaCumprinc()
2248 if(!initTestEnv("opencl/financial/Cumprinc.", XLS, false))
2249 return;
2250 ScDocument& rDoc = xDocSh->GetDocument();
2251 ScDocument& rDocRes = xDocShRes->GetDocument();
2252 rDoc.CalcAll();
2254 // Check the results of formula cells in the shared formula range.
2255 for (SCROW i = 1; i <= 10; ++i)
2257 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
2258 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
2259 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2262 void ScOpenCLTest::testFinacialRRIFormula()
2264 if(!initTestEnv("opencl/financial/RRI.", XLS, false))
2265 return;
2266 ScDocument& rDoc = xDocSh->GetDocument();
2267 ScDocument& rDocRes = xDocShRes->GetDocument();
2268 rDoc.CalcAll();
2270 for (SCROW i = 0; i <= 9; ++i)
2272 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2273 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2274 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2277 void ScOpenCLTest::testFinacialEFFECT_ADDFormula()
2279 if(!initTestEnv("opencl/financial/EFFECT_ADD.", XLS, false))
2280 return;
2281 ScDocument& rDoc = xDocSh->GetDocument();
2282 ScDocument& rDocRes = xDocShRes->GetDocument();
2283 rDoc.CalcAll();
2285 for (SCROW i = 0; i <= 9; ++i)
2287 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
2288 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
2289 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2292 void ScOpenCLTest::testFinacialNominalFormula()
2294 if(!initTestEnv("opencl/financial/Nominal.", XLS, false))
2295 return;
2296 ScDocument& rDoc = xDocSh->GetDocument();
2297 ScDocument& rDocRes = xDocShRes->GetDocument();
2298 rDoc.CalcAll();
2301 // Check the results of formula cells in the shared formula range.
2302 for (SCROW i = 1; i <= 19; ++i)
2304 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2305 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2306 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2309 void ScOpenCLTest::testFinacialTBILLEQFormula()
2311 if(!initTestEnv("opencl/financial/TBILLEQ.", XLS, false))
2312 return;
2313 ScDocument& rDoc = xDocSh->GetDocument();
2314 ScDocument& rDocRes = xDocShRes->GetDocument();
2315 rDoc.CalcAll();
2317 for (SCROW i = 0; i <= 6; ++i)
2319 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2320 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2321 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2324 void ScOpenCLTest::testFinacialTBILLPRICEFormula()
2326 if(!initTestEnv("opencl/financial/TBILLPRICE.", XLS, false))
2327 return;
2328 ScDocument& rDoc = xDocSh->GetDocument();
2329 ScDocument& rDocRes = xDocShRes->GetDocument();
2330 rDoc.CalcAll();
2332 for (SCROW i = 0; i <= 6; ++i)
2334 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2335 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2336 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2339 void ScOpenCLTest::testFinacialTBILLYIELDFormula()
2341 if(!initTestEnv("opencl/financial/TBILLYIELD.", XLS, false))
2342 return;
2343 ScDocument& rDoc = xDocSh->GetDocument();
2344 ScDocument& rDocRes = xDocShRes->GetDocument();
2345 rDoc.CalcAll();
2347 for (SCROW i = 0; i <= 6; ++i)
2349 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2350 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2351 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2354 void ScOpenCLTest::testFinacialYIELDFormula()
2356 if(!initTestEnv("opencl/financial/YIELD.", XLS, false))
2357 return;
2358 ScDocument& rDoc = xDocSh->GetDocument();
2359 ScDocument& rDocRes = xDocShRes->GetDocument();
2360 rDoc.CalcAll();
2362 for (SCROW i = 0; i <= 6; ++i)
2364 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
2365 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
2366 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2370 void ScOpenCLTest::testFinacialYIELDDISCFormula()
2372 if(!initTestEnv("opencl/financial/YIELDDISC.", XLS, false))
2373 return;
2374 ScDocument& rDoc = xDocSh->GetDocument();
2375 ScDocument& rDocRes = xDocShRes->GetDocument();
2376 rDoc.CalcAll();
2378 for (SCROW i = 0; i <= 6; ++i)
2380 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2381 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2382 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2386 void ScOpenCLTest::testFinacialYIELDMATFormula()
2388 if(!initTestEnv("opencl/financial/YIELDMAT.", XLS, false))
2389 return;
2390 ScDocument& rDoc = xDocSh->GetDocument();
2391 ScDocument& rDocRes = xDocShRes->GetDocument();
2392 rDoc.CalcAll();
2394 for (SCROW i = 0; i <= 6; ++i)
2396 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2397 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2398 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2401 void ScOpenCLTest:: testFinacialPMTFormula()
2403 if(!initTestEnv("opencl/financial/PMT.", XLS, false))
2404 return;
2405 ScDocument& rDoc = xDocSh->GetDocument();
2406 ScDocument& rDocRes = xDocShRes->GetDocument();
2407 rDoc.CalcAll();
2409 for (SCROW i = 0; i <= 6; ++i)
2411 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2412 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2413 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2417 void ScOpenCLTest:: testFinancialDurationFormula()
2419 if(!initTestEnv("opencl/financial/Duration.", ODS, false))
2420 return;
2421 ScDocument& rDoc = xDocSh->GetDocument();
2422 ScDocument& rDocRes = xDocShRes->GetDocument();
2423 rDoc.CalcAll();
2425 for (SCROW i = 0; i <= 9; ++i)
2427 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2428 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2429 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2433 void ScOpenCLTest::testStatisticalFormulaLogNormDist()
2435 if(!initTestEnv("opencl/statistical/LogNormDist.", ODS, false))
2436 return;
2437 ScDocument& rDoc = xDocSh->GetDocument();
2438 ScDocument& rDocRes = xDocShRes->GetDocument();
2439 rDoc.CalcAll();
2441 // Check the results of formula cells in the shared formula range.
2442 for (SCROW i = 1; i <= 19; ++i)
2444 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
2445 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
2446 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2450 void ScOpenCLTest::testMathFormulaArcCos()
2452 if(!initTestEnv("opencl/math/ArcCos.", ODS, false))
2453 return;
2454 ScDocument& rDoc = xDocSh->GetDocument();
2455 ScDocument& rDocRes = xDocShRes->GetDocument();
2456 rDoc.CalcAll();
2458 // Verify ACos Function
2459 for (SCROW i = 1; i <= 1000; ++i)
2461 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2462 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2463 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2467 void ScOpenCLTest::testMathFormulaPower()
2469 if(!initTestEnv("opencl/math/power.", ODS, false))
2470 return;
2471 ScDocument& rDoc = xDocSh->GetDocument();
2472 ScDocument& rDocRes = xDocShRes->GetDocument();
2473 rDoc.CalcAll();
2475 for (SCROW i = 0; i <= 15; ++i)
2477 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2478 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2479 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2483 void ScOpenCLTest:: testFinacialPPMTFormula()
2485 if(!initTestEnv("opencl/financial/PPMT.", XLS, false))
2486 return;
2487 ScDocument& rDoc = xDocSh->GetDocument();
2488 ScDocument& rDocRes = xDocShRes->GetDocument();
2489 rDoc.CalcAll();
2491 for (SCROW i = 0; i <= 6; ++i)
2493 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2494 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2495 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2499 void ScOpenCLTest:: testFinacialNPVFormula()
2501 if(!initTestEnv("opencl/financial/NPV.", XLS, false))
2502 return;
2503 ScDocument& rDoc = xDocSh->GetDocument();
2504 ScDocument& rDocRes = xDocShRes->GetDocument();
2505 rDoc.CalcAll();
2507 for (SCROW i = 0; i <= 6; ++i)
2509 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2510 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2511 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2515 void ScOpenCLTest:: testFinancialDuration_ADDFormula()
2517 if(!initTestEnv("opencl/financial/Duration_ADD.", XLS, false))
2518 return;
2519 ScDocument& rDoc = xDocSh->GetDocument();
2520 ScDocument& rDocRes = xDocShRes->GetDocument();
2521 rDoc.CalcAll();
2523 for (SCROW i = 0; i <= 9; ++i)
2525 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2526 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2527 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2531 void ScOpenCLTest::testStatisticalFormulaNorminv()
2533 if(!initTestEnv("opencl/statistical/Norminv.", XLS, false))
2534 return;
2535 ScDocument& rDoc = xDocSh->GetDocument();
2536 ScDocument& rDocRes = xDocShRes->GetDocument();
2537 rDoc.CalcAll();
2539 // Check the results of formula cells in the shared formula range.
2540 for (SCROW i = 1; i <= 19; ++i)
2542 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2543 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2544 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2548 void ScOpenCLTest::testStatisticalFormulaNormsinv()
2550 if(!initTestEnv("opencl/statistical/Normsinv.", XLS, false))
2551 return;
2552 ScDocument& rDoc = xDocSh->GetDocument();
2553 ScDocument& rDocRes = xDocShRes->GetDocument();
2554 rDoc.CalcAll();
2556 // Check the results of formula cells in the shared formula range.
2557 for (SCROW i = 1; i <= 19; ++i)
2559 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2560 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2561 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2565 void ScOpenCLTest::testMathFormulaArcCosHyp()
2567 if(!initTestEnv("opencl/math/ArcCosHyp.", ODS, false))
2568 return;
2569 ScDocument& rDoc = xDocSh->GetDocument();
2570 ScDocument& rDocRes = xDocShRes->GetDocument();
2571 rDoc.CalcAll();
2573 // Verify ACosH Function
2574 for (SCROW i = 1; i <= 1000; ++i)
2576 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2577 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2578 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2582 void ScOpenCLTest:: testFinancialMDurationFormula()
2584 if(!initTestEnv("opencl/financial/MDuration.", XLS, false))
2585 return;
2586 ScDocument& rDoc = xDocSh->GetDocument();
2587 ScDocument& rDocRes = xDocShRes->GetDocument();
2588 rDoc.CalcAll();
2590 for (SCROW i = 0; i <= 9; ++i)
2592 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2593 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2594 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2598 void ScOpenCLTest::testMathFormulaArcCot()
2600 if(!initTestEnv("opencl/math/ArcCot.", ODS, false))
2601 return;
2602 ScDocument& rDoc = xDocSh->GetDocument();
2603 ScDocument& rDocRes = xDocShRes->GetDocument();
2604 rDoc.CalcAll();
2606 // Verify ACot Function
2607 for (SCROW i = 1; i <= 1000; ++i)
2609 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2610 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2611 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2615 void ScOpenCLTest:: testFinancialFVFormula()
2617 if(!initTestEnv("opencl/financial/FV.", XLS, false))
2618 return;
2619 ScDocument& rDoc = xDocSh->GetDocument();
2620 ScDocument& rDocRes = xDocShRes->GetDocument();
2621 rDoc.CalcAll();
2623 for (SCROW i = 0; i <= 9; ++i)
2625 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2626 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2627 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2631 void ScOpenCLTest::testFinancialDBFormula()
2633 if(!initTestEnv("opencl/financial/db.", XLS, false))
2634 return;
2635 ScDocument& rDoc = xDocSh->GetDocument();
2636 ScDocument& rDocRes = xDocShRes->GetDocument();
2637 rDoc.CalcAll();
2639 for (SCROW i = 0; i <= 9; ++i)
2641 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2642 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2643 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2647 void ScOpenCLTest::testFinancialCouppcdFormula()
2649 if(!initTestEnv("opencl/financial/Couppcd.", XLS, false))
2650 return;
2651 ScDocument& rDoc = xDocSh->GetDocument();
2652 ScDocument& rDocRes = xDocShRes->GetDocument();
2653 rDoc.CalcAll();
2655 for (SCROW i = 0; i <= 9; ++i)
2657 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
2658 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
2659 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2663 void ScOpenCLTest::testMathSumIfsFormula()
2665 if(!initTestEnv("opencl/math/sumifs.", XLS, false))
2666 return;
2667 ScDocument& rDoc = xDocSh->GetDocument();
2668 ScDocument& rDocRes = xDocShRes->GetDocument();
2669 xDocSh->DoHardRecalc(true);
2671 for (SCROW i = 2; i <= 11; ++i)
2673 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
2674 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
2675 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2677 for (SCROW i = 2; i <= 11; ++i)
2679 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
2680 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
2681 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2683 for (SCROW i = 2; i <= 11; ++i)
2685 double fLibre = rDoc.GetValue(ScAddress(7,i,0));
2686 double fExcel = rDocRes.GetValue(ScAddress(7,i,0));
2687 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2689 for (SCROW i = 2; i <= 11; ++i)
2691 double fLibre = rDoc.GetValue(ScAddress(8,i,0));
2692 double fExcel = rDocRes.GetValue(ScAddress(8,i,0));
2693 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2697 void ScOpenCLTest::testMathFormulaArcCotHyp()
2699 if(!initTestEnv("opencl/math/ArcCotHyp.", ODS, false))
2700 return;
2701 ScDocument& rDoc = xDocSh->GetDocument();
2702 ScDocument& rDocRes = xDocShRes->GetDocument();
2703 rDoc.CalcAll();
2705 // Verify ACotH Function
2706 for (SCROW i = 1; i <= 1000; ++i)
2708 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2709 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2710 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2714 void ScOpenCLTest::testMathFormulaArcSin()
2716 if(!initTestEnv("opencl/math/ArcSin.", ODS, false))
2717 return;
2718 ScDocument& rDoc = xDocSh->GetDocument();
2719 ScDocument& rDocRes = xDocShRes->GetDocument();
2720 rDoc.CalcAll();
2722 // Verify ACotH Function
2723 for (SCROW i = 1; i <= 1000; ++i)
2725 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2726 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2727 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2731 void ScOpenCLTest:: testFinancialVDBFormula()
2733 if(!initTestEnv("opencl/financial/VDB.", XLS, false))
2734 return;
2735 ScDocument& rDoc = xDocSh->GetDocument();
2736 ScDocument& rDocRes = xDocShRes->GetDocument();
2737 rDoc.CalcAll();
2739 for (SCROW i = 0; i <= 10; ++i)
2741 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
2742 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
2743 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2745 for (SCROW i = 15; i <= 26; ++i)
2747 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2748 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2749 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2751 for (SCROW i = 30; i <= 41; ++i)
2753 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2754 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2755 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2759 void ScOpenCLTest:: testFinancialIPMTFormula()
2761 if(!initTestEnv("opencl/financial/IPMT.", XLS, false))
2762 return;
2763 ScDocument& rDoc = xDocSh->GetDocument();
2764 ScDocument& rDocRes = xDocShRes->GetDocument();
2765 rDoc.CalcAll();
2767 for (SCROW i = 0; i <= 9; ++i)
2769 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2770 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2771 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2775 void ScOpenCLTest:: testFinancialXirrFormula()
2777 if(!initTestEnv("opencl/financial/XIRR.", ODS, false))
2778 return;
2779 ScDocument& rDoc = xDocSh->GetDocument();
2780 rDoc.CalcAll();
2782 for (SCROW i = 1; i <= 10; ++i)
2784 double fFormula = rDoc.GetValue(ScAddress(2, i, 0));
2785 double fExpected = rDoc.GetValue(ScAddress(3, i, 0));
2786 CPPUNIT_ASSERT(rtl::math::approxEqual(fExpected, fFormula));
2788 for (SCROW i = 18; i <= 27; ++i)
2790 double fFormula = rDoc.GetValue(ScAddress(2, i, 0));
2791 double fExpected = rDoc.GetValue(ScAddress(3, i, 0));
2792 CPPUNIT_ASSERT(rtl::math::approxEqual(fExpected, fFormula));
2798 void ScOpenCLTest::testStatisticalFormulaChiSqDist()
2800 if(!initTestEnv("opencl/statistical/CHISQDIST.", ODS, false))
2801 return;
2802 ScDocument& rDoc = xDocSh->GetDocument();
2803 ScDocument& rDocRes = xDocShRes->GetDocument();
2804 rDoc.CalcAll();
2806 // Check the results of formula cells in the shared formula range.
2807 for (SCROW i = 1; i <= 9; ++i)
2809 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2810 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2811 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2813 for (SCROW i = 1; i <= 9; ++i)
2815 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2816 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2817 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2821 void ScOpenCLTest::testStatisticalFormulaConfidence()
2823 if(!initTestEnv("opencl/statistical/Confidence.", XLS, false))
2824 return;
2825 ScDocument& rDoc = xDocSh->GetDocument();
2826 ScDocument& rDocRes = xDocShRes->GetDocument();
2827 rDoc.CalcAll();
2829 // Check the results of formula cells in the shared formula range.
2830 for (SCROW i = 0; i <= 9; ++i)
2832 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2833 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2834 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2838 void ScOpenCLTest::testStatisticalFormulaFDist()
2840 if(!initTestEnv("opencl/statistical/Fdist.", XLS, false))
2841 return;
2842 ScDocument& rDoc = xDocSh->GetDocument();
2843 ScDocument& rDocRes = xDocShRes->GetDocument();
2844 rDoc.CalcAll();
2846 // Check the results of formula cells in the shared formula range.
2847 for (SCROW i = 0; i <= 9; ++i)
2849 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2850 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2851 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2855 void ScOpenCLTest::testFinancialCoupncdFormula()
2857 if(!initTestEnv("opencl/financial/Coupncd.", XLS, false))
2858 return;
2859 ScDocument& rDoc = xDocSh->GetDocument();
2860 ScDocument& rDocRes = xDocShRes->GetDocument();
2861 rDoc.CalcAll();
2863 for (SCROW i = 0; i <= 9; ++i)
2865 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
2866 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
2867 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2871 void ScOpenCLTest::testFinancialAccrintFormula()
2873 if(!initTestEnv("opencl/financial/Accrint.", XLS, false))
2874 return;
2875 ScDocument& rDoc = xDocSh->GetDocument();
2876 ScDocument& rDocRes = xDocShRes->GetDocument();
2877 rDoc.CalcAll();
2879 for (SCROW i = 0; i <= 9; ++i)
2881 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
2882 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
2883 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2887 void ScOpenCLTest::testStatisticalFormulaCritBinom()
2889 if(!initTestEnv("opencl/statistical/CritBinom.", XLS, false))
2890 return;
2891 ScDocument& rDoc = xDocSh->GetDocument();
2892 ScDocument& rDocRes = xDocShRes->GetDocument();
2893 rDoc.CalcAll();
2895 // Check the results of formula cells in the shared formula range.
2896 for (SCROW i = 0; i <= 9; ++i)
2898 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2899 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2900 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2904 void ScOpenCLTest::testMathFormulaArcSinHyp()
2906 if(!initTestEnv("opencl/math/ArcSinHyp.", ODS, false))
2907 return;
2908 ScDocument& rDoc = xDocSh->GetDocument();
2909 ScDocument& rDocRes = xDocShRes->GetDocument();
2910 rDoc.CalcAll();
2912 // Verify ASinH Function
2913 for (SCROW i = 1; i <= 1000; ++i)
2915 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2916 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2917 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2921 void ScOpenCLTest::testMathFormulaArcTan()
2923 if(!initTestEnv("opencl/math/ArcTan.", ODS, false))
2924 return;
2925 ScDocument& rDoc = xDocSh->GetDocument();
2926 ScDocument& rDocRes = xDocShRes->GetDocument();
2927 rDoc.CalcAll();
2929 // Verify ATan Function
2930 for (SCROW i = 1; i <= 1000; ++i)
2932 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2933 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2934 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2938 void ScOpenCLTest::testMathFormulaArcTanHyp()
2940 if(!initTestEnv("opencl/math/ArcTanHyp.", ODS, false))
2941 return;
2942 ScDocument& rDoc = xDocSh->GetDocument();
2943 ScDocument& rDocRes = xDocShRes->GetDocument();
2944 rDoc.CalcAll();
2946 // Verify ATanH Function
2947 for (SCROW i = 1; i <= 1000; ++i)
2949 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2950 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2951 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2955 void ScOpenCLTest:: testFinacialNPER1Formula()
2957 if(!initTestEnv("opencl/financial/NPER1.", XLS, false))
2958 return;
2959 ScDocument& rDoc = xDocSh->GetDocument();
2960 ScDocument& rDocRes = xDocShRes->GetDocument();
2961 rDoc.CalcAll();
2963 for (SCROW i = 0; i <= 6; ++i)
2965 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2966 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2967 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2971 void ScOpenCLTest::testMathFormulaArcTan2()
2973 if(!initTestEnv("opencl/math/ArcTan2.", ODS, false))
2974 return;
2975 ScDocument& rDoc = xDocSh->GetDocument();
2976 ScDocument& rDocRes = xDocShRes->GetDocument();
2977 rDoc.CalcAll();
2979 // Verify ATan2 Function
2980 for (SCROW i = 1; i <= 17; ++i)
2982 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2983 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2984 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.000001);
2988 void ScOpenCLTest::testStatisticalFormulaChiSqInv()
2990 if(!initTestEnv("opencl/statistical/CHISQINV.", ODS, false))
2991 return;
2992 ScDocument& rDoc = xDocSh->GetDocument();
2993 ScDocument& rDocRes = xDocShRes->GetDocument();
2994 rDoc.CalcAll();
2996 // Check the results of formula cells in the shared formula range.
2997 for (SCROW i = 1; i <= 9; ++i)
2999 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3000 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3001 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3005 void ScOpenCLTest::testMathFormulaBitAnd()
3007 if(!initTestEnv("opencl/math/BitAnd.", ODS, false))
3008 return;
3009 ScDocument& rDoc = xDocSh->GetDocument();
3010 ScDocument& rDocRes = xDocShRes->GetDocument();
3011 rDoc.CalcAll();
3013 // Verify BitAnd Function
3014 for (SCROW i = 1; i <= 1000; ++i)
3016 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3017 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3018 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3022 void ScOpenCLTest::testStatisticalFormulaPoisson()
3024 if(!initTestEnv("opencl/statistical/Poisson.", XLS, false))
3025 return;
3026 ScDocument& rDoc = xDocSh->GetDocument();
3027 ScDocument& rDocRes = xDocShRes->GetDocument();
3028 rDoc.CalcAll();
3030 // Check the results of formula cells in the shared formula range.
3031 for (SCROW i = 1; i <= 19; ++i)
3033 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3034 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3035 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3039 void ScOpenCLTest::testStatisticalFormulaExpondist()
3041 if(!initTestEnv("opencl/statistical/Expondist.", XLS, false))
3042 return;
3043 ScDocument& rDoc = xDocSh->GetDocument();
3044 ScDocument& rDocRes = xDocShRes->GetDocument();
3045 rDoc.CalcAll();
3047 // Check the results of formula cells in the shared formula range.
3048 for (SCROW i = 0; i <= 9; ++i)
3050 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3051 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3052 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3056 void ScOpenCLTest::testMathFormulaBitOr()
3058 if(!initTestEnv("opencl/math/BitOr.", ODS, false))
3059 return;
3060 ScDocument& rDoc = xDocSh->GetDocument();
3061 ScDocument& rDocRes = xDocShRes->GetDocument();
3062 rDoc.CalcAll();
3064 // Verify BitOr Function
3065 for (SCROW i = 1; i <= 20; ++i)
3067 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3068 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3069 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3073 void ScOpenCLTest::testMathFormulaOdd()
3075 if(!initTestEnv("opencl/math/odd.", XLS, false))
3076 return;
3077 ScDocument& rDoc = xDocSh->GetDocument();
3078 ScDocument& rDocRes = xDocShRes->GetDocument();
3079 rDoc.CalcAll();
3081 for (SCROW i = 0; i <= 15; ++i)
3083 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3084 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3085 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3089 void ScOpenCLTest::testMathFormulaLN()
3091 if(!initTestEnv("opencl/math/LN.", XLS, false))
3092 return;
3093 ScDocument& rDoc = xDocSh->GetDocument();
3094 ScDocument& rDocRes = xDocShRes->GetDocument();
3095 rDoc.CalcAll();
3097 // Check the results of formula cells in the shared formula range.
3098 for (SCROW i = 1; i <= 9; ++i)
3100 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3101 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3102 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3106 void ScOpenCLTest::testMathFormulaMod()
3108 if(!initTestEnv("opencl/math/mod.", XLS, false))
3109 return;
3110 ScDocument& rDoc = xDocSh->GetDocument();
3111 ScDocument& rDocRes = xDocShRes->GetDocument();
3112 rDoc.CalcAll();
3114 for (SCROW i = 0; i <= 15; ++i)
3116 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3117 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3118 if(fExcel == 0.0f)
3119 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 1e-10);
3120 else
3121 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3125 void ScOpenCLTest::testMathFormulaRound()
3127 if(!initTestEnv("opencl/math/ROUND.", XLS, false))
3128 return;
3129 ScDocument& rDoc = xDocSh->GetDocument();
3130 ScDocument& rDocRes = xDocShRes->GetDocument();
3131 rDoc.CalcAll();
3133 // Check the results of formula cells in the shared formula range.
3134 for (SCROW i = 1; i <= 9; ++i)
3136 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3137 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3138 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3140 for (SCROW i = 15; i <= 25; ++i)
3142 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3143 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3144 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3148 void ScOpenCLTest::testStatisticalFormulaGammaDist()
3150 if(!initTestEnv("opencl/statistical/GammaDist.", XLS, false))
3151 return;
3152 ScDocument& rDoc = xDocSh->GetDocument();
3153 ScDocument& rDocRes = xDocShRes->GetDocument();
3154 rDoc.CalcAll();
3156 // Check the results of formula cells in the shared formula range.
3157 for (SCROW i = 1; i <= 19; ++i)
3159 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3160 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3161 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3165 void ScOpenCLTest::testStatisticalFormulaGammaInv()
3167 if(!initTestEnv("opencl/statistical/GammaInv.", XLS, false))
3168 return;
3169 ScDocument& rDoc = xDocSh->GetDocument();
3170 ScDocument& rDocRes = xDocShRes->GetDocument();
3171 rDoc.CalcAll();
3173 // Check the results of formula cells in the shared formula range.
3174 for (SCROW i = 1; i <= 19; ++i)
3176 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3177 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3178 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3179 fLibre = rDoc.GetValue(ScAddress(4,i,0));
3180 fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3181 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3185 void ScOpenCLTest::testStatisticalFormulaFInv()
3187 if(!initTestEnv("opencl/statistical/FInv.", XLS, false))
3188 return;
3189 ScDocument& rDoc = xDocSh->GetDocument();
3190 ScDocument& rDocRes = xDocShRes->GetDocument();
3191 rDoc.CalcAll();
3193 // Check the results of formula cells in the shared formula range.
3194 for (SCROW i = 1; i <= 19; ++i)
3196 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3197 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3198 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3199 fLibre = rDoc.GetValue(ScAddress(4,i,0));
3200 fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3201 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3205 void ScOpenCLTest::testStatisticalFormulaFTest()
3207 if(!initTestEnv("opencl/statistical/FTest.", XLS, false))
3208 return;
3209 ScDocument& rDoc = xDocSh->GetDocument();
3210 ScDocument& rDocRes = xDocShRes->GetDocument();
3211 rDoc.CalcAll();
3213 // Check the results of formula cells in the shared formula range.
3214 for (SCROW i = 1; i <= 19; ++i)
3216 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3217 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3218 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3222 void ScOpenCLTest::testStatisticalFormulaB()
3224 if(!initTestEnv("opencl/statistical/B.", XLS, false))
3225 return;
3226 ScDocument& rDoc = xDocSh->GetDocument();
3227 ScDocument& rDocRes = xDocShRes->GetDocument();
3228 rDoc.CalcAll();
3230 // Check the results of formula cells in the shared formula range.
3231 for (SCROW i = 1; i <= 19; ++i)
3233 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3234 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3235 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3236 fLibre = rDoc.GetValue(ScAddress(5,i,0));
3237 fExcel = rDocRes.GetValue(ScAddress(5,i,0));
3238 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3242 void ScOpenCLTest::testStatisticalFormulaBetaDist()
3244 if(!initTestEnv("opencl/statistical/BetaDist.", ODS, false))
3245 return;
3246 ScDocument& rDoc = xDocSh->GetDocument();
3247 ScDocument& rDocRes = xDocShRes->GetDocument();
3248 rDoc.CalcAll();
3250 // Check the results of formula cells in the shared formula range.
3251 for (SCROW i = 1; i <= 19; ++i)
3253 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
3254 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
3255 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3256 fLibre = rDoc.GetValue(ScAddress(7,i,0));
3257 fExcel = rDocRes.GetValue(ScAddress(7,i,0));
3258 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3262 void ScOpenCLTest::testMathFormulaEven()
3264 if(!initTestEnv("opencl/math/even.", XLS, false))
3265 return;
3266 ScDocument& rDoc = xDocSh->GetDocument();
3267 ScDocument& rDocRes = xDocShRes->GetDocument();
3268 rDoc.CalcAll();
3270 for (SCROW i = 0; i <= 15; ++i)
3272 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3273 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3274 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3278 void ScOpenCLTest::testMathFormulaExp()
3280 if(!initTestEnv("opencl/math/exp.", ODS, false))
3281 return;
3282 ScDocument& rDoc = xDocSh->GetDocument();
3283 ScDocument& rDocRes = xDocShRes->GetDocument();
3284 rDoc.CalcAll();
3286 for (SCROW i = 0; i <= 15; ++i)
3288 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3289 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3290 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3294 void ScOpenCLTest::testStatisticalFormulaChiDist()
3296 if(!initTestEnv("opencl/statistical/ChiDist.", XLS, false))
3297 return;
3298 ScDocument& rDoc = xDocSh->GetDocument();
3299 ScDocument& rDocRes = xDocShRes->GetDocument();
3300 rDoc.CalcAll();
3302 // Check the results of formula cells in the shared formula range.
3303 for (SCROW i = 1; i <= 19; ++i)
3305 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3306 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3307 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3311 void ScOpenCLTest::testMathFormulaBitLshift()
3313 if(!initTestEnv("opencl/math/BitLshift.", ODS, false))
3314 return;
3315 ScDocument& rDoc = xDocSh->GetDocument();
3316 ScDocument& rDocRes = xDocShRes->GetDocument();
3317 rDoc.CalcAll();
3319 // Verify BitLshift Function
3320 for (SCROW i = 1; i <= 20; ++i)
3322 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3323 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3324 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3328 void ScOpenCLTest::testMathFormulaBitRshift()
3330 if(!initTestEnv("opencl/math/BitRshift.", ODS, false))
3331 return;
3332 ScDocument& rDoc = xDocSh->GetDocument();
3333 ScDocument& rDocRes = xDocShRes->GetDocument();
3334 rDoc.CalcAll();
3336 // Verify BitRshift Function
3337 for (SCROW i = 1; i <= 20; ++i)
3339 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3340 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3341 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3345 void ScOpenCLTest::testMathFormulaFloor()
3347 if(!initTestEnv("opencl/math/floor.", ODS, false))
3348 return;
3349 ScDocument& rDoc = xDocSh->GetDocument();
3350 ScDocument& rDocRes = xDocShRes->GetDocument();
3351 rDoc.CalcAll();
3353 for (SCROW i = 0; i <= 9; ++i)
3355 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3356 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3357 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3361 void ScOpenCLTest::testMathFormulaLog()
3363 if(!initTestEnv("opencl/math/log.", XLS, false))
3364 return;
3365 ScDocument& rDoc = xDocSh->GetDocument();
3366 ScDocument& rDocRes = xDocShRes->GetDocument();
3367 rDoc.CalcAll();
3369 for (SCROW i = 0; i <= 47; ++i)
3371 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3372 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3373 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3377 void ScOpenCLTest::testSpreadSheetFormulaVLookup()
3379 if(!initTestEnv("opencl/spreadsheet/VLookup.", XLS, false))
3380 return;
3381 ScDocument& rDoc = xDocSh->GetDocument();
3382 ScDocument& rDocRes = xDocShRes->GetDocument();
3383 rDoc.CalcAll();
3385 // Check the results of formula cells in the shared formula range.
3386 for (SCROW i = 1; i <= 32; ++i)
3388 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
3389 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
3390 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3392 for (SCROW i = 40; i <= 50; ++i)
3394 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
3395 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
3396 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3400 void ScOpenCLTest::testStatisticalFormulaChiInv()
3402 if(!initTestEnv("opencl/statistical/ChiInv.", XLS, false))
3403 return;
3404 ScDocument& rDoc = xDocSh->GetDocument();
3405 ScDocument& rDocRes = xDocShRes->GetDocument();
3406 rDoc.CalcAll();
3408 // Check the results of formula cells in the shared formula range.
3409 for (SCROW i = 1; i <= 10; ++i)
3411 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3412 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3413 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3417 void ScOpenCLTest::testMathFormulaConvert()
3419 if(!initTestEnv("opencl/math/convert.", XLS, false))
3420 return;
3421 ScDocument& rDoc = xDocSh->GetDocument();
3422 ScDocument& rDocRes = xDocShRes->GetDocument();
3423 rDoc.CalcAll();
3425 for (SCROW i = 0; i <= 3; ++i)
3427 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3428 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3429 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3433 void ScOpenCLTest::testMathCountIfsFormula()
3435 if(!initTestEnv("opencl/math/countifs.", XLS, false))
3436 return;
3437 ScDocument& rDoc = xDocSh->GetDocument();
3438 ScDocument& rDocRes = xDocShRes->GetDocument();
3439 xDocSh->DoHardRecalc(true);
3441 for (SCROW i = 1; i < 10; ++i)
3443 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
3444 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
3445 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3449 void ScOpenCLTest::testMathFormulaBitXor()
3451 if(!initTestEnv("opencl/math/BitXor.", ODS, false))
3452 return;
3453 ScDocument& rDoc = xDocSh->GetDocument();
3454 ScDocument& rDocRes = xDocShRes->GetDocument();
3455 rDoc.CalcAll();
3457 // Verify BitXor Function
3458 for (SCROW i = 1; i <= 20; ++i)
3460 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3461 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3462 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3466 void ScOpenCLTest::testMathAverageIfsFormula()
3468 if(!initTestEnv("opencl/math/averageifs.", XLS, false))
3469 return;
3470 ScDocument& rDoc = xDocSh->GetDocument();
3471 ScDocument& rDocRes = xDocShRes->GetDocument();
3473 xDocSh->DoHardRecalc(true);
3475 for (SCROW i = 1; i <= 11; ++i)
3477 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3478 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3479 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3483 void ScOpenCLTest::testMathFormulaLog10()
3485 if(!initTestEnv("opencl/math/log10.", ODS, false))
3486 return;
3487 ScDocument& rDoc = xDocSh->GetDocument();
3488 ScDocument& rDocRes = xDocShRes->GetDocument();
3489 rDoc.CalcAll();
3491 for (SCROW i = 0; i <= 15; ++i)
3493 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3494 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3495 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3499 void ScOpenCLTest::testMathFormulaCombina()
3501 if(!initTestEnv("opencl/math/combina.", XLS, false))
3502 return;
3503 ScDocument& rDoc = xDocSh->GetDocument();
3504 ScDocument& rDocRes = xDocShRes->GetDocument();
3505 rDoc.CalcAll();
3507 for (SCROW i = 0; i <= 47; ++i)
3509 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3510 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3511 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3515 void ScOpenCLTest::testMathFormulaCeil()
3517 if(!initTestEnv("opencl/math/Ceil.", ODS, false))
3518 return;
3519 ScDocument& rDoc = xDocSh->GetDocument();
3520 ScDocument& rDocRes = xDocShRes->GetDocument();
3521 rDoc.CalcAll();
3523 // Verify Ceiling Function
3524 for (SCROW i = 1; i <= 20; ++i)
3526 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3527 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3528 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3532 void ScOpenCLTest::testMathFormulaSqrtPi()
3534 if(!initTestEnv("opencl/math/sqrtpi.", XLS, false))
3535 return;
3536 ScDocument& rDoc = xDocSh->GetDocument();
3537 ScDocument& rDocRes = xDocShRes->GetDocument();
3538 rDoc.CalcAll();
3540 for (SCROW i = 0; i < 20; ++i)
3542 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3543 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3544 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3548 void ScOpenCLTest::testStatisticalFormulaVarP()
3550 if(!initTestEnv("opencl/statistical/VarP.", XLS, false))
3551 return;
3552 ScDocument& rDoc = xDocSh->GetDocument();
3553 ScDocument& rDocRes = xDocShRes->GetDocument();
3554 rDoc.CalcAll();
3556 // Check the results of formula cells in the shared formula range.
3557 for (SCROW i = 1; i <= 20; ++i)
3559 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3560 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3561 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3565 void ScOpenCLTest::testStatisticalFormulaStDev()
3567 if(!initTestEnv("opencl/statistical/StDev.", XLS, false))
3568 return;
3569 ScDocument& rDoc = xDocSh->GetDocument();
3570 ScDocument& rDocRes = xDocShRes->GetDocument();
3571 rDoc.CalcAll();
3573 // Check the results of formula cells in the shared formula range.
3574 for (SCROW i = 1; i <= 20; ++i)
3576 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3577 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3578 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3582 void ScOpenCLTest::testStatisticalFormulaStDevP()
3584 if(!initTestEnv("opencl/statistical/StDevP.", XLS, false))
3585 return;
3586 ScDocument& rDoc = xDocSh->GetDocument();
3587 ScDocument& rDocRes = xDocShRes->GetDocument();
3588 rDoc.CalcAll();
3590 // Check the results of formula cells in the shared formula range.
3591 for (SCROW i = 1; i <= 20; ++i)
3593 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3594 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3595 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3599 void ScOpenCLTest::testStatisticalFormulaSlope()
3601 if(!initTestEnv("opencl/statistical/Slope.", XLS, false))
3602 return;
3603 ScDocument& rDoc = xDocSh->GetDocument();
3604 ScDocument& rDocRes = xDocShRes->GetDocument();
3605 rDoc.CalcAll();
3607 // Check the results of formula cells in the shared formula range.
3608 for (SCROW i = 1; i <= 20; ++i)
3610 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3611 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3612 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3616 void ScOpenCLTest::testStatisticalFormulaSTEYX()
3618 if(!initTestEnv("opencl/statistical/STEYX.", XLS, false))
3619 return;
3620 ScDocument& rDoc = xDocSh->GetDocument();
3621 ScDocument& rDocRes = xDocShRes->GetDocument();
3622 rDoc.CalcAll();
3624 // Check the results of formula cells in the shared formula range.
3625 for (SCROW i = 1; i <= 20; ++i)
3627 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3628 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3629 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3633 void ScOpenCLTest::testStatisticalFormulaZTest()
3635 if(!initTestEnv("opencl/statistical/ZTest.", XLS, false))
3636 return;
3637 ScDocument& rDoc = xDocSh->GetDocument();
3638 ScDocument& rDocRes = xDocShRes->GetDocument();
3639 rDoc.CalcAll();
3641 // Check the results of formula cells in the shared formula range.
3642 for (SCROW i = 1; i <= 20; ++i)
3644 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3645 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3646 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3650 void ScOpenCLTest::testStatisticalFormulaTTest()
3652 if(!initTestEnv("opencl/statistical/TTest.", XLS, false))
3653 return;
3654 ScDocument& rDoc = xDocSh->GetDocument();
3655 ScDocument& rDocRes = xDocShRes->GetDocument();
3656 rDoc.CalcAll();
3658 // Check the results of formula cells in the shared formula range.
3659 for (SCROW i = 1; i <= 20; ++i)
3661 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3662 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3663 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3667 void ScOpenCLTest::testStatisticalFormulaTDist()
3669 if(!initTestEnv("opencl/statistical/TDist.", XLS, false))
3670 return;
3671 ScDocument& rDoc = xDocSh->GetDocument();
3672 ScDocument& rDocRes = xDocShRes->GetDocument();
3673 rDoc.CalcAll();
3675 // Check the results of formula cells in the shared formula range.
3676 for (SCROW i = 1; i <= 20; ++i)
3678 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3679 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3680 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3684 void ScOpenCLTest::testStatisticalFormulaTInv()
3686 if(!initTestEnv("opencl/statistical/TInv.", XLS, false))
3687 return;
3688 ScDocument& rDoc = xDocSh->GetDocument();
3689 ScDocument& rDocRes = xDocShRes->GetDocument();
3690 rDoc.CalcAll();
3692 // Check the results of formula cells in the shared formula range.
3693 for (SCROW i = 1; i <= 20; ++i)
3695 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3696 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3697 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3701 void ScOpenCLTest::testStatisticalFormulaBinomDist()
3703 if(!initTestEnv("opencl/statistical/BinomDist.", XLS, false))
3704 return;
3705 ScDocument& rDoc = xDocSh->GetDocument();
3706 ScDocument& rDocRes = xDocShRes->GetDocument();
3707 rDoc.CalcAll();
3709 // Check the results of formula cells in the shared formula range.
3710 for (SCROW i = 1; i <= 9; ++i)
3712 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3713 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3714 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3718 void ScOpenCLTest::testMathFormulaProduct()
3720 if(!initTestEnv("opencl/math/product.", XLS, false))
3721 return;
3722 ScDocument& rDoc = xDocSh->GetDocument();
3723 ScDocument& rDocRes = xDocShRes->GetDocument();
3724 rDoc.CalcAll();
3726 for (SCROW i = 0; i <= 3; ++i)
3728 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3729 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3730 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3734 #if 0 //Disabled temporarily
3735 void ScOpenCLTest::testMathFormulaKombin()
3737 if(!initTestEnv("opencl/math/Kombin.", ODS, false))
3738 return;
3739 ScDocument& rDoc = xDocSh->GetDocument();
3740 ScDocument& rDocRes = xDocShRes->GetDocument();
3741 rDoc.CalcAll();
3743 // Verify Combin Function
3744 for (SCROW i = 1; i <= 20; ++i)
3746 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3747 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3748 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3751 #endif
3753 void ScOpenCLTest:: testArrayFormulaSumX2MY2()
3755 if(!initTestEnv("opencl/array/SUMX2MY2.", XLS, false))
3756 return;
3757 ScDocument& rDoc = xDocSh->GetDocument();
3758 ScDocument& rDocRes = xDocShRes->GetDocument();
3759 rDoc.CalcAll();
3761 for (SCROW i = 0; i <= 9; ++i)
3763 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3764 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3765 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3767 for (SCROW i = 20; i <= 26; ++i)
3769 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3770 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3771 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3775 void ScOpenCLTest::testStatisticalFormulaHypGeomDist()
3777 if(!initTestEnv("opencl/statistical/HypGeomDist.", XLS, false))
3778 return;
3779 ScDocument& rDoc = xDocSh->GetDocument();
3780 ScDocument& rDocRes = xDocShRes->GetDocument();
3781 rDoc.CalcAll();
3783 // Check the results of formula cells in the shared formula range.
3784 for (SCROW i = 1; i <= 19; ++i)
3786 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3787 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3788 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3792 void ScOpenCLTest:: testArrayFormulaSumX2PY2()
3794 if(!initTestEnv("opencl/array/SUMX2PY2.", XLS, false))
3795 return;
3796 ScDocument& rDoc = xDocSh->GetDocument();
3797 ScDocument& rDocRes = xDocShRes->GetDocument();
3798 rDoc.CalcAll();
3800 for (SCROW i = 0; i <= 9; ++i)
3802 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3803 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3804 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3806 for (SCROW i = 20; i <= 26; ++i)
3808 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3809 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3810 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3814 void ScOpenCLTest::testStatisticalFormulaBetainv()
3816 if(!initTestEnv("opencl/statistical/Betainv.", XLS, false))
3817 return;
3818 ScDocument& rDoc = xDocSh->GetDocument();
3819 ScDocument& rDocRes = xDocShRes->GetDocument();
3820 rDoc.CalcAll();
3822 // Check the results of formula cells in the shared formula range.
3823 for (SCROW i = 1; i <= 19; ++i)
3825 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
3826 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
3827 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3831 void ScOpenCLTest::testStatisticalFormulaMina()
3833 if(!initTestEnv("opencl/statistical/Mina.", XLS, false))
3834 return;
3835 ScDocument& rDoc = xDocSh->GetDocument();
3836 ScDocument& rDocRes = xDocShRes->GetDocument();
3837 rDoc.CalcAll();
3839 for (SCROW i = 0; i <= 9; ++i)
3841 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3842 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3843 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3847 void ScOpenCLTest:: testArrayFormulaSumXMY2()
3849 if(!initTestEnv("opencl/array/SUMXMY2.", XLS, false))
3850 return;
3851 ScDocument& rDoc = xDocSh->GetDocument();
3852 ScDocument& rDocRes = xDocShRes->GetDocument();
3853 rDoc.CalcAll();
3855 for (SCROW i = 0; i <= 9; ++i)
3857 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3858 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3859 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3861 for (SCROW i = 20; i <= 26; ++i)
3863 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3864 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3865 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3869 void ScOpenCLTest::testStatisticalFormulaCountA()
3871 if(!initTestEnv("opencl/statistical/counta.", XLS, false))
3872 return;
3873 ScDocument& rDoc = xDocSh->GetDocument();
3874 ScDocument& rDocRes = xDocShRes->GetDocument();
3875 rDoc.CalcAll();
3877 for (SCROW i = 0; i <= 9; ++i)
3879 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3880 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3881 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3885 void ScOpenCLTest::testStatisticalFormulaMaxa()
3887 if(!initTestEnv("opencl/statistical/Maxa.", XLS, false))
3888 return;
3889 ScDocument& rDoc = xDocSh->GetDocument();
3890 ScDocument& rDocRes = xDocShRes->GetDocument();
3891 rDoc.CalcAll();
3893 for (SCROW i = 0; i <= 9; ++i)
3895 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3896 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3897 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3901 void ScOpenCLTest::testMathFormulaSumProduct()
3903 if(!initTestEnv("opencl/math/sumproduct_mixSliding.", XLS, false))
3904 return;
3905 ScDocument& rDoc = xDocSh->GetDocument();
3906 ScDocument& rDocRes = xDocShRes->GetDocument();
3907 rDoc.CalcAll();
3909 // Check the results of formula cells in the shared formula range.
3910 for (SCROW i = 0; i <= 9; ++i)
3912 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3913 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3914 if ( i == 1 )
3915 CPPUNIT_ASSERT_DOUBLES_EQUAL(82, fLibre, fabs(0.0001*fExcel));
3916 else if ( i == 2 )
3917 CPPUNIT_ASSERT_DOUBLES_EQUAL(113, fLibre, fabs(0.0001*fExcel));
3918 else if ( i == 4 )
3919 CPPUNIT_ASSERT_DOUBLES_EQUAL(175, fLibre, fabs(0.0001*fExcel));
3920 else if ( i == 5 )
3921 CPPUNIT_ASSERT_DOUBLES_EQUAL(206, fLibre, fabs(0.0001*fExcel));
3922 else if ( i == 6 )
3923 CPPUNIT_ASSERT_DOUBLES_EQUAL(237, fLibre, fabs(0.0001*fExcel));
3924 else if ( i == 7 )
3925 CPPUNIT_ASSERT_DOUBLES_EQUAL(268, fLibre, fabs(0.0001*fExcel));
3926 else
3927 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3931 void ScOpenCLTest::testMathFormulaAverageIf()
3933 if(!initTestEnv("opencl/math/averageif.", XLS, false))
3934 return;
3935 ScDocument& rDoc = xDocSh->GetDocument();
3936 ScDocument& rDocRes = xDocShRes->GetDocument();
3937 rDoc.CalcAll();
3939 for (SCROW i = 2; i <= 21; ++i)
3941 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
3942 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
3943 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3947 void ScOpenCLTest::testStatisticalFormulaAverageA()
3949 if(!initTestEnv("opencl/statistical/AverageA.", XLS, false))
3950 return;
3951 ScDocument& rDoc = xDocSh->GetDocument();
3952 ScDocument& rDocRes = xDocShRes->GetDocument();
3953 rDoc.CalcAll();
3955 for (SCROW i = 0; i <= 9; ++i)
3957 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3958 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3959 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3963 void ScOpenCLTest:: testLogicalFormulaAnd()
3965 if(!initTestEnv("opencl/logical/and.", XLS, false))
3966 return;
3967 ScDocument& rDoc = xDocSh->GetDocument();
3968 ScDocument& rDocRes = xDocShRes->GetDocument();
3969 rDoc.CalcAll();
3971 for (SCROW i = 1; i <= 20; ++i)
3973 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3974 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3975 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3977 for (SCROW i = 1; i <= 20; ++i)
3979 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
3980 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
3981 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3985 void ScOpenCLTest::testStatisticalFormulaVarA()
3987 if(!initTestEnv("opencl/statistical/VarA.", XLS, false))
3988 return;
3989 ScDocument& rDoc = xDocSh->GetDocument();
3990 ScDocument& rDocRes = xDocShRes->GetDocument();
3991 rDoc.CalcAll();
3993 // Check the results of formula cells in the shared formula range.
3994 for (SCROW i = 1; i <= 20; ++i)
3996 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3997 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3998 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4002 void ScOpenCLTest::testStatisticalFormulaVarPA()
4004 if(!initTestEnv("opencl/statistical/VarPA.", XLS, false))
4005 return;
4006 ScDocument& rDoc = xDocSh->GetDocument();
4007 ScDocument& rDocRes = xDocShRes->GetDocument();
4008 rDoc.CalcAll();
4009 // Check the results of formula cells in the shared formula range.
4010 for (SCROW i = 1; i <= 20; ++i)
4012 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4013 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4014 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4018 void ScOpenCLTest::testStatisticalFormulaStDevA()
4020 if(!initTestEnv("opencl/statistical/StDevA.", XLS, false))
4021 return;
4022 ScDocument& rDoc = xDocSh->GetDocument();
4023 ScDocument& rDocRes = xDocShRes->GetDocument();
4024 rDoc.CalcAll();
4026 // Check the results of formula cells in the shared formula range.
4027 for (SCROW i = 1; i <= 20; ++i)
4029 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4030 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4031 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4035 void ScOpenCLTest::testStatisticalFormulaStDevPA()
4037 if(!initTestEnv("opencl/statistical/StDevPA.", XLS, false))
4038 return;
4039 ScDocument& rDoc = xDocSh->GetDocument();
4040 ScDocument& rDocRes = xDocShRes->GetDocument();
4041 rDoc.CalcAll();
4043 // Check the results of formula cells in the shared formula range.
4044 for (SCROW i = 1; i <= 20; ++i)
4046 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4047 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4048 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4052 void ScOpenCLTest:: testFinancialMDurationFormula1()
4054 if(!initTestEnv("opencl/financial/MDuration1.", XLS, false))
4055 return;
4056 ScDocument& rDoc = xDocSh->GetDocument();
4057 ScDocument& rDocRes = xDocShRes->GetDocument();
4058 rDoc.CalcAll();
4060 for (SCROW i = 0; i <= 9; ++i)
4062 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
4063 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
4064 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel,fLibre,fabs(0.00000000001*fExcel));
4068 void ScOpenCLTest::testMathFormulaSumProduct2()
4070 if(!initTestEnv("opencl/math/sumproductTest.", XLS, false))
4071 return;
4072 ScDocument& rDoc = xDocSh->GetDocument();
4073 ScDocument& rDocRes = xDocShRes->GetDocument();
4074 rDoc.CalcAll();
4076 // Check the results of formula cells in the shared formula range.
4077 for (SCROW i = 2; i <= 12; ++i)
4079 double fLibre = rDoc.GetValue(ScAddress(4,i,1));
4080 double fExcel = rDocRes.GetValue(ScAddress(4,i,1));
4081 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4085 void ScOpenCLTest:: testStatisticalParallelCountBug()
4087 if(!initTestEnv("opencl/statistical/parallel_count_bug_243.", ODS, false))
4088 return;
4089 ScDocument& rDoc = xDocSh->GetDocument();
4090 ScDocument& rDocRes = xDocShRes->GetDocument();
4091 rDoc.CalcAll();
4093 for (SCROW i = 0; i < 13; ++i)
4095 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
4096 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
4097 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4101 void ScOpenCLTest:: testLogicalFormulaOr()
4103 if(!initTestEnv("opencl/logical/or.", XLS, false))
4104 return;
4105 ScDocument& rDoc = xDocSh->GetDocument();
4106 ScDocument& rDocRes = xDocShRes->GetDocument();
4107 rDoc.CalcAll();
4109 for (SCROW i = 0; i < 20; ++i)
4111 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
4112 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
4113 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4117 void ScOpenCLTest:: testLogicalFormulaNot()
4119 if(!initTestEnv("opencl/logical/not.", XLS, false))
4120 return;
4121 ScDocument& rDoc = xDocSh->GetDocument();
4122 ScDocument& rDocRes = xDocShRes->GetDocument();
4123 rDoc.CalcAll();
4125 for (SCROW i = 0; i < 3000; ++i)
4127 double fLibre = rDoc.GetValue(ScAddress(1, i, 0));
4128 double fExcel = rDocRes.GetValue(ScAddress(1, i, 0));
4129 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4133 void ScOpenCLTest:: testLogicalFormulaXor()
4135 if(!initTestEnv("opencl/logical/xor.", XLS, false))
4136 return;
4137 ScDocument& rDoc = xDocSh->GetDocument();
4138 ScDocument& rDocRes = xDocShRes->GetDocument();
4139 rDoc.CalcAll();
4141 for (SCROW i = 0; i < 3000; ++i)
4143 double fLibre = rDoc.GetValue(ScAddress(1, i, 0));
4144 double fExcel = rDocRes.GetValue(ScAddress(1, i, 0));
4145 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4149 void ScOpenCLTest::testDatabaseFormulaDcount()
4151 if(!initTestEnv("opencl/database/dcount.", XLS, false))
4152 return;
4153 ScDocument& rDoc = xDocSh->GetDocument();
4154 ScDocument& rDocRes = xDocShRes->GetDocument();
4155 rDoc.CalcAll();
4157 // Check the results of formula cells in the shared formula range.
4158 for (SCROW i = 1; i <= 32; ++i)
4160 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4161 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4162 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4166 void ScOpenCLTest::testDatabaseFormulaDcountA()
4168 if(!initTestEnv("opencl/database/dcountA.", XLS, false))
4169 return;
4170 ScDocument& rDoc = xDocSh->GetDocument();
4171 ScDocument& rDocRes = xDocShRes->GetDocument();
4172 rDoc.CalcAll();
4174 // Check the results of formula cells in the shared formula range.
4175 for (SCROW i = 1; i <= 32; ++i)
4177 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4178 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4179 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4183 void ScOpenCLTest::testDatabaseFormulaDmax()
4185 if(!initTestEnv("opencl/database/dmax.", XLS, false))
4186 return;
4187 ScDocument& rDoc = xDocSh->GetDocument();
4188 ScDocument& rDocRes = xDocShRes->GetDocument();
4189 rDoc.CalcAll();
4191 // Check the results of formula cells in the shared formula range.
4192 for (SCROW i = 1; i <= 32; ++i)
4194 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4195 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4196 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4200 void ScOpenCLTest::testDatabaseFormulaDmin()
4202 if(!initTestEnv("opencl/database/dmin.", XLS, false))
4203 return;
4204 ScDocument& rDoc = xDocSh->GetDocument();
4205 ScDocument& rDocRes = xDocShRes->GetDocument();
4206 rDoc.CalcAll();
4208 // Check the results of formula cells in the shared formula range.
4209 for (SCROW i = 1; i <= 32; ++i)
4211 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4212 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4213 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4217 void ScOpenCLTest::testDatabaseFormulaDproduct()
4219 if(!initTestEnv("opencl/database/dproduct.", XLS, false))
4220 return;
4221 ScDocument& rDoc = xDocSh->GetDocument();
4222 ScDocument& rDocRes = xDocShRes->GetDocument();
4223 rDoc.CalcAll();
4225 // Check the results of formula cells in the shared formula range.
4226 for (SCROW i = 1; i <= 32; ++i)
4228 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4229 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4230 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4234 void ScOpenCLTest::testDatabaseFormulaDaverage()
4236 if(!initTestEnv("opencl/database/daverage.", XLS, false))
4237 return;
4238 ScDocument& rDoc = xDocSh->GetDocument();
4239 ScDocument& rDocRes = xDocShRes->GetDocument();
4240 rDoc.CalcAll();
4242 // Check the results of formula cells in the shared formula range.
4243 for (SCROW i = 1; i <= 32; ++i)
4245 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4246 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4247 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4248 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4252 void ScOpenCLTest::testDatabaseFormulaDstdev()
4254 if(!initTestEnv("opencl/database/dstdev.", XLS, false))
4255 return;
4256 ScDocument& rDoc = xDocSh->GetDocument();
4257 ScDocument& rDocRes = xDocShRes->GetDocument();
4258 rDoc.CalcAll();
4260 // Check the results of formula cells in the shared formula range.
4261 for (SCROW i = 1; i <= 32; ++i)
4263 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4264 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4265 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4266 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4270 void ScOpenCLTest::testDatabaseFormulaDstdevp()
4272 if(!initTestEnv("opencl/database/dstdevp.", XLS, false))
4273 return;
4274 ScDocument& rDoc = xDocSh->GetDocument();
4275 ScDocument& rDocRes = xDocShRes->GetDocument();
4276 rDoc.CalcAll();
4278 // Check the results of formula cells in the shared formula range.
4279 for (SCROW i = 1; i <= 32; ++i)
4281 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4282 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4283 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4284 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4288 void ScOpenCLTest::testDatabaseFormulaDsum()
4290 if(!initTestEnv("opencl/database/dsum.", XLS, false))
4291 return;
4292 ScDocument& rDoc = xDocSh->GetDocument();
4293 ScDocument& rDocRes = xDocShRes->GetDocument();
4294 rDoc.CalcAll();
4296 // Check the results of formula cells in the shared formula range.
4297 for (SCROW i = 1; i <= 32; ++i)
4299 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4300 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4301 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4302 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4306 void ScOpenCLTest::testDatabaseFormulaDvar()
4308 if(!initTestEnv("opencl/database/dvar.", XLS, false))
4309 return;
4310 ScDocument& rDoc = xDocSh->GetDocument();
4311 ScDocument& rDocRes = xDocShRes->GetDocument();
4312 rDoc.CalcAll();
4314 // Check the results of formula cells in the shared formula range.
4315 for (SCROW i = 1; i <= 32; ++i)
4317 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4318 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4319 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4320 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4324 void ScOpenCLTest::testDatabaseFormulaDvarp()
4326 if(!initTestEnv("opencl/database/dvarp.", XLS, false))
4327 return;
4328 ScDocument& rDoc = xDocSh->GetDocument();
4329 ScDocument& rDocRes = xDocShRes->GetDocument();
4330 rDoc.CalcAll();
4332 // Check the results of formula cells in the shared formula range.
4333 for (SCROW i = 1; i <= 32; ++i)
4335 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4336 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4337 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4341 void ScOpenCLTest::testMathFormulaRoundUp()
4343 if(!initTestEnv("opencl/math/roundup.", XLS, false))
4344 return;
4345 ScDocument& rDoc = xDocSh->GetDocument();
4346 ScDocument& rDocRes = xDocShRes->GetDocument();
4347 rDoc.CalcAll();
4349 // Check the results of formula cells in the shared formula range.
4350 for (SCROW i = 1; i <= 9; ++i)
4352 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4353 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4354 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4358 void ScOpenCLTest::testMathFormulaRoundDown()
4360 if(!initTestEnv("opencl/math/rounddown.", XLS, false))
4361 return;
4362 ScDocument& rDoc = xDocSh->GetDocument();
4363 ScDocument& rDocRes = xDocShRes->GetDocument();
4364 rDoc.CalcAll();
4366 // Check the results of formula cells in the shared formula range.
4367 for (SCROW i = 1; i <= 9; ++i)
4369 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4370 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4371 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4375 void ScOpenCLTest::testMathFormulaInt()
4377 if(!initTestEnv("opencl/math/int.", XLS, false))
4378 return;
4379 ScDocument& rDoc = xDocSh->GetDocument();
4380 ScDocument& rDocRes = xDocShRes->GetDocument();
4381 rDoc.CalcAll();
4383 // Check the results of formula cells in the shared formula range.
4384 for (SCROW i = 1; i <= 9; ++i)
4386 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4387 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4388 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4392 void ScOpenCLTest::testMathFormulaRadians()
4394 if(!initTestEnv("opencl/math/radians.", XLS, false))
4395 return;
4396 ScDocument& rDoc = xDocSh->GetDocument();
4397 ScDocument& rDocRes = xDocShRes->GetDocument();
4398 rDoc.CalcAll();
4400 // Check the results of formula cells in the shared formula range.
4401 for (SCROW i = 1; i <= 9; ++i)
4403 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4404 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4405 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4409 void ScOpenCLTest::testMathFormulaDegrees()
4411 if(!initTestEnv("opencl/math/degrees.", XLS, false))
4412 return;
4413 ScDocument& rDoc = xDocSh->GetDocument();
4414 ScDocument& rDocRes = xDocShRes->GetDocument();
4415 rDoc.CalcAll();
4417 for (SCROW i = 0; i <= 200; ++i)
4419 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4420 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4421 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4425 void ScOpenCLTest::testMathFormulaIsEven()
4427 if(!initTestEnv("opencl/math/iseven.", XLS, false))
4428 return;
4429 ScDocument& rDoc = xDocSh->GetDocument();
4430 ScDocument& rDocRes = xDocShRes->GetDocument();
4431 rDoc.CalcAll();
4433 // Check the results of formula cells in the shared formula range.
4434 for (SCROW i = 1; i <= 9; ++i)
4436 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4437 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4438 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4442 void ScOpenCLTest::testMathFormulaCountIf()
4444 if(!initTestEnv("opencl/math/countif.", XLS, false))
4445 return;
4446 ScDocument& rDoc = xDocSh->GetDocument();
4447 ScDocument& rDocRes = xDocShRes->GetDocument();
4448 rDoc.CalcAll();
4450 for (SCROW i = 0; i <= 26; ++i)
4452 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4453 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4454 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4458 void ScOpenCLTest::testMathFormulaIsOdd()
4460 if(!initTestEnv("opencl/math/isodd.", XLS, false))
4461 return;
4462 ScDocument& rDoc = xDocSh->GetDocument();
4463 ScDocument& rDocRes = xDocShRes->GetDocument();
4464 rDoc.CalcAll();
4466 // Check the results of formula cells in the shared formula range.
4467 for (SCROW i = 1; i <= 9; ++i)
4469 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4470 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4471 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4475 void ScOpenCLTest::testMathFormulaFact()
4477 if(!initTestEnv("opencl/math/fact.", XLS, false))
4478 return;
4479 ScDocument& rDoc = xDocSh->GetDocument();
4480 ScDocument& rDocRes = xDocShRes->GetDocument();
4481 rDoc.CalcAll();
4483 for (SCROW i = 0; i <= 18; ++i)
4485 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4486 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4487 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4491 void ScOpenCLTest::testMathFormulaSEC()
4493 if(!initTestEnv("opencl/math/sec.", ODS, false))
4494 return;
4495 ScDocument& rDoc = xDocSh->GetDocument();
4496 ScDocument& rDocRes = xDocShRes->GetDocument();
4497 rDoc.CalcAll();
4499 for (SCROW i = 0; i <= 15; ++i)
4501 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4502 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4503 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4507 void ScOpenCLTest::testMathFormulaSECH()
4509 if(!initTestEnv("opencl/math/sech.", ODS, false))
4510 return;
4511 ScDocument& rDoc = xDocSh->GetDocument();
4512 ScDocument& rDocRes = xDocShRes->GetDocument();
4513 rDoc.CalcAll();
4515 for (SCROW i = 0; i <= 15; ++i)
4517 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4518 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4519 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4523 void ScOpenCLTest::testMathFormulaMROUND()
4525 if(!initTestEnv("opencl/math/MROUND.", XLS, false))
4526 return;
4527 ScDocument& rDoc = xDocSh->GetDocument();
4528 ScDocument& rDocRes = xDocShRes->GetDocument();
4529 rDoc.CalcAll();
4531 for (SCROW i = 0; i <= 13; ++i)
4533 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4534 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4535 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4539 void ScOpenCLTest::testMathFormulaQuotient()
4541 if(!initTestEnv("opencl/math/Quotient.", ODS, false))
4542 return;
4543 ScDocument& rDoc = xDocSh->GetDocument();
4544 ScDocument& rDocRes = xDocShRes->GetDocument();
4545 rDoc.CalcAll();
4547 // Verify BitAnd Function
4548 for (SCROW i = 1; i <= 20; ++i)
4550 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4551 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4552 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4556 void ScOpenCLTest::testMathFormulaSeriesSum()
4558 if(!initTestEnv("opencl/math/seriessum.", XLS, false))
4559 return;
4560 ScDocument& rDoc = xDocSh->GetDocument();
4561 ScDocument& rDocRes = xDocShRes->GetDocument();
4562 rDoc.CalcAll();
4564 for (SCROW i = 0; i <= 15; ++i)
4566 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4567 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4568 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4572 void ScOpenCLTest::testMathFormulaSumIf()
4574 if(!initTestEnv("opencl/math/sumif.", XLS, false))
4575 return;
4576 ScDocument& rDoc = xDocSh->GetDocument();
4577 ScDocument& rDocRes = xDocShRes->GetDocument();
4578 rDoc.CalcAll();
4580 for (SCROW i = 0; i <= 26; ++i)
4582 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4583 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4584 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4588 void ScOpenCLTest::testAddInFormulaBesseLJ()
4590 if(!initTestEnv("opencl/addin/besselj.", XLS, false))
4591 return;
4592 ScDocument& rDoc = xDocSh->GetDocument();
4593 ScDocument& rDocRes = xDocShRes->GetDocument();
4594 rDoc.CalcAll();
4596 // Check the results of formula cells in the shared formula range.
4597 for (SCROW i = 1; i <= 20; ++i)
4599 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4600 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4601 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4605 void ScOpenCLTest::testStatisticalFormulaAvedev()
4607 if(!initTestEnv("opencl/statistical/Avedev.", XLS, false))
4608 return;
4609 ScDocument& rDoc = xDocSh->GetDocument();
4610 ScDocument& rDocRes = xDocShRes->GetDocument();
4611 rDoc.CalcAll();
4613 // Check the results of formula cells in the shared formula range.
4614 for (SCROW i = 1; i <= 19; ++i)
4616 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
4617 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
4618 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4622 void ScOpenCLTest::testNegSub()
4624 if(!initTestEnv("opencl/math/NegSub.", XLS, false))
4625 return;
4626 ScDocument& rDoc = xDocSh->GetDocument();
4627 ScDocument& rDocRes = xDocShRes->GetDocument();
4628 rDoc.CalcAll();
4630 // Check the results of formula cells in the shared formula range.
4631 for (SCROW i = 0; i <= 9; ++i)
4633 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4634 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4635 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4639 void ScOpenCLTest::testMathFormulaAverageIf_Mix()
4641 if(!initTestEnv("opencl/math/averageif_mix.", XLS, false))
4642 return;
4643 ScDocument& rDoc = xDocSh->GetDocument();
4644 ScDocument& rDocRes = xDocShRes->GetDocument();
4645 rDoc.CalcAll();
4647 for (SCROW i = 0; i <= 9; ++i)
4649 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4650 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4651 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4655 void ScOpenCLTest::testStatisticalFormulaKurt1()
4657 if(!initTestEnv("opencl/statistical/Kurt1.", XLS, false))
4658 return;
4659 ScDocument& rDoc = xDocSh->GetDocument();
4660 ScDocument& rDocRes = xDocShRes->GetDocument();
4661 rDoc.CalcAll();
4663 // Check the results of formula cells in the shared formula range.
4664 for (SCROW i = 1; i <= 19; ++i)
4666 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4667 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4668 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4672 void ScOpenCLTest::testStatisticalFormulaHarMean1()
4674 if(!initTestEnv("opencl/statistical/HarMean1.", XLS, false))
4675 return;
4676 ScDocument& rDoc = xDocSh->GetDocument();
4677 ScDocument& rDocRes = xDocShRes->GetDocument();
4678 rDoc.CalcAll();
4680 // Check the results of formula cells in the shared formula range.
4681 for (SCROW i = 1; i <= 19; ++i)
4683 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4684 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4685 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4689 void ScOpenCLTest::testStatisticalFormulaVarA1()
4691 if(!initTestEnv("opencl/statistical/VarA1.", XLS, false))
4692 return;
4693 ScDocument& rDoc = xDocSh->GetDocument();
4694 ScDocument& rDocRes = xDocShRes->GetDocument();
4695 rDoc.CalcAll();
4697 // Check the results of formula cells in the shared formula range.
4698 for (SCROW i = 1; i <= 20; ++i)
4700 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4701 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4702 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4706 void ScOpenCLTest::testStatisticalFormulaVarPA1()
4708 if(!initTestEnv("opencl/statistical/VarPA1.", XLS, false))
4709 return;
4710 ScDocument& rDoc = xDocSh->GetDocument();
4711 ScDocument& rDocRes = xDocShRes->GetDocument();
4712 rDoc.CalcAll();
4714 // Check the results of formula cells in the shared formula range.
4715 for (SCROW i = 1; i <= 20; ++i)
4717 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4718 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4719 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4723 void ScOpenCLTest::testStatisticalFormulaStDevA1()
4725 if(!initTestEnv("opencl/statistical/StDevA1.", XLS, false))
4726 return;
4727 ScDocument& rDoc = xDocSh->GetDocument();
4728 ScDocument& rDocRes = xDocShRes->GetDocument();
4729 rDoc.CalcAll();
4731 // Check the results of formula cells in the shared formula range.
4732 for (SCROW i = 1; i <= 20; ++i)
4734 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4735 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4736 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4740 void ScOpenCLTest::testStatisticalFormulaStDevPA1()
4742 if(!initTestEnv("opencl/statistical/StDevPA1.", XLS, false))
4743 return;
4744 ScDocument& rDoc = xDocSh->GetDocument();
4745 ScDocument& rDocRes = xDocShRes->GetDocument();
4746 rDoc.CalcAll();
4748 // Check the results of formula cells in the shared formula range.
4749 for (SCROW i = 1; i <= 20; ++i)
4751 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4752 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4753 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4757 ScOpenCLTest::ScOpenCLTest()
4758 : ScBootstrapFixture( "/sc/qa/unit/data" )
4762 void ScOpenCLTest::setUp()
4764 test::BootstrapFixture::setUp();
4765 // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
4766 // which is a private symbol to us, gets called
4767 m_xCalcComponent =
4768 getMultiServiceFactory()->
4769 createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
4770 CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is());
4773 void ScOpenCLTest::tearDown()
4775 //close test env
4776 if(xDocSh.Is())
4777 xDocSh->DoClose();
4778 if(xDocShRes.Is())
4779 xDocShRes->DoClose();
4781 uno::Reference< lang::XComponent >
4782 ( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
4783 test::BootstrapFixture::tearDown();
4786 CPPUNIT_TEST_SUITE_REGISTRATION(ScOpenCLTest);
4788 CPPUNIT_PLUGIN_IMPLEMENT();
4790 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */