Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / qa / unit / opencl-test.cxx
blobf72300da02f33481c4461939e1ca0c41bb452b2f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 #include <sal/config.h>
4 #include <test/bootstrapfixture.hxx>
6 #include "helper/qahelper.hxx"
8 #include <docsh.hxx>
9 #include <document.hxx>
10 #include <formulagroup.hxx>
12 using namespace ::com::sun::star;
13 using namespace ::com::sun::star::uno;
15 class ScOpenCLTest
16 : public ScBootstrapFixture
18 public:
19 ScOpenCLTest();
21 /**
22 * Try to auto-detect OpenCL device if one is available.
24 * @return true if a usable OpenCL device is found, false otherwise.
26 bool detectOpenCLDevice();
28 /**
29 * Turn on OpenCL group interpreter. Call this after the document is
30 * loaded and before performing formula calculation.
32 void enableOpenCL();
34 virtual void setUp() override;
35 virtual void tearDown() override;
37 void testSystematic();
38 void testSharedFormulaXLS();
39 #if 0
40 void testSharedFormulaXLSGroundWater();
41 void testSharedFormulaXLSStockHistory();
42 #endif
43 void testFinacialFormula();
44 void testStatisticalFormulaFisher();
45 void testStatisticalFormulaFisherInv();
46 void testStatisticalFormulaGamma();
47 void testFinacialFvscheduleFormula();
48 // this test has intermittent failures on OSX
49 #if !defined MACOSX
50 void testFinacialIRRFormula();
51 #endif
52 void testFinacialMIRRFormula();
53 void testFinacialRateFormula();
54 void testFinancialAccrintmFormula();
55 void testFinancialAccrintFormula();
56 void testCompilerHorizontal();
57 void testCompilerNested();
58 void testFinacialSLNFormula();
59 void testStatisticalFormulaGammaLn();
60 void testStatisticalFormulaGauss();
61 void testStatisticalFormulaGeoMean();
62 void testStatisticalFormulaHarMean();
63 void testFinancialCoupdaybsFormula();
64 void testFinacialDollardeFormula();
65 void testCompilerString();
66 void testCompilerInEq();
67 void testFinacialDollarfrFormula();
68 void testFinacialSYDFormula();
69 void testStatisticalFormulaCorrel();
70 void testFinancialCoupdaysFormula();
71 void testFinancialCoupdaysncFormula();
72 void testFinacialDISCFormula();
73 void testFinacialINTRATEFormula();
74 void testMathFormulaCos();
75 void testMathFormulaCsc();
76 void testStatisticalFormulaRsq();
77 void testStatisticalFormulaPearson();
78 void testStatisticalFormulaNegbinomdist();
79 void testFinacialXNPVFormula();
80 void testFinacialPriceMatFormula();
81 void testFinacialFormulaReceived();
82 void testFinancialFormulaCumipmt();
83 void testFinancialFormulaCumprinc();
84 void testFinacialRRIFormula();
85 void testFinacialEFFECT_ADDFormula();
86 void testFinacialNominalFormula();
87 void testFinacialTBILLEQFormula();
88 void testFinacialTBILLPRICEFormula();
89 void testFinacialTBILLYIELDFormula();
90 void testFinacialYIELDFormula();
91 void testFinacialYIELDDISCFormula();
92 void testFinacialYIELDMATFormula();
93 void testFinacialPMTFormula();
94 void testFinacialPPMTFormula();
95 void testFinancialISPMTFormula();
96 void testFinacialPriceFormula();
97 void testFinancialDurationFormula();
98 void testFinancialCoupnumFormula();
99 void testMathFormulaSinh();
100 void testMathFormulaAbs();
101 void testFinacialPVFormula();
102 void testMathFormulaSin();
103 void testMathFormulaTan();
104 void testMathFormulaTanH();
105 void testStatisticalFormulaStandard();
106 void testStatisticalFormulaWeibull();
107 void testStatisticalFormulaMedian();
108 void testFinancialDuration_ADDFormula();
109 void testFinancialAmordegrcFormula();
110 void testFinancialAmorlincFormula();
111 void testFinancialDDBFormula();
112 void testFinancialFVFormula();
113 void testFinancialMDurationFormula();
114 void testMathSumIfsFormula();
115 void testFinancialVDBFormula();
116 void testStatisticalFormulaKurt();
117 void testFinacialNPERFormula();
118 void testStatisticalFormulaNormdist();
119 void testMathFormulaArcCos();
120 void testMathFormulaSqrt();
121 void testMathFormulaArcCosHyp();
122 void testFinacialNPVFormula();
123 void testStatisticalFormulaNormsdist();
124 void testStatisticalFormulaNorminv();
125 void testStatisticalFormulaNormsinv();
126 void testStatisticalFormulaPermut();
127 void testStatisticalFormulaPermutation();
128 void testStatisticalFormulaPhi();
129 void testFinancialIPMTFormula();
130 void testStatisticalFormulaConfidence();
131 void testStatisticalFormulaIntercept();
132 void testFinacialODDLPRICEFormula();
133 void testFinacialOddlyieldFormula();
134 void testFinacialPriceDiscFormula();
135 void testFinancialDBFormula();
136 void testFinancialCouppcdFormula();
137 void testFinancialCoupncdFormula();
138 void testStatisticalFormulaLogInv();
139 void testMathFormulaArcCot();
140 void testMathFormulaCosh();
141 void testStatisticalFormulaCritBinom();
142 void testMathFormulaArcCotHyp();
143 void testMathFormulaArcSin();
144 void testMathFormulaArcSinHyp();
145 void testMathFormulaArcTan();
146 void testMathFormulaArcTanHyp();
147 void testMathFormulaBitAnd();
148 void testStatisticalFormulaForecast();
149 void testStatisticalFormulaLogNormDist();
150 void testStatisticalFormulaGammaDist();
151 void testMathFormulaLN();
152 void testMathFormulaRound();
153 void testMathFormulaCot();
154 void testMathFormulaCoth();
155 void testFinacialNPER1Formula();
156 void testStatisticalFormulaFDist();
157 void testStatisticalFormulaVar();
158 void testStatisticalFormulaChiDist();
159 void testMathFormulaPower();
160 void testMathFormulaOdd();
161 void testStatisticalFormulaChiSqDist();
162 void testStatisticalFormulaChiSqInv();
163 void testStatisticalFormulaGammaInv();
164 void testMathFormulaFloor();
165 void testStatisticalFormulaFInv();
166 void testStatisticalFormulaFTest();
167 void testStatisticalFormulaB();
168 void testStatisticalFormulaBetaDist();
169 void testMathFormulaCscH();
170 void testMathFormulaExp();
171 void testMathFormulaLog10();
172 void testStatisticalFormulaExpondist();
173 void testMathAverageIfsFormula();
174 void testMathCountIfsFormula();
175 void testMathFormulaCombina();
176 void testMathFormulaEven();
177 void testMathFormulaLog();
178 void testMathFormulaMod();
179 void testMathFormulaTrunc();
180 void testStatisticalFormulaSkew();
181 void testMathFormulaArcTan2();
182 void testMathFormulaBitOr();
183 void testMathFormulaBitLshift();
184 void testMathFormulaBitRshift();
185 void testMathFormulaBitXor();
186 void testStatisticalFormulaChiInv();
187 void testStatisticalFormulaPoisson();
188 void testMathFormulaSumSQ();
189 void testStatisticalFormulaSkewp();
190 void testMathFormulaSqrtPi();
191 void testStatisticalFormulaBinomDist();
192 void testStatisticalFormulaVarP();
193 void testMathFormulaCeil();
194 // void testMathFormulaKombin();
195 void testStatisticalFormulaDevSq();
196 void testStatisticalFormulaStDev();
197 void testStatisticalFormulaSlope();
198 void testStatisticalFormulaSTEYX();
199 void testStatisticalFormulaZTest();
200 void testMathFormulaPi();
201 void testMathFormulaRandom();
202 void testMathFormulaConvert();
203 void testMathFormulaProduct();
204 void testStatisticalFormulaHypGeomDist();
205 void testArrayFormulaSumX2MY2();
206 void testArrayFormulaSumX2PY2();
207 void testStatisticalFormulaBetainv();
208 void testStatisticalFormulaTTest();
209 void testStatisticalFormulaTDist();
210 void testStatisticalFormulaTInv();
211 void testArrayFormulaSumXMY2();
212 void testStatisticalFormulaStDevP();
213 void testStatisticalFormulaCovar();
214 void testLogicalFormulaAnd();
215 void testLogicalFormulaOr();
216 void testMathFormulaSumProduct();
217 void testMathFormulaSumProduct2();
218 void testStatisticalParallelCountBug();
219 void testSpreadSheetFormulaVLookup();
220 void testLogicalFormulaNot();
221 void testLogicalFormulaXor();
222 void testDatabaseFormulaDmax();
223 void testDatabaseFormulaDmin();
224 void testDatabaseFormulaDproduct();
225 void testDatabaseFormulaDaverage();
226 void testDatabaseFormulaDstdev();
227 void testDatabaseFormulaDstdevp();
228 void testDatabaseFormulaDsum();
229 void testDatabaseFormulaDvar();
230 void testDatabaseFormulaDvarp();
231 void testMathFormulaAverageIf();
232 void testDatabaseFormulaDcount();
233 void testDatabaseFormulaDcountA();
234 void testMathFormulaDegrees();
235 void testMathFormulaRoundUp();
236 void testMathFormulaRoundDown();
237 void testMathFormulaInt();
238 void testMathFormulaRadians();
239 void testMathFormulaCountIf();
240 void testMathFormulaIsEven();
241 void testMathFormulaIsOdd();
242 void testMathFormulaFact();
243 void testStatisticalFormulaMina();
244 void testStatisticalFormulaCountA();
245 void testStatisticalFormulaMaxa();
246 void testStatisticalFormulaAverageA();
247 void testStatisticalFormulaVarA();
248 void testStatisticalFormulaVarPA();
249 void testStatisticalFormulaStDevA();
250 void testStatisticalFormulaStDevPA();
251 void testMathFormulaSEC();
252 void testMathFormulaSECH();
253 void testMathFormulaMROUND();
254 void testMathFormulaSeriesSum();
255 void testMathFormulaQuotient();
256 void testMathFormulaSumIf();
257 void testAddInFormulaBesseLJ();
258 void testNegSub();
259 void testStatisticalFormulaAvedev();
260 void testMathFormulaAverageIf_Mix();
261 void testStatisticalFormulaKurt1();
262 void testStatisticalFormulaHarMean1();
263 void testStatisticalFormulaVarA1();
264 void testStatisticalFormulaVarPA1();
265 void testStatisticalFormulaStDevA1();
266 void testStatisticalFormulaStDevPA1();
267 void testFinancialMDurationFormula1();
269 CPPUNIT_TEST_SUITE(ScOpenCLTest);
270 CPPUNIT_TEST(testSystematic);
271 CPPUNIT_TEST(testSharedFormulaXLS);
272 CPPUNIT_TEST(testFinacialFormula);
273 CPPUNIT_TEST(testStatisticalFormulaFisher);
274 CPPUNIT_TEST(testStatisticalFormulaFisherInv);
275 CPPUNIT_TEST(testStatisticalFormulaGamma);
276 CPPUNIT_TEST(testFinacialFvscheduleFormula);
277 // this test has intermittent failures on OSX
278 #if !defined MACOSX
279 CPPUNIT_TEST(testFinacialIRRFormula);
280 #endif
281 CPPUNIT_TEST(testFinacialMIRRFormula);
282 CPPUNIT_TEST(testFinacialRateFormula);
283 CPPUNIT_TEST(testCompilerHorizontal);
284 CPPUNIT_TEST(testCompilerNested);
285 CPPUNIT_TEST(testFinacialSLNFormula);
286 CPPUNIT_TEST(testFinancialAccrintmFormula);
287 CPPUNIT_TEST(testStatisticalFormulaGammaLn);
288 CPPUNIT_TEST(testStatisticalFormulaGauss);
289 CPPUNIT_TEST(testStatisticalFormulaGeoMean);
290 CPPUNIT_TEST(testStatisticalFormulaHarMean);
291 CPPUNIT_TEST(testFinancialCoupdaybsFormula);
292 CPPUNIT_TEST(testFinacialDollardeFormula);
293 CPPUNIT_TEST(testCompilerString);
294 CPPUNIT_TEST(testCompilerInEq);
295 CPPUNIT_TEST(testFinacialDollarfrFormula);
296 CPPUNIT_TEST(testFinacialSYDFormula);
297 CPPUNIT_TEST(testStatisticalFormulaCorrel);
298 CPPUNIT_TEST(testFinancialCoupdaysFormula);
299 CPPUNIT_TEST(testFinancialCoupdaysncFormula);
300 CPPUNIT_TEST(testFinacialDISCFormula);
301 CPPUNIT_TEST(testFinacialINTRATEFormula);
302 CPPUNIT_TEST(testMathFormulaCos);
303 CPPUNIT_TEST(testStatisticalFormulaNegbinomdist);
304 CPPUNIT_TEST(testStatisticalFormulaRsq);
305 CPPUNIT_TEST(testStatisticalFormulaPearson);
306 CPPUNIT_TEST(testMathFormulaCsc);
307 CPPUNIT_TEST(testFinacialPriceMatFormula);
308 CPPUNIT_TEST(testFinacialXNPVFormula);
309 CPPUNIT_TEST(testFinacialFormulaReceived);
310 CPPUNIT_TEST(testFinancialFormulaCumipmt);
311 CPPUNIT_TEST(testFinancialFormulaCumprinc);
312 CPPUNIT_TEST(testFinacialRRIFormula);
313 CPPUNIT_TEST(testFinacialEFFECT_ADDFormula);
314 CPPUNIT_TEST(testFinacialNominalFormula);
315 CPPUNIT_TEST(testFinacialTBILLEQFormula);
316 CPPUNIT_TEST(testFinacialTBILLPRICEFormula);
317 CPPUNIT_TEST(testFinacialTBILLYIELDFormula);
318 CPPUNIT_TEST(testFinacialYIELDFormula);
319 CPPUNIT_TEST(testFinacialYIELDDISCFormula);
320 CPPUNIT_TEST(testFinacialYIELDMATFormula);
321 CPPUNIT_TEST(testFinacialPPMTFormula);
322 CPPUNIT_TEST(testFinacialPMTFormula);
323 CPPUNIT_TEST(testFinancialISPMTFormula);
324 CPPUNIT_TEST(testFinacialPriceFormula);
325 CPPUNIT_TEST(testFinancialDurationFormula);
326 CPPUNIT_TEST(testFinancialCoupnumFormula);
327 CPPUNIT_TEST(testMathFormulaSinh);
328 CPPUNIT_TEST(testMathFormulaAbs);
329 CPPUNIT_TEST(testFinacialPVFormula);
330 CPPUNIT_TEST(testMathFormulaSin);
331 CPPUNIT_TEST(testMathFormulaTan);
332 CPPUNIT_TEST(testMathFormulaTanH);
333 CPPUNIT_TEST(testStatisticalFormulaStandard);
334 CPPUNIT_TEST(testStatisticalFormulaWeibull);
335 CPPUNIT_TEST(testStatisticalFormulaMedian);
336 CPPUNIT_TEST(testFinancialDuration_ADDFormula);
337 CPPUNIT_TEST(testFinancialAmordegrcFormula);
338 CPPUNIT_TEST(testFinancialAmorlincFormula);
339 CPPUNIT_TEST(testFinancialDDBFormula);
340 CPPUNIT_TEST(testFinancialFVFormula);
341 CPPUNIT_TEST(testFinancialMDurationFormula);
342 CPPUNIT_TEST(testMathSumIfsFormula);
343 CPPUNIT_TEST(testFinancialVDBFormula);
344 CPPUNIT_TEST(testStatisticalFormulaKurt);
345 CPPUNIT_TEST(testFinacialNPERFormula);
346 CPPUNIT_TEST(testStatisticalFormulaNormdist);
347 CPPUNIT_TEST(testMathFormulaArcCos);
348 CPPUNIT_TEST(testMathFormulaSqrt);
349 CPPUNIT_TEST(testMathFormulaArcCosHyp);
350 CPPUNIT_TEST(testFinacialNPVFormula);
351 CPPUNIT_TEST(testStatisticalFormulaNormsdist);
352 CPPUNIT_TEST(testStatisticalFormulaNorminv);
353 CPPUNIT_TEST(testStatisticalFormulaNormsinv);
354 CPPUNIT_TEST(testStatisticalFormulaPermut);
355 CPPUNIT_TEST(testStatisticalFormulaPermutation);
356 CPPUNIT_TEST(testStatisticalFormulaPhi);
357 CPPUNIT_TEST(testFinancialIPMTFormula);
358 CPPUNIT_TEST(testStatisticalFormulaConfidence);
359 CPPUNIT_TEST(testStatisticalFormulaIntercept);
360 CPPUNIT_TEST(testFinacialODDLPRICEFormula);
361 CPPUNIT_TEST(testFinacialOddlyieldFormula);
362 CPPUNIT_TEST(testFinacialPriceDiscFormula);
363 CPPUNIT_TEST(testFinancialDBFormula);
364 CPPUNIT_TEST(testFinancialCouppcdFormula);
365 CPPUNIT_TEST(testFinancialCoupncdFormula);
366 CPPUNIT_TEST(testFinancialAccrintFormula);
367 CPPUNIT_TEST(testStatisticalFormulaLogInv);
368 CPPUNIT_TEST(testMathFormulaArcCot);
369 CPPUNIT_TEST(testMathFormulaCosh);
370 CPPUNIT_TEST(testStatisticalFormulaCritBinom);
371 CPPUNIT_TEST(testMathFormulaArcCotHyp);
372 CPPUNIT_TEST(testMathFormulaArcSin);
373 CPPUNIT_TEST(testMathFormulaArcSinHyp);
374 CPPUNIT_TEST(testMathFormulaArcTan);
375 CPPUNIT_TEST(testMathFormulaArcTanHyp);
376 CPPUNIT_TEST(testMathFormulaBitAnd);
377 CPPUNIT_TEST(testStatisticalFormulaForecast);
378 CPPUNIT_TEST(testStatisticalFormulaLogNormDist);
379 CPPUNIT_TEST(testStatisticalFormulaGammaDist);
380 CPPUNIT_TEST(testMathFormulaLN);
381 CPPUNIT_TEST(testMathFormulaRound);
382 CPPUNIT_TEST(testMathFormulaCot);
383 CPPUNIT_TEST(testMathFormulaCoth);
384 CPPUNIT_TEST(testFinacialNPER1Formula);
385 CPPUNIT_TEST(testStatisticalFormulaFDist);
386 CPPUNIT_TEST(testStatisticalFormulaVar);
387 CPPUNIT_TEST(testStatisticalFormulaChiDist);
388 CPPUNIT_TEST(testMathFormulaPower);
389 CPPUNIT_TEST(testMathFormulaOdd);
390 CPPUNIT_TEST(testStatisticalFormulaChiSqDist);
391 CPPUNIT_TEST(testStatisticalFormulaChiSqInv);
392 CPPUNIT_TEST(testStatisticalFormulaGammaInv);
393 CPPUNIT_TEST(testMathFormulaFloor);
394 CPPUNIT_TEST(testStatisticalFormulaFInv);
395 CPPUNIT_TEST(testStatisticalFormulaFTest);
396 CPPUNIT_TEST(testStatisticalFormulaB);
397 CPPUNIT_TEST(testStatisticalFormulaBetaDist);
398 CPPUNIT_TEST(testMathFormulaCscH);
399 CPPUNIT_TEST(testMathFormulaExp);
400 CPPUNIT_TEST(testMathFormulaLog10);
401 CPPUNIT_TEST(testStatisticalFormulaExpondist);
402 CPPUNIT_TEST(testMathAverageIfsFormula);
403 CPPUNIT_TEST(testMathCountIfsFormula);
404 CPPUNIT_TEST(testMathFormulaCombina);
405 CPPUNIT_TEST(testMathFormulaEven);
406 CPPUNIT_TEST(testMathFormulaLog);
407 CPPUNIT_TEST(testMathFormulaMod);
408 CPPUNIT_TEST(testMathFormulaTrunc);
409 CPPUNIT_TEST(testStatisticalFormulaSkew);
410 CPPUNIT_TEST(testMathFormulaArcTan2);
411 CPPUNIT_TEST(testMathFormulaBitOr);
412 CPPUNIT_TEST(testMathFormulaBitLshift);
413 CPPUNIT_TEST(testMathFormulaBitRshift);
414 CPPUNIT_TEST(testMathFormulaBitXor);
415 CPPUNIT_TEST(testStatisticalFormulaChiInv);
416 CPPUNIT_TEST(testStatisticalFormulaPoisson);
417 CPPUNIT_TEST(testMathFormulaSumSQ);
418 CPPUNIT_TEST(testStatisticalFormulaSkewp);
419 CPPUNIT_TEST(testMathFormulaSqrtPi);
420 CPPUNIT_TEST(testStatisticalFormulaBinomDist);
421 CPPUNIT_TEST(testStatisticalFormulaVarP);
422 CPPUNIT_TEST(testMathFormulaCeil);
423 // This test fails MacOS 10.8. Disabled temporarily
424 // CPPUNIT_TEST(testMathFormulaKombin);
425 CPPUNIT_TEST(testStatisticalFormulaDevSq);
426 CPPUNIT_TEST(testStatisticalFormulaStDev);
427 CPPUNIT_TEST(testStatisticalFormulaSlope);
428 CPPUNIT_TEST(testStatisticalFormulaSTEYX);
429 CPPUNIT_TEST(testStatisticalFormulaZTest);
430 CPPUNIT_TEST(testMathFormulaPi);
431 CPPUNIT_TEST(testMathFormulaRandom);
432 CPPUNIT_TEST(testMathFormulaConvert);
433 CPPUNIT_TEST(testMathFormulaProduct);
434 CPPUNIT_TEST(testStatisticalFormulaHypGeomDist);
435 CPPUNIT_TEST(testArrayFormulaSumX2MY2);
436 CPPUNIT_TEST(testArrayFormulaSumX2PY2);
437 CPPUNIT_TEST(testStatisticalFormulaBetainv);
438 CPPUNIT_TEST(testStatisticalFormulaTTest);
439 CPPUNIT_TEST(testStatisticalFormulaTDist);
440 CPPUNIT_TEST(testStatisticalFormulaTInv);
441 CPPUNIT_TEST(testArrayFormulaSumXMY2);
442 CPPUNIT_TEST(testStatisticalFormulaStDevP);
443 CPPUNIT_TEST(testStatisticalFormulaCovar);
444 CPPUNIT_TEST(testLogicalFormulaAnd);
445 CPPUNIT_TEST(testMathFormulaSumProduct);
446 CPPUNIT_TEST(testMathFormulaSumProduct2);
447 CPPUNIT_TEST(testStatisticalParallelCountBug);
448 CPPUNIT_TEST(testSpreadSheetFormulaVLookup);
449 CPPUNIT_TEST(testLogicalFormulaOr);
450 CPPUNIT_TEST(testLogicalFormulaNot);
451 CPPUNIT_TEST(testLogicalFormulaXor);
452 CPPUNIT_TEST(testDatabaseFormulaDmax);
453 CPPUNIT_TEST(testDatabaseFormulaDmin);
454 CPPUNIT_TEST(testDatabaseFormulaDproduct);
455 CPPUNIT_TEST(testDatabaseFormulaDaverage);
456 CPPUNIT_TEST(testDatabaseFormulaDstdev);
457 CPPUNIT_TEST(testDatabaseFormulaDstdevp);
458 CPPUNIT_TEST(testDatabaseFormulaDsum);
459 CPPUNIT_TEST(testDatabaseFormulaDvar);
460 CPPUNIT_TEST(testDatabaseFormulaDvarp);
461 CPPUNIT_TEST(testMathFormulaAverageIf);
462 CPPUNIT_TEST(testDatabaseFormulaDcount);
463 CPPUNIT_TEST(testDatabaseFormulaDcountA);
464 CPPUNIT_TEST(testMathFormulaDegrees);
465 CPPUNIT_TEST(testMathFormulaRoundUp);
466 CPPUNIT_TEST(testMathFormulaRoundDown);
467 CPPUNIT_TEST(testMathFormulaInt);
468 CPPUNIT_TEST(testMathFormulaRadians);
469 CPPUNIT_TEST(testMathFormulaCountIf);
470 CPPUNIT_TEST(testMathFormulaIsEven);
471 CPPUNIT_TEST(testMathFormulaIsOdd);
472 CPPUNIT_TEST(testMathFormulaFact);
473 CPPUNIT_TEST(testStatisticalFormulaMaxa);
474 CPPUNIT_TEST(testStatisticalFormulaMina);
475 CPPUNIT_TEST(testStatisticalFormulaCountA);
476 CPPUNIT_TEST(testStatisticalFormulaAverageA);
477 CPPUNIT_TEST(testStatisticalFormulaVarA);
478 CPPUNIT_TEST(testStatisticalFormulaVarPA);
479 CPPUNIT_TEST(testStatisticalFormulaStDevA);
480 CPPUNIT_TEST(testStatisticalFormulaStDevPA);
481 CPPUNIT_TEST(testMathFormulaSEC);
482 CPPUNIT_TEST(testMathFormulaSECH);
483 CPPUNIT_TEST(testMathFormulaMROUND);
484 CPPUNIT_TEST(testMathFormulaQuotient);
485 CPPUNIT_TEST(testMathFormulaSeriesSum);
486 CPPUNIT_TEST(testMathFormulaSumIf);
487 CPPUNIT_TEST(testAddInFormulaBesseLJ);
488 CPPUNIT_TEST(testNegSub);
489 CPPUNIT_TEST(testStatisticalFormulaAvedev);
490 CPPUNIT_TEST(testMathFormulaAverageIf_Mix);
491 CPPUNIT_TEST(testStatisticalFormulaKurt1);
492 CPPUNIT_TEST(testStatisticalFormulaHarMean1);
493 CPPUNIT_TEST(testStatisticalFormulaVarA1);
494 CPPUNIT_TEST(testStatisticalFormulaVarPA1);
495 CPPUNIT_TEST(testStatisticalFormulaStDevA1);
496 CPPUNIT_TEST(testStatisticalFormulaStDevPA1);
497 CPPUNIT_TEST(testFinancialMDurationFormula1);
498 CPPUNIT_TEST_SUITE_END();
500 private:
501 uno::Reference<uno::XInterface> m_xCalcComponent;
503 // Test env variables and methods
504 ScDocShellRef xDocSh;
505 ScDocShellRef xDocShRes;
506 bool initTestEnv(const OUString& fileName, sal_Int32 nFormat,
507 bool bReadWrite);
510 bool ScOpenCLTest::initTestEnv(const OUString& fileName, sal_Int32 nFormat,
511 bool bReadWrite)
513 if(!detectOpenCLDevice())
514 return false;
516 xDocSh = loadDoc(fileName, nFormat, bReadWrite);
517 CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.is());
518 enableOpenCL();
520 xDocShRes = loadDoc(fileName, nFormat, bReadWrite);
521 CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.is());
523 return true;
526 bool ScOpenCLTest::detectOpenCLDevice()
528 sc::FormulaGroupInterpreter::enableOpenCL_UnitTestsOnly();
529 return sc::FormulaGroupInterpreter::switchOpenCLDevice(OUString(),true);
532 void ScOpenCLTest::enableOpenCL()
534 sc::FormulaGroupInterpreter::enableOpenCL_UnitTestsOnly();
537 void ScOpenCLTest::testCompilerHorizontal()
539 if(!initTestEnv("opencl/compiler/horizontal.", FORMAT_ODS, false))
540 return;
541 ScDocument& rDoc = xDocSh->GetDocument();
542 ScDocument& rDocRes = xDocShRes->GetDocument();
543 rDoc.CalcAll();
545 // Check the results of formula cells in the shared formula range.
546 for (SCROW i = 1; i < 5; ++i)
548 double fLibre = rDoc.GetValue(ScAddress(12, i, 0));
549 double fExcel = rDocRes.GetValue(ScAddress(12, i, 0));
550 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
551 fLibre = rDoc.GetValue(ScAddress(13, i, 0));
552 fExcel = rDocRes.GetValue(ScAddress(13, i, 0));
553 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
554 fLibre = rDoc.GetValue(ScAddress(14, i, 0));
555 fExcel = rDocRes.GetValue(ScAddress(14, i, 0));
556 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
560 void ScOpenCLTest::testCompilerNested()
562 if(!initTestEnv("opencl/compiler/nested.", FORMAT_ODS, false))
563 return;
564 ScDocument& rDoc = xDocSh->GetDocument();
565 ScDocument& rDocRes = xDocShRes->GetDocument();
566 rDoc.CalcAll();
568 // Check the results of formula cells in the shared formula range.
569 for (SCROW i = 1; i < 5; ++i)
571 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
572 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
573 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
577 void ScOpenCLTest::testCompilerString()
579 if(!initTestEnv("opencl/compiler/string.", FORMAT_ODS, false))
580 return;
581 ScDocument& rDoc = xDocSh->GetDocument();
582 ScDocument& rDocRes = xDocShRes->GetDocument();
583 rDoc.CalcAll();
585 // Check the results of formula cells in the shared formula range.
586 for (SCROW i = 1; i < 5; ++i)
588 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
589 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
590 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
592 fLibre = rDoc.GetValue(ScAddress(3, i, 0));
593 fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
594 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
598 void ScOpenCLTest::testCompilerInEq()
600 if(!initTestEnv("opencl/compiler/ineq.", FORMAT_ODS, false))
601 return;
602 ScDocument& rDoc = xDocSh->GetDocument();
603 ScDocument& rDocRes = xDocShRes->GetDocument();
604 rDoc.CalcAll();
606 // Check the results of formula cells in the shared formula range.
607 for (SCROW i = 1; i < 7; ++i)
609 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
610 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
611 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
615 #if 0
616 void ScOpenCLTest::testSharedFormulaXLSStockHistory()
618 if(!initTestEnv("stock-history.", FORMAT_XLS, false))
619 return;
620 ScDocument& rDoc = xDocSh->GetDocument();
621 ScDocument& rDocRes = xDocShRes->GetDocument();
622 xDocSh->DoHardRecalc();
624 // Check the results of formula cells in the shared formula range.
625 for (SCROW i = 33; i < 44; ++i)
626 { // Cell H34:H44 in S&P 500 (tab 1)
627 double fLibre = rDoc.GetValue(ScAddress(7, i, 1));
628 double fExcel = rDocRes.GetValue(ScAddress(7, i, 1));
629 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
632 for (SCROW i = 33; i < 44; ++i)
633 { // Cell J34:J44 in S&P 500 (tab 1)
634 double fLibre = rDoc.GetValue(ScAddress(9, i, 1));
635 double fExcel = rDocRes.GetValue(ScAddress(9, i, 1));
636 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
640 void ScOpenCLTest::testSharedFormulaXLSGroundWater()
642 if(!initTestEnv("ground-water-daily.", FORMAT_XLS, false))
643 return;
644 ScDocument& rDoc = xDocSh->GetDocument();
645 ScDocument& rDocRes = xDocShRes->GetDocument();
646 xDocSh->DoHardRecalc();
648 // Check the results of formula cells in the shared formula range.
649 for (SCROW i = 5; i <= 77; ++i)
651 double fLibre = rDoc.GetValue(ScAddress(11,i,1));
652 double fExcel = rDocRes.GetValue(ScAddress(11,i,1));
653 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
658 #endif
660 void ScOpenCLTest::testSystematic()
662 if(!initTestEnv("systematic.", FORMAT_XLS, false))
663 return;
665 ScDocument& rDoc = xDocSh->GetDocument();
666 rDoc.CalcAll();
668 int nAVertBegin(0), nAVertEnd(0), nBVertBegin(0), nBVertEnd(0);
669 int nAHorEnd(0), nBHorEnd(0);
671 int nRow, nCol;
672 for (nRow = 0; nRow < 1000; ++nRow)
674 if (rDoc.GetString(ScAddress(0, nRow, 0)) == "a")
676 nAVertBegin = nRow + 1;
678 for (nCol = 0; nCol < 1000; ++nCol)
680 if (rDoc.GetString(ScAddress(nCol, nRow, 0)) != "a")
682 nAHorEnd = nCol;
683 break;
686 break;
689 for (; nRow < 1000; ++nRow)
691 if (rDoc.GetString(ScAddress(0, nRow, 0)) != "a")
693 nAVertEnd = nRow;
694 break;
698 for (; nRow < 1000; ++nRow)
700 if (rDoc.GetString(ScAddress(0, nRow, 0)) == "b")
702 nBVertBegin = nRow + 1;
704 for (nCol = 0; nCol < 1000; ++nCol)
706 if (rDoc.GetString(ScAddress(nCol, nRow, 0)) != "b")
708 nBHorEnd = nCol;
709 break;
712 break;
715 for (; nRow < 1000; ++nRow)
717 if (rDoc.GetString(ScAddress(0, nRow, 0)) != "b")
719 nBVertEnd = nRow;
720 break;
724 CPPUNIT_ASSERT(nAVertBegin != 0);
725 CPPUNIT_ASSERT(nBVertBegin != 0);
726 CPPUNIT_ASSERT(nAVertEnd > nAVertBegin + 100);
727 CPPUNIT_ASSERT(nBVertEnd > nBVertBegin + 100);
728 CPPUNIT_ASSERT_EQUAL(nAVertEnd-nAVertBegin, nBVertEnd-nBVertBegin);
729 CPPUNIT_ASSERT(nAHorEnd > 10);
730 CPPUNIT_ASSERT(nBHorEnd > 10);
731 CPPUNIT_ASSERT_EQUAL(nAHorEnd, nBHorEnd);
733 for (SCROW i = nAVertBegin; i < nAVertEnd; ++i)
735 for (int j = 1; j < nAHorEnd; ++j)
737 double fLibre = rDoc.GetValue(ScAddress(j, i, 0));
738 double fExcel = rDoc.GetValue(ScAddress(j, nBVertBegin + (i - nAVertBegin), 0));
740 const OString sFailedMessage =
741 OStringChar(static_cast<sal_Char>('A'+j)) +
742 OString::number(i+1) +
743 "!=" +
744 OStringChar(static_cast<sal_Char>('A'+j)) +
745 OString::number(nBVertBegin+(i-nAVertBegin)+1);
746 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(sFailedMessage.getStr(), fExcel, fLibre, 1e-10);
752 void ScOpenCLTest::testSharedFormulaXLS()
754 if(!initTestEnv("sum_ex.", FORMAT_XLS, false))
755 return;
756 ScDocument& rDoc = xDocSh->GetDocument();
757 ScDocument& rDocRes = xDocShRes->GetDocument();
758 rDoc.CalcAll();
760 // Check the results of formula cells in the shared formula range.
761 for (SCROW i = 0; i < 5; ++i)
763 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
764 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
765 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
768 for (SCROW i = 6; i < 14; ++i)
770 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
771 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
772 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
775 for (SCROW i = 15; i < 18; ++i)
777 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
778 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
779 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
782 for (SCROW i = 19; i < 22; ++i)
784 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
785 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
786 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
789 for (SCROW i = 23; i < 25; ++i)
791 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
792 //double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
793 // There seems to be a bug in LibreOffice beta
794 ASSERT_DOUBLES_EQUAL(/*fExcel*/ 60.0, fLibre);
797 for (SCROW i = 25; i < 27; ++i)
799 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
800 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
801 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
804 for (SCROW i = 28; i < 35; ++i)
806 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
807 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
808 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
811 // workaround for a Calc beta bug
812 ASSERT_DOUBLES_EQUAL(25.0, rDoc.GetValue(ScAddress(2, 35, 0)));
813 ASSERT_DOUBLES_EQUAL(24.0, rDoc.GetValue(ScAddress(2, 36, 0)));
815 for (SCROW i = 38; i < 43; ++i)
817 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
818 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
819 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
822 for (SCROW i = 5; i < 10; ++i)
824 double fLibre = rDoc.GetValue(ScAddress(5, i, 1));
825 double fExcel = rDocRes.GetValue(ScAddress(5, i, 1));
826 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
829 for (SCROW i = 5; i < 10; ++i)
831 for (SCCOL j = 6; j < 11; ++j)
833 double fLibre = rDoc.GetValue(ScAddress(j, i, 1));
834 double fExcel = rDocRes.GetValue(ScAddress(j, i, 1));
835 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
836 fabs(fExcel*0.0001));
841 void ScOpenCLTest::testMathFormulaCos()
843 if(!initTestEnv("opencl/math/cos.", FORMAT_XLS, false))
844 return;
845 ScDocument& rDoc = xDocSh->GetDocument();
846 ScDocument& rDocRes = xDocShRes->GetDocument();
847 rDoc.CalcAll();
849 for (SCROW i = 0; i <= 15; ++i)
851 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
852 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
853 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
857 void ScOpenCLTest::testMathFormulaSinh()
859 if(!initTestEnv("opencl/math/sinh.", FORMAT_XLS, false))
860 return;
861 ScDocument& rDoc = xDocSh->GetDocument();
862 ScDocument& rDocRes = xDocShRes->GetDocument();
863 xDocSh->DoHardRecalc();
865 for (SCROW i = 0; i <= 15; ++i)
867 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
868 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
869 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
873 void ScOpenCLTest::testMathFormulaPi()
875 if(!initTestEnv("opencl/math/pi.", FORMAT_XLS, false))
876 return;
877 ScDocument& rDoc = xDocSh->GetDocument();
878 ScDocument& rDocRes = xDocShRes->GetDocument();
879 rDoc.CalcAll();
881 for (SCROW i = 0; i <= 15; ++i)
883 double fLibre = rDoc.GetValue(ScAddress(0,i,0));
884 double fExcel = rDocRes.GetValue(ScAddress(0,i,0));
885 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
889 void ScOpenCLTest::testMathFormulaRandom()
891 if(!initTestEnv("opencl/math/random.", FORMAT_XLS, false))
892 return;
893 ScDocument& rDoc = xDocSh->GetDocument();
894 ScDocument& rDocRes = xDocShRes->GetDocument();
895 rDoc.CalcAll();
897 for (SCROW i = 0; i <= 15; ++i)
899 rDoc.GetValue(ScAddress(0,i,0)); // LO
900 rDocRes.GetValue(ScAddress(0,i,0)); // Excel
901 //because the random numbers will always change,so give the test "true"
902 CPPUNIT_ASSERT(true);
905 void ScOpenCLTest::testFinacialFormula()
907 if(!initTestEnv("opencl/financial/general.", FORMAT_XLS, false))
908 return;
909 ScDocument& rDoc = xDocSh->GetDocument();
910 ScDocument& rDocRes = xDocShRes->GetDocument();
911 rDoc.CalcAll();
913 // Check the results of formula cells in the shared formula range.
914 for (SCROW i = 1; i <= 10; ++i)
916 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
917 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
918 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
921 for (SCROW i = 1; i <= 10; ++i)
923 double fLibre = rDoc.GetValue(ScAddress(6,i,1));
924 double fExcel = rDocRes.GetValue(ScAddress(6,i,1));
925 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
928 for (SCROW i = 1; i <= 10; ++i)
930 double fLibre = rDoc.GetValue(ScAddress(2,i,2));
931 double fExcel = rDocRes.GetValue(ScAddress(2,i,2));
932 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
935 for (SCROW i = 1; i <= 10; ++i)
937 double fLibre = rDoc.GetValue(ScAddress(6,i,3));
938 double fExcel = rDocRes.GetValue(ScAddress(6,i,3));
939 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
942 for (SCROW i = 0; i <= 9; ++i)
944 double fLibre = rDoc.GetValue(ScAddress(3,i,4));
945 double fExcel = rDocRes.GetValue(ScAddress(3,i,4));
946 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
949 for (SCROW i = 0; i <= 9; ++i)
951 double fLibre = rDoc.GetValue(ScAddress(3,i,5));
952 double fExcel = rDocRes.GetValue(ScAddress(3,i,5));
953 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
956 for (SCROW i = 0; i < 10; ++i)
958 double fLibre = rDoc.GetValue(ScAddress(5,i,6));
959 double fExcel = rDocRes.GetValue(ScAddress(5,i,6));
960 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
963 for (SCROW i = 1; i <= 9; ++i)
965 double fLibre = rDoc.GetValue(ScAddress(3,i,7));
966 double fExcel = rDocRes.GetValue(ScAddress(3,i,7));
967 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
970 for (SCROW i = 1; i <= 10; ++i)
972 double fLibre = rDoc.GetValue(ScAddress(3,i,8));
973 double fExcel = rDocRes.GetValue(ScAddress(3,i,8));
974 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
977 for (SCROW i = 1; i <= 9; ++i)
979 double fLibre = rDoc.GetValue(ScAddress(3,i,9));
980 double fExcel = rDocRes.GetValue(ScAddress(3,i,9));
981 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
984 for (SCROW i = 1; i <= 10; ++i)
986 double fLibre = rDoc.GetValue(ScAddress(2,i,10));
987 double fExcel = rDocRes.GetValue(ScAddress(2,i,10));
988 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
991 for (SCROW i = 1; i <= 10; ++i)
993 double fLibre = rDoc.GetValue(ScAddress(7,i,11));
994 double fExcel = rDocRes.GetValue(ScAddress(7,i,11));
995 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
998 for (SCROW i = 1; i <= 10; ++i)
1000 double fLibre = rDoc.GetValue(ScAddress(5,i,12));
1001 double fExcel = rDocRes.GetValue(ScAddress(5,i,12));
1002 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1005 for (SCROW i = 0; i <= 12; ++i)
1007 double fLibre = rDoc.GetValue(ScAddress(6,i,13));
1008 double fExcel = rDocRes.GetValue(ScAddress(6,i,13));
1009 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1012 for (SCROW i = 1; i <= 10; ++i)
1014 double fLibre = rDoc.GetValue(ScAddress(3,i,14));
1015 double fExcel = rDocRes.GetValue(ScAddress(3,i,14));
1016 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1019 for (SCROW i = 1; i <= 10; ++i)
1021 double fLibre = rDoc.GetValue(ScAddress(6,i,15));
1022 double fExcel = rDocRes.GetValue(ScAddress(6,i,15));
1023 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1026 for (SCROW i = 1; i <= 10; ++i)
1028 double fLibre = rDoc.GetValue(ScAddress(6,i,16));
1029 double fExcel = rDocRes.GetValue(ScAddress(6,i,16));
1030 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1033 for (SCROW i = 1; i <= 5; ++i)
1035 double fLibre = rDoc.GetValue(ScAddress(6,i,17));
1036 double fExcel = rDocRes.GetValue(ScAddress(6,i,17));
1037 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1040 for (SCROW i = 0; i <= 10; ++i)
1042 double fLibre = rDoc.GetValue(ScAddress(3,i,18));
1043 double fExcel = rDocRes.GetValue(ScAddress(3,i,18));
1044 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1047 for (SCROW i = 0; i <= 18; ++i)
1049 double fLibre = rDoc.GetValue(ScAddress(3,i,19));
1050 double fExcel = rDocRes.GetValue(ScAddress(3,i,19));
1051 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1055 void ScOpenCLTest::testStatisticalFormulaCorrel()
1057 if(!initTestEnv("opencl/statistical/Correl.", FORMAT_ODS, false))
1058 return;
1059 ScDocument& rDoc = xDocSh->GetDocument();
1060 ScDocument& rDocRes = xDocShRes->GetDocument();
1061 rDoc.CalcAll();
1063 // Check the results of formula cells in the shared formula range.
1064 for (SCROW i = 1; i <= 20; ++i)
1066 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1067 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1068 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1071 void ScOpenCLTest::testStatisticalFormulaFisher()
1073 if(!initTestEnv("opencl/statistical/Fisher.", FORMAT_XLS, false))
1074 return;
1075 ScDocument& rDoc = xDocSh->GetDocument();
1076 ScDocument& rDocRes = xDocShRes->GetDocument();
1077 rDoc.CalcAll();
1079 // Check the results of formula cells in the shared formula range.
1080 for (SCROW i = 1; i <= 19; ++i)
1082 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1083 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1084 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1088 void ScOpenCLTest::testStatisticalFormulaFisherInv()
1090 if(!initTestEnv("opencl/statistical/FisherInv.", FORMAT_XLS, false))
1091 return;
1092 ScDocument& rDoc = xDocSh->GetDocument();
1093 ScDocument& rDocRes = xDocShRes->GetDocument();
1094 rDoc.CalcAll();
1096 // Check the results of formula cells in the shared formula range.
1097 for (SCROW i = 1; i <= 19; ++i)
1099 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1100 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1101 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1105 void ScOpenCLTest::testStatisticalFormulaGamma()
1107 if(!initTestEnv("opencl/statistical/Gamma.", FORMAT_XLS, false))
1108 return;
1109 ScDocument& rDoc = xDocSh->GetDocument();
1110 ScDocument& rDocRes = xDocShRes->GetDocument();
1111 rDoc.CalcAll();
1113 // Check the results of formula cells in the shared formula range.
1114 for (SCROW i = 1; i <= 19; ++i)
1116 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1117 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1118 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1122 void ScOpenCLTest::testFinacialFvscheduleFormula()
1124 if(!initTestEnv("opencl/financial/Fvschedule.", FORMAT_XLS, false))
1125 return;
1126 ScDocument& rDoc = xDocSh->GetDocument();
1127 ScDocument& rDocRes = xDocShRes->GetDocument();
1128 rDoc.CalcAll();
1130 for (SCROW i = 0; i <= 9; ++i)
1132 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
1133 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
1134 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1138 void ScOpenCLTest::testMathFormulaAbs()
1140 if(!initTestEnv("opencl/math/Abs.", FORMAT_ODS, false))
1141 return;
1142 ScDocument& rDoc = xDocSh->GetDocument();
1143 ScDocument& rDocRes = xDocShRes->GetDocument();
1144 rDoc.CalcAll();
1146 // Verify ABS Function
1147 for (SCROW i = 1; i <= 1000; ++i)
1149 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1150 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1151 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1155 void ScOpenCLTest::testFinacialSYDFormula()
1157 if(!initTestEnv("opencl/financial/SYD.", FORMAT_XLS, false))
1158 return;
1159 ScDocument& rDoc = xDocSh->GetDocument();
1160 ScDocument& rDocRes = xDocShRes->GetDocument();
1161 rDoc.CalcAll();
1163 for (SCROW i = 0; i <= 9; ++i)
1165 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1166 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1167 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1171 // this test has intermittent failures on OSX
1172 #if !defined MACOSX
1173 void ScOpenCLTest::testFinacialIRRFormula()
1175 if(!initTestEnv("opencl/financial/IRR.", FORMAT_XLS, false))
1176 return;
1177 ScDocument& rDoc = xDocSh->GetDocument();
1178 ScDocument& rDocRes = xDocShRes->GetDocument();
1179 rDoc.CalcAll();
1181 for (SCROW i = 0; i <= 6; ++i)
1183 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
1184 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
1185 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1188 #endif
1190 void ScOpenCLTest::testStatisticalFormulaGammaLn()
1192 if(!initTestEnv("opencl/statistical/GammaLn.", FORMAT_XLS, false))
1193 return;
1194 ScDocument& rDoc = xDocSh->GetDocument();
1195 ScDocument& rDocRes = xDocShRes->GetDocument();
1196 rDoc.CalcAll();
1198 // Check the results of formula cells in the shared formula range.
1199 for (SCROW i = 1; i <= 19; ++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::testStatisticalFormulaGauss()
1209 if(!initTestEnv("opencl/statistical/Gauss.", FORMAT_XLS, false))
1210 return;
1211 ScDocument& rDoc = xDocSh->GetDocument();
1212 ScDocument& rDocRes = xDocShRes->GetDocument();
1213 rDoc.CalcAll();
1215 // Check the results of formula cells in the shared formula range.
1216 for (SCROW i = 1; i <= 19; ++i)
1218 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1219 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1220 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1224 void ScOpenCLTest::testStatisticalFormulaGeoMean()
1226 if(!initTestEnv("opencl/statistical/GeoMean.", FORMAT_XLS, false))
1227 return;
1228 ScDocument& rDoc = xDocSh->GetDocument();
1229 ScDocument& rDocRes = xDocShRes->GetDocument();
1230 rDoc.CalcAll();
1232 // Check the results of formula cells in the shared formula range.
1233 for (SCROW i = 1; i <= 19; ++i)
1235 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1236 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1237 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1241 void ScOpenCLTest::testStatisticalFormulaHarMean()
1243 if(!initTestEnv("opencl/statistical/HarMean.", FORMAT_XLS, false))
1244 return;
1245 ScDocument& rDoc = xDocSh->GetDocument();
1246 ScDocument& rDocRes = xDocShRes->GetDocument();
1247 rDoc.CalcAll();
1249 // Check the results of formula cells in the shared formula range.
1250 for (SCROW i = 1; i <= 19; ++i)
1252 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1253 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1254 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1258 void ScOpenCLTest::testFinacialSLNFormula()
1260 if(!initTestEnv("opencl/financial/SLN.", FORMAT_XLS, false))
1261 return;
1262 ScDocument& rDoc = xDocSh->GetDocument();
1263 ScDocument& rDocRes = xDocShRes->GetDocument();
1264 rDoc.CalcAll();
1266 for (SCROW i = 0; i <= 9; ++i)
1268 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1269 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1270 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1274 void ScOpenCLTest::testFinacialMIRRFormula()
1276 if(!initTestEnv("opencl/financial/MIRR.", FORMAT_XLS, false))
1277 return;
1278 ScDocument& rDoc = xDocSh->GetDocument();
1279 ScDocument& rDocRes = xDocShRes->GetDocument();
1280 rDoc.CalcAll();
1282 for (SCROW i = 0; i <= 6; ++i)
1284 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1285 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1286 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1290 void ScOpenCLTest::testFinancialCoupdaybsFormula()
1292 if(!initTestEnv("opencl/financial/Coupdaybs.", FORMAT_XLS, false))
1293 return;
1294 ScDocument& rDoc = xDocSh->GetDocument();
1295 ScDocument& rDocRes = xDocShRes->GetDocument();
1296 rDoc.CalcAll();
1298 for (SCROW i = 1; i <=10; ++i)
1300 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1301 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1302 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1306 void ScOpenCLTest::testFinacialDollardeFormula()
1308 if(!initTestEnv("opencl/financial/Dollarde.", FORMAT_XLS, false))
1309 return;
1310 ScDocument& rDoc = xDocSh->GetDocument();
1311 ScDocument& rDocRes = xDocShRes->GetDocument();
1312 rDoc.CalcAll();
1314 for (SCROW i = 0; i <= 9; ++i)
1316 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
1317 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
1318 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1322 void ScOpenCLTest::testFinancialCoupdaysFormula()
1324 if(!initTestEnv("opencl/financial/Coupdays.", FORMAT_XLS, false))
1325 return;
1326 ScDocument& rDoc = xDocSh->GetDocument();
1327 ScDocument& rDocRes = xDocShRes->GetDocument();
1328 rDoc.CalcAll();
1330 for (SCROW i = 1; i <=10; ++i)
1332 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1333 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1334 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1339 void ScOpenCLTest::testFinancialCoupdaysncFormula()
1341 if(!initTestEnv("opencl/financial/Coupdaysnc.", FORMAT_XLS, false))
1342 return;
1343 ScDocument& rDoc = xDocSh->GetDocument();
1344 ScDocument& rDocRes = xDocShRes->GetDocument();
1345 rDoc.CalcAll();
1347 for (SCROW i = 1; i <=10; ++i)
1349 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1350 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1351 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1354 void ScOpenCLTest::testFinacialRateFormula()
1356 if(!initTestEnv("opencl/financial/RATE.", FORMAT_XLS, false))
1357 return;
1358 ScDocument& rDoc = xDocSh->GetDocument();
1359 ScDocument& rDocRes = xDocShRes->GetDocument();
1360 rDoc.CalcAll();
1362 for (SCROW i = 1; i <= 5; ++i)
1364 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
1365 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
1366 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1370 void ScOpenCLTest::testFinancialAccrintmFormula()
1372 if(!initTestEnv("opencl/financial/Accrintm.", FORMAT_XLS, false))
1373 return;
1374 ScDocument& rDoc = xDocSh->GetDocument();
1375 ScDocument& rDocRes = xDocShRes->GetDocument();
1376 rDoc.CalcAll();
1378 for (SCROW i = 1; i <= 10; ++i)
1380 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1381 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1382 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1386 void ScOpenCLTest::testFinancialCoupnumFormula()
1388 if(!initTestEnv("opencl/financial/Coupnum.", FORMAT_XLS, false))
1389 return;
1390 ScDocument& rDoc = xDocSh->GetDocument();
1391 ScDocument& rDocRes = xDocShRes->GetDocument();
1392 rDoc.CalcAll();
1394 for (SCROW i = 0; i <= 9; ++i)
1396 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1397 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1398 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1402 void ScOpenCLTest::testStatisticalFormulaNegbinomdist()
1404 if(!initTestEnv("opencl/statistical/Negbinomdist.", FORMAT_XLS, false))
1405 return;
1406 ScDocument& rDoc = xDocSh->GetDocument();
1407 ScDocument& rDocRes = xDocShRes->GetDocument();
1408 rDoc.CalcAll();
1410 // Check the results of formula cells in the shared formula range.
1411 for (SCROW i = 0; i <= 9; ++i)
1413 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
1414 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
1415 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1419 void ScOpenCLTest::testMathFormulaSin()
1421 if(!initTestEnv("opencl/math/sin.", FORMAT_XLS, false))
1422 return;
1423 ScDocument& rDoc = xDocSh->GetDocument();
1424 ScDocument& rDocRes = xDocShRes->GetDocument();
1425 rDoc.CalcAll();
1427 for (SCROW i = 0; i <= 15; ++i)
1429 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1430 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1431 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1435 void ScOpenCLTest::testMathFormulaSumSQ()
1437 if(!initTestEnv("opencl/math/sumsq.", FORMAT_XLS, false))
1438 return;
1439 ScDocument& rDoc = xDocSh->GetDocument();
1440 ScDocument& rDocRes = xDocShRes->GetDocument();
1441 rDoc.CalcAll();
1443 for (SCROW i = 0; i < 20; ++i)
1445 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
1446 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
1447 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1451 void ScOpenCLTest::testMathFormulaTan()
1453 if(!initTestEnv("opencl/math/tan.", FORMAT_XLS, false))
1454 return;
1455 ScDocument& rDoc = xDocSh->GetDocument();
1456 ScDocument& rDocRes = xDocShRes->GetDocument();
1457 rDoc.CalcAll();
1459 for (SCROW i = 0; i <= 15; ++i)
1461 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1462 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1463 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1467 void ScOpenCLTest::testMathFormulaTanH()
1469 if(!initTestEnv("opencl/math/tanh.", FORMAT_XLS, false))
1470 return;
1471 ScDocument& rDoc = xDocSh->GetDocument();
1472 ScDocument& rDocRes = xDocShRes->GetDocument();
1473 rDoc.CalcAll();
1475 for (SCROW i = 0; i <= 15; ++i)
1477 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1478 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1479 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1483 void ScOpenCLTest::testMathFormulaSqrt()
1485 if(!initTestEnv("opencl/math/sqrt.", FORMAT_XLS, false))
1486 return;
1487 ScDocument& rDoc = xDocSh->GetDocument();
1488 ScDocument& rDocRes = xDocShRes->GetDocument();
1489 rDoc.CalcAll();
1491 for (SCROW i = 0; i <= 15; ++i)
1493 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1494 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1495 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1499 void ScOpenCLTest::testFinacialPriceFormula()
1501 if(!initTestEnv("opencl/financial/Price.", FORMAT_XLS, false))
1502 return;
1503 ScDocument& rDoc = xDocSh->GetDocument();
1504 ScDocument& rDocRes = xDocShRes->GetDocument();
1505 rDoc.CalcAll();
1507 for (SCROW i = 1; i <= 10; ++i)
1509 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
1510 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
1511 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1515 void ScOpenCLTest::testFinacialDollarfrFormula()
1517 if(!initTestEnv("opencl/financial/Dollarfr.", FORMAT_XLS, false))
1518 return;
1519 ScDocument& rDoc = xDocSh->GetDocument();
1520 ScDocument& rDocRes = xDocShRes->GetDocument();
1521 rDoc.CalcAll();
1523 for (SCROW i = 0; i <= 9; ++i)
1525 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
1526 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
1527 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1531 void ScOpenCLTest::testFinacialPriceDiscFormula()
1533 if(!initTestEnv("opencl/financial/PriceDisc.", FORMAT_XLS, false))
1534 return;
1535 ScDocument& rDoc = xDocSh->GetDocument();
1536 ScDocument& rDocRes = xDocShRes->GetDocument();
1537 rDoc.CalcAll();
1539 for (SCROW i = 0; i <= 10; ++i)
1541 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1542 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1543 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1547 void ScOpenCLTest::testFinacialODDLPRICEFormula()
1549 if(!initTestEnv("opencl/financial/Oddlprice.", FORMAT_XLS, false))
1550 return;
1551 ScDocument& rDoc = xDocSh->GetDocument();
1552 ScDocument& rDocRes = xDocShRes->GetDocument();
1553 rDoc.CalcAll();
1555 for (SCROW i = 1; i <= 10; ++i)
1557 double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
1558 double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
1559 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1563 void ScOpenCLTest:: testFinacialOddlyieldFormula()
1565 if(!initTestEnv("opencl/financial/Oddlyield.", FORMAT_XLS, false))
1566 return;
1567 ScDocument& rDoc = xDocSh->GetDocument();
1568 ScDocument& rDocRes = xDocShRes->GetDocument();
1569 rDoc.CalcAll();
1571 for (SCROW i = 0; i <= 6; ++i)
1573 double fLibre = rDoc.GetValue(ScAddress(8, i, 0));
1574 double fExcel = rDocRes.GetValue(ScAddress(8, i, 0));
1575 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1579 void ScOpenCLTest::testFinacialDISCFormula()
1581 if(!initTestEnv("opencl/financial/DISC.", FORMAT_XLS, false))
1582 return;
1583 ScDocument& rDoc = xDocSh->GetDocument();
1584 ScDocument& rDocRes = xDocShRes->GetDocument();
1585 rDoc.CalcAll();
1587 for (SCROW i = 0; i <= 9; ++i)
1589 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1590 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1591 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1595 void ScOpenCLTest:: testFinacialPVFormula()
1597 if(!initTestEnv("opencl/financial/PV.", FORMAT_XLS, false))
1598 return;
1599 ScDocument& rDoc = xDocSh->GetDocument();
1600 ScDocument& rDocRes = xDocShRes->GetDocument();
1601 rDoc.CalcAll();
1603 for (SCROW i = 0; i <= 9; ++i)
1605 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1606 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1607 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1611 void ScOpenCLTest::testFinacialINTRATEFormula()
1613 if(!initTestEnv("opencl/financial/INTRATE.", FORMAT_XLS, false))
1614 return;
1615 ScDocument& rDoc = xDocSh->GetDocument();
1616 ScDocument& rDocRes = xDocShRes->GetDocument();
1617 rDoc.CalcAll();
1619 for (SCROW i = 0; i <= 9; ++i)
1621 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
1622 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
1623 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1627 void ScOpenCLTest::testStatisticalFormulaStandard()
1629 if(!initTestEnv("opencl/statistical/Standard.", FORMAT_XLS, false))
1630 return;
1631 ScDocument& rDoc = xDocSh->GetDocument();
1632 ScDocument& rDocRes = xDocShRes->GetDocument();
1633 rDoc.CalcAll();
1635 // Check the results of formula cells in the shared formula range.
1636 for (SCROW i = 1; i <= 20; ++i)
1638 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
1639 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
1640 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1644 void ScOpenCLTest::testStatisticalFormulaWeibull()
1646 if(!initTestEnv("opencl/statistical/Weibull.", FORMAT_XLS, false))
1647 return;
1648 ScDocument& rDoc = xDocSh->GetDocument();
1649 ScDocument& rDocRes = xDocShRes->GetDocument();
1650 rDoc.CalcAll();
1652 // Check the results of formula cells in the shared formula range.
1653 for (SCROW i = 1; i <= 20; ++i)
1655 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
1656 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
1657 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
1658 fExcel == 0?1e-4:fabs(1e-4*fExcel));
1662 void ScOpenCLTest::testStatisticalFormulaVar()
1664 if(!initTestEnv("opencl/statistical/Var.", FORMAT_XLS, false))
1665 return;
1666 ScDocument& rDoc = xDocSh->GetDocument();
1667 ScDocument& rDocRes = xDocShRes->GetDocument();
1668 rDoc.CalcAll();
1670 // Check the results of formula cells in the shared formula range.
1671 for (SCROW i = 1; i <= 20; ++i)
1673 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1674 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1675 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1679 void ScOpenCLTest::testStatisticalFormulaSkew()
1681 if(!initTestEnv("opencl/statistical/Skew.", FORMAT_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(1,i,0));
1691 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1692 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1696 void ScOpenCLTest::testStatisticalFormulaSkewp()
1698 if(!initTestEnv("opencl/statistical/Skewp.", FORMAT_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(1,i,0));
1708 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1709 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1713 void ScOpenCLTest::testStatisticalFormulaPearson()
1715 if(!initTestEnv("opencl/statistical/Pearson.", FORMAT_XLS, false))
1716 return;
1717 ScDocument& rDoc = xDocSh->GetDocument();
1718 ScDocument& rDocRes = xDocShRes->GetDocument();
1719 rDoc.CalcAll();
1721 // Check the results of formula cells in the shared formula range.
1722 for (SCROW i = 1; i <= 9; ++i)
1724 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1725 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1726 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1730 void ScOpenCLTest::testStatisticalFormulaRsq()
1732 if(!initTestEnv("opencl/statistical/Rsq.", FORMAT_XLS, false))
1733 return;
1734 ScDocument& rDoc = xDocSh->GetDocument();
1735 ScDocument& rDocRes = xDocShRes->GetDocument();
1736 rDoc.CalcAll();
1738 // Check the results of formula cells in the shared formula range.
1739 for (SCROW i = 1; i <= 9; ++i)
1741 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1742 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1743 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1747 void ScOpenCLTest::testMathFormulaTrunc()
1749 if(!initTestEnv("opencl/math/trunc.", FORMAT_XLS, false))
1750 return;
1751 ScDocument& rDoc = xDocSh->GetDocument();
1752 ScDocument& rDocRes = xDocShRes->GetDocument();
1753 rDoc.CalcAll();
1755 for (SCROW i = 0; i <= 15; ++i)
1757 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1758 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1759 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1763 void ScOpenCLTest::testMathFormulaCosh()
1765 if(!initTestEnv("opencl/math/cosh.", FORMAT_XLS, false))
1766 return;
1767 ScDocument& rDoc = xDocSh->GetDocument();
1768 ScDocument& rDocRes = xDocShRes->GetDocument();
1769 rDoc.CalcAll();
1771 for (SCROW i = 0; i <= 15; ++i)
1773 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1774 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1775 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1778 void ScOpenCLTest::testStatisticalFormulaCovar()
1780 if(!initTestEnv("opencl/statistical/Covar.", FORMAT_XLS, false))
1781 return;
1782 ScDocument& rDoc = xDocSh->GetDocument();
1783 ScDocument& rDocRes = xDocShRes->GetDocument();
1784 rDoc.CalcAll();
1786 // Check the results of formula cells in the shared formula range.
1787 for (SCROW i = 0; i <= 16; ++i)
1789 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1790 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1791 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1795 void ScOpenCLTest::testStatisticalFormulaKurt()
1797 if(!initTestEnv("opencl/statistical/Kurt.", FORMAT_XLS, false))
1798 return;
1799 ScDocument& rDoc = xDocSh->GetDocument();
1800 ScDocument& rDocRes = xDocShRes->GetDocument();
1801 rDoc.CalcAll();
1803 // Check the results of formula cells in the shared formula range.
1804 for (SCROW i = 1; i <= 19; ++i)
1806 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1807 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1808 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1812 void ScOpenCLTest::testMathFormulaCot()
1814 if(!initTestEnv("opencl/math/cot.", FORMAT_ODS, false))
1815 return;
1816 ScDocument& rDoc = xDocSh->GetDocument();
1817 ScDocument& rDocRes = xDocShRes->GetDocument();
1818 rDoc.CalcAll();
1820 for (SCROW i = 0; i <= 15; ++i)
1822 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1823 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1824 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1828 void ScOpenCLTest::testStatisticalFormulaDevSq()
1830 if(!initTestEnv("opencl/statistical/DevSq.", FORMAT_XLS, false))
1831 return;
1832 ScDocument& rDoc = xDocSh->GetDocument();
1833 ScDocument& rDocRes = xDocShRes->GetDocument();
1834 rDoc.CalcAll();
1836 // Check the results of formula cells in the shared formula range.
1837 for (SCROW i = 0; i <= 11; ++i)
1839 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1840 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1841 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1845 void ScOpenCLTest::testMathFormulaCsc()
1847 if(!initTestEnv("opencl/math/csc.", FORMAT_ODS, false))
1848 return;
1849 ScDocument& rDoc = xDocSh->GetDocument();
1850 ScDocument& rDocRes = xDocShRes->GetDocument();
1851 rDoc.CalcAll();
1853 for (SCROW i = 0; i <= 15; ++i)
1855 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1856 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1857 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1861 void ScOpenCLTest::testMathFormulaCoth()
1863 if(!initTestEnv("opencl/math/coth.", FORMAT_ODS, false))
1864 return;
1865 ScDocument& rDoc = xDocSh->GetDocument();
1866 ScDocument& rDocRes = xDocShRes->GetDocument();
1867 rDoc.CalcAll();
1869 for (SCROW i = 0; i <= 15; ++i)
1871 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1872 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1873 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1877 void ScOpenCLTest::testFinacialXNPVFormula()
1879 if(!initTestEnv("opencl/financial/XNPV.", FORMAT_XLS, false))
1880 return;
1881 ScDocument& rDoc = xDocSh->GetDocument();
1882 ScDocument& rDocRes = xDocShRes->GetDocument();
1883 rDoc.CalcAll();
1885 for (SCROW i = 1; i <= 9; ++i)
1887 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1888 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1889 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1892 for (SCROW i = 16; i <= 26; ++i)
1894 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
1895 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
1896 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1900 void ScOpenCLTest::testStatisticalFormulaIntercept()
1902 if(!initTestEnv("opencl/statistical/Intercept.", FORMAT_XLS, false))
1903 return;
1904 ScDocument& rDoc = xDocSh->GetDocument();
1905 ScDocument& rDocRes = xDocShRes->GetDocument();
1906 rDoc.CalcAll();
1908 for (SCROW i = 1; i <= 19; ++i)
1910 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
1911 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
1912 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1916 void ScOpenCLTest::testFinancialAmordegrcFormula()
1918 if(!initTestEnv("opencl/financial/Amordegrc.", FORMAT_XLS, false))
1919 return;
1920 ScDocument& rDoc = xDocSh->GetDocument();
1921 ScDocument& rDocRes = xDocShRes->GetDocument();
1922 rDoc.CalcAll();
1924 for (SCROW i = 0; i <= 9; ++i)
1926 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
1927 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
1928 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1932 void ScOpenCLTest:: testFinancialISPMTFormula()
1934 if(!initTestEnv("opencl/financial/ISPMT.", FORMAT_XLS, false))
1935 return;
1936 ScDocument& rDoc = xDocSh->GetDocument();
1937 ScDocument& rDocRes = xDocShRes->GetDocument();
1938 rDoc.CalcAll();
1940 for (SCROW i = 0; i <= 9; ++i)
1942 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
1943 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
1944 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1948 void ScOpenCLTest::testStatisticalFormulaMedian()
1950 if(!initTestEnv("opencl/statistical/Median.", FORMAT_XLS, false))
1951 return;
1952 ScDocument& rDoc = xDocSh->GetDocument();
1953 ScDocument& rDocRes = xDocShRes->GetDocument();
1954 rDoc.CalcAll();
1956 // Check the results of formula cells in the shared formula range.
1957 for (SCROW i = 1; i <= 9; ++i)
1959 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1960 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1961 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1965 void ScOpenCLTest::testStatisticalFormulaNormdist()
1967 if(!initTestEnv("opencl/statistical/Normdist.", FORMAT_XLS, false))
1968 return;
1969 ScDocument& rDoc = xDocSh->GetDocument();
1970 ScDocument& rDocRes = xDocShRes->GetDocument();
1971 rDoc.CalcAll();
1973 // Check the results of formula cells in the shared formula range.
1974 for (SCROW i = 1; i <= 19; ++i)
1976 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
1977 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
1978 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1982 void ScOpenCLTest::testStatisticalFormulaNormsdist()
1984 if(!initTestEnv("opencl/statistical/Normsdist.", FORMAT_XLS, false))
1985 return;
1986 ScDocument& rDoc = xDocSh->GetDocument();
1987 ScDocument& rDocRes = xDocShRes->GetDocument();
1988 rDoc.CalcAll();
1990 // Check the results of formula cells in the shared formula range.
1991 for (SCROW i = 1; i <= 19; ++i)
1993 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
1994 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
1995 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1999 void ScOpenCLTest::testStatisticalFormulaPermut()
2001 if(!initTestEnv("opencl/statistical/Permut.", FORMAT_XLS, false))
2002 return;
2003 ScDocument& rDoc = xDocSh->GetDocument();
2004 ScDocument& rDocRes = xDocShRes->GetDocument();
2005 rDoc.CalcAll();
2007 // Check the results of formula cells in the shared formula range.
2008 for (SCROW i = 1; i <= 19; ++i)
2010 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2011 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2012 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2016 void ScOpenCLTest::testStatisticalFormulaPermutation()
2018 if(!initTestEnv("opencl/statistical/Permutation.", FORMAT_XLS, false))
2019 return;
2020 ScDocument& rDoc = xDocSh->GetDocument();
2021 ScDocument& rDocRes = xDocShRes->GetDocument();
2022 rDoc.CalcAll();
2024 // Check the results of formula cells in the shared formula range.
2025 for (SCROW i = 1; i <= 9; ++i)
2027 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2028 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2029 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2033 void ScOpenCLTest::testStatisticalFormulaPhi()
2035 if(!initTestEnv("opencl/statistical/Phi.", FORMAT_XLS, false))
2036 return;
2037 ScDocument& rDoc = xDocSh->GetDocument();
2038 ScDocument& rDocRes = xDocShRes->GetDocument();
2039 rDoc.CalcAll();
2041 // Check the results of formula cells in the shared formula range.
2042 for (SCROW i = 1; i <= 19; ++i)
2044 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2045 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2046 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2050 void ScOpenCLTest::testMathFormulaCscH()
2052 if(!initTestEnv("opencl/math/csch.", FORMAT_ODS, false))
2053 return;
2054 ScDocument& rDoc = xDocSh->GetDocument();
2055 ScDocument& rDocRes = xDocShRes->GetDocument();
2056 rDoc.CalcAll();
2058 for (SCROW i = 0; i <= 15; ++i)
2060 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2061 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2062 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2066 void ScOpenCLTest::testStatisticalFormulaLogInv()
2068 if(!initTestEnv("opencl/statistical/LogInv.", FORMAT_XLS, false))
2069 return;
2070 ScDocument& rDoc = xDocSh->GetDocument();
2071 ScDocument& rDocRes = xDocShRes->GetDocument();
2072 rDoc.CalcAll();
2074 // Check the results of formula cells in the shared formula range.
2075 for (SCROW i = 1; i <= 19; ++i)
2077 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2078 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2079 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2083 void ScOpenCLTest::testFinacialNPERFormula()
2085 if(!initTestEnv("opencl/financial/NPER.", FORMAT_XLS, false))
2086 return;
2087 ScDocument& rDoc = xDocSh->GetDocument();
2088 ScDocument& rDocRes = xDocShRes->GetDocument();
2089 rDoc.CalcAll();
2091 for (SCROW i = 0; i <= 10; ++i)
2093 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2094 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2095 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2099 void ScOpenCLTest::testStatisticalFormulaForecast()
2101 if(!initTestEnv("opencl/statistical/Forecast.", FORMAT_XLS, false))
2102 return;
2103 ScDocument& rDoc = xDocSh->GetDocument();
2104 ScDocument& rDocRes = xDocShRes->GetDocument();
2105 rDoc.CalcAll();
2107 // Check the results of formula cells in the shared formula range.
2108 for (SCROW i = 1; i <= 19; ++i)
2110 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2111 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2112 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2116 void ScOpenCLTest::testFinancialAmorlincFormula()
2118 if(!initTestEnv("opencl/financial/Amorlinc.", FORMAT_XLS, false))
2119 return;
2120 ScDocument& rDoc = xDocSh->GetDocument();
2121 ScDocument& rDocRes = xDocShRes->GetDocument();
2122 rDoc.CalcAll();
2124 for (SCROW i = 0; i <= 9; ++i)
2126 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
2127 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
2128 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2132 void ScOpenCLTest::testFinancialDDBFormula()
2134 if(!initTestEnv("opencl/financial/ddb.", FORMAT_XLS, false))
2135 return;
2136 ScDocument& rDoc = xDocSh->GetDocument();
2137 ScDocument& rDocRes = xDocShRes->GetDocument();
2138 rDoc.CalcAll();
2140 for (SCROW i = 0; i <= 9; ++i)
2142 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2143 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2144 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2147 void ScOpenCLTest::testFinacialPriceMatFormula()
2149 if(!initTestEnv("opencl/financial/PriceMat.", FORMAT_XLS, false))
2150 return;
2151 ScDocument& rDoc = xDocSh->GetDocument();
2152 ScDocument& rDocRes = xDocShRes->GetDocument();
2153 rDoc.CalcAll();
2155 for (SCROW i = 0; i <= 9; ++i)
2157 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2158 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2159 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2162 void ScOpenCLTest::testFinacialFormulaReceived()
2164 if(!initTestEnv("opencl/financial/Received.", FORMAT_XLS, false))
2165 return;
2166 ScDocument& rDoc = xDocSh->GetDocument();
2167 ScDocument& rDocRes = xDocShRes->GetDocument();
2168 rDoc.CalcAll();
2170 // Check the results of formula cells in the shared formula range.
2171 for (SCROW i = 0; i < 10; ++i)
2173 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
2174 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
2175 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2178 void ScOpenCLTest::testFinancialFormulaCumipmt()
2180 if(!initTestEnv("opencl/financial/Cumipmt.", FORMAT_XLS, false))
2181 return;
2182 ScDocument& rDoc = xDocSh->GetDocument();
2183 ScDocument& rDocRes = xDocShRes->GetDocument();
2184 rDoc.CalcAll();
2186 // Check the results of formula cells in the shared formula range.
2187 for (SCROW i = 1; i <= 10; ++i)
2189 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
2190 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
2191 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2194 void ScOpenCLTest::testFinancialFormulaCumprinc()
2196 if(!initTestEnv("opencl/financial/Cumprinc.", FORMAT_XLS, false))
2197 return;
2198 ScDocument& rDoc = xDocSh->GetDocument();
2199 ScDocument& rDocRes = xDocShRes->GetDocument();
2200 rDoc.CalcAll();
2202 // Check the results of formula cells in the shared formula range.
2203 for (SCROW i = 1; i <= 10; ++i)
2205 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
2206 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
2207 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2210 void ScOpenCLTest::testFinacialRRIFormula()
2212 if(!initTestEnv("opencl/financial/RRI.", FORMAT_XLS, false))
2213 return;
2214 ScDocument& rDoc = xDocSh->GetDocument();
2215 ScDocument& rDocRes = xDocShRes->GetDocument();
2216 rDoc.CalcAll();
2218 for (SCROW i = 0; i <= 9; ++i)
2220 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2221 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2222 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2225 void ScOpenCLTest::testFinacialEFFECT_ADDFormula()
2227 if(!initTestEnv("opencl/financial/EFFECT_ADD.", FORMAT_XLS, false))
2228 return;
2229 ScDocument& rDoc = xDocSh->GetDocument();
2230 ScDocument& rDocRes = xDocShRes->GetDocument();
2231 rDoc.CalcAll();
2233 for (SCROW i = 0; i <= 9; ++i)
2235 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
2236 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
2237 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2240 void ScOpenCLTest::testFinacialNominalFormula()
2242 if(!initTestEnv("opencl/financial/Nominal.", FORMAT_XLS, false))
2243 return;
2244 ScDocument& rDoc = xDocSh->GetDocument();
2245 ScDocument& rDocRes = xDocShRes->GetDocument();
2246 rDoc.CalcAll();
2249 // Check the results of formula cells in the shared formula range.
2250 for (SCROW i = 1; i <= 19; ++i)
2252 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2253 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2254 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2257 void ScOpenCLTest::testFinacialTBILLEQFormula()
2259 if(!initTestEnv("opencl/financial/TBILLEQ.", FORMAT_XLS, false))
2260 return;
2261 ScDocument& rDoc = xDocSh->GetDocument();
2262 ScDocument& rDocRes = xDocShRes->GetDocument();
2263 rDoc.CalcAll();
2265 for (SCROW i = 0; i <= 6; ++i)
2267 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2268 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2269 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2272 void ScOpenCLTest::testFinacialTBILLPRICEFormula()
2274 if(!initTestEnv("opencl/financial/TBILLPRICE.", FORMAT_XLS, false))
2275 return;
2276 ScDocument& rDoc = xDocSh->GetDocument();
2277 ScDocument& rDocRes = xDocShRes->GetDocument();
2278 rDoc.CalcAll();
2280 for (SCROW i = 0; i <= 6; ++i)
2282 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2283 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2284 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2287 void ScOpenCLTest::testFinacialTBILLYIELDFormula()
2289 if(!initTestEnv("opencl/financial/TBILLYIELD.", FORMAT_XLS, false))
2290 return;
2291 ScDocument& rDoc = xDocSh->GetDocument();
2292 ScDocument& rDocRes = xDocShRes->GetDocument();
2293 rDoc.CalcAll();
2295 for (SCROW i = 0; i <= 6; ++i)
2297 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2298 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2299 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2302 void ScOpenCLTest::testFinacialYIELDFormula()
2304 if(!initTestEnv("opencl/financial/YIELD.", FORMAT_XLS, false))
2305 return;
2306 ScDocument& rDoc = xDocSh->GetDocument();
2307 ScDocument& rDocRes = xDocShRes->GetDocument();
2308 rDoc.CalcAll();
2310 for (SCROW i = 0; i <= 6; ++i)
2312 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
2313 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
2314 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2318 void ScOpenCLTest::testFinacialYIELDDISCFormula()
2320 if(!initTestEnv("opencl/financial/YIELDDISC.", FORMAT_XLS, false))
2321 return;
2322 ScDocument& rDoc = xDocSh->GetDocument();
2323 ScDocument& rDocRes = xDocShRes->GetDocument();
2324 rDoc.CalcAll();
2326 for (SCROW i = 0; i <= 6; ++i)
2328 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2329 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2330 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2334 void ScOpenCLTest::testFinacialYIELDMATFormula()
2336 if(!initTestEnv("opencl/financial/YIELDMAT.", FORMAT_XLS, false))
2337 return;
2338 ScDocument& rDoc = xDocSh->GetDocument();
2339 ScDocument& rDocRes = xDocShRes->GetDocument();
2340 rDoc.CalcAll();
2342 for (SCROW i = 0; i <= 6; ++i)
2344 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2345 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2346 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2349 void ScOpenCLTest:: testFinacialPMTFormula()
2351 if(!initTestEnv("opencl/financial/PMT.", FORMAT_XLS, false))
2352 return;
2353 ScDocument& rDoc = xDocSh->GetDocument();
2354 ScDocument& rDocRes = xDocShRes->GetDocument();
2355 rDoc.CalcAll();
2357 for (SCROW i = 0; i <= 6; ++i)
2359 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2360 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2361 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2365 void ScOpenCLTest:: testFinancialDurationFormula()
2367 if(!initTestEnv("opencl/financial/Duration.", FORMAT_ODS, false))
2368 return;
2369 ScDocument& rDoc = xDocSh->GetDocument();
2370 ScDocument& rDocRes = xDocShRes->GetDocument();
2371 rDoc.CalcAll();
2373 for (SCROW i = 0; i <= 9; ++i)
2375 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
2376 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
2377 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2381 void ScOpenCLTest::testStatisticalFormulaLogNormDist()
2383 if(!initTestEnv("opencl/statistical/LogNormDist.", FORMAT_ODS, false))
2384 return;
2385 ScDocument& rDoc = xDocSh->GetDocument();
2386 ScDocument& rDocRes = xDocShRes->GetDocument();
2387 rDoc.CalcAll();
2389 // Check the results of formula cells in the shared formula range.
2390 for (SCROW i = 1; i <= 19; ++i)
2392 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
2393 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
2394 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2398 void ScOpenCLTest::testMathFormulaArcCos()
2400 if(!initTestEnv("opencl/math/ArcCos.", FORMAT_ODS, false))
2401 return;
2402 ScDocument& rDoc = xDocSh->GetDocument();
2403 ScDocument& rDocRes = xDocShRes->GetDocument();
2404 rDoc.CalcAll();
2406 // Verify ACos Function
2407 for (SCROW i = 1; i <= 1000; ++i)
2409 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2410 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2411 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2415 void ScOpenCLTest::testMathFormulaPower()
2417 if(!initTestEnv("opencl/math/power.", FORMAT_ODS, false))
2418 return;
2419 ScDocument& rDoc = xDocSh->GetDocument();
2420 ScDocument& rDocRes = xDocShRes->GetDocument();
2421 rDoc.CalcAll();
2423 for (SCROW i = 0; i <= 15; ++i)
2425 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2426 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2427 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2431 void ScOpenCLTest:: testFinacialPPMTFormula()
2433 if(!initTestEnv("opencl/financial/PPMT.", FORMAT_XLS, false))
2434 return;
2435 ScDocument& rDoc = xDocSh->GetDocument();
2436 ScDocument& rDocRes = xDocShRes->GetDocument();
2437 rDoc.CalcAll();
2439 for (SCROW i = 0; i <= 6; ++i)
2441 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2442 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2443 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2447 void ScOpenCLTest:: testFinacialNPVFormula()
2449 if(!initTestEnv("opencl/financial/NPV.", FORMAT_XLS, false))
2450 return;
2451 ScDocument& rDoc = xDocSh->GetDocument();
2452 ScDocument& rDocRes = xDocShRes->GetDocument();
2453 rDoc.CalcAll();
2455 for (SCROW i = 0; i <= 6; ++i)
2457 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2458 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2459 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2463 void ScOpenCLTest:: testFinancialDuration_ADDFormula()
2465 if(!initTestEnv("opencl/financial/Duration_ADD.", FORMAT_XLS, false))
2466 return;
2467 ScDocument& rDoc = xDocSh->GetDocument();
2468 ScDocument& rDocRes = xDocShRes->GetDocument();
2469 rDoc.CalcAll();
2471 for (SCROW i = 0; i <= 9; ++i)
2473 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2474 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2475 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2479 void ScOpenCLTest::testStatisticalFormulaNorminv()
2481 if(!initTestEnv("opencl/statistical/Norminv.", FORMAT_XLS, false))
2482 return;
2483 ScDocument& rDoc = xDocSh->GetDocument();
2484 ScDocument& rDocRes = xDocShRes->GetDocument();
2485 rDoc.CalcAll();
2487 // Check the results of formula cells in the shared formula range.
2488 for (SCROW i = 1; i <= 19; ++i)
2490 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2491 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2492 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2496 void ScOpenCLTest::testStatisticalFormulaNormsinv()
2498 if(!initTestEnv("opencl/statistical/Normsinv.", FORMAT_XLS, false))
2499 return;
2500 ScDocument& rDoc = xDocSh->GetDocument();
2501 ScDocument& rDocRes = xDocShRes->GetDocument();
2502 rDoc.CalcAll();
2504 // Check the results of formula cells in the shared formula range.
2505 for (SCROW i = 1; i <= 19; ++i)
2507 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2508 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2509 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2513 void ScOpenCLTest::testMathFormulaArcCosHyp()
2515 if(!initTestEnv("opencl/math/ArcCosHyp.", FORMAT_ODS, false))
2516 return;
2517 ScDocument& rDoc = xDocSh->GetDocument();
2518 ScDocument& rDocRes = xDocShRes->GetDocument();
2519 rDoc.CalcAll();
2521 // Verify ACosH Function
2522 for (SCROW i = 1; i <= 1000; ++i)
2524 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2525 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2526 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2530 void ScOpenCLTest:: testFinancialMDurationFormula()
2532 if(!initTestEnv("opencl/financial/MDuration.", FORMAT_XLS, false))
2533 return;
2534 ScDocument& rDoc = xDocSh->GetDocument();
2535 ScDocument& rDocRes = xDocShRes->GetDocument();
2536 rDoc.CalcAll();
2538 for (SCROW i = 0; i <= 9; ++i)
2540 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2541 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2542 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2546 void ScOpenCLTest::testMathFormulaArcCot()
2548 if(!initTestEnv("opencl/math/ArcCot.", FORMAT_ODS, false))
2549 return;
2550 ScDocument& rDoc = xDocSh->GetDocument();
2551 ScDocument& rDocRes = xDocShRes->GetDocument();
2552 rDoc.CalcAll();
2554 // Verify ACot Function
2555 for (SCROW i = 1; i <= 1000; ++i)
2557 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2558 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2559 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2563 void ScOpenCLTest:: testFinancialFVFormula()
2565 if(!initTestEnv("opencl/financial/FV.", FORMAT_XLS, false))
2566 return;
2567 ScDocument& rDoc = xDocSh->GetDocument();
2568 ScDocument& rDocRes = xDocShRes->GetDocument();
2569 rDoc.CalcAll();
2571 for (SCROW i = 0; i <= 9; ++i)
2573 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2574 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2575 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2579 void ScOpenCLTest::testFinancialDBFormula()
2581 if(!initTestEnv("opencl/financial/db.", FORMAT_XLS, false))
2582 return;
2583 ScDocument& rDoc = xDocSh->GetDocument();
2584 ScDocument& rDocRes = xDocShRes->GetDocument();
2585 rDoc.CalcAll();
2587 for (SCROW i = 0; i <= 9; ++i)
2589 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2590 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2591 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2595 void ScOpenCLTest::testFinancialCouppcdFormula()
2597 if(!initTestEnv("opencl/financial/Couppcd.", FORMAT_XLS, false))
2598 return;
2599 ScDocument& rDoc = xDocSh->GetDocument();
2600 ScDocument& rDocRes = xDocShRes->GetDocument();
2601 rDoc.CalcAll();
2603 for (SCROW i = 0; i <= 9; ++i)
2605 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
2606 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
2607 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2611 void ScOpenCLTest::testMathSumIfsFormula()
2613 if(!initTestEnv("opencl/math/sumifs.", FORMAT_XLS, false))
2614 return;
2615 ScDocument& rDoc = xDocSh->GetDocument();
2616 ScDocument& rDocRes = xDocShRes->GetDocument();
2617 xDocSh->DoHardRecalc();
2619 for (SCROW i = 2; i <= 11; ++i)
2621 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
2622 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
2623 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2625 for (SCROW i = 2; i <= 11; ++i)
2627 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
2628 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
2629 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2631 for (SCROW i = 2; i <= 11; ++i)
2633 double fLibre = rDoc.GetValue(ScAddress(7,i,0));
2634 double fExcel = rDocRes.GetValue(ScAddress(7,i,0));
2635 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2637 for (SCROW i = 2; i <= 11; ++i)
2639 double fLibre = rDoc.GetValue(ScAddress(8,i,0));
2640 double fExcel = rDocRes.GetValue(ScAddress(8,i,0));
2641 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2645 void ScOpenCLTest::testMathFormulaArcCotHyp()
2647 if(!initTestEnv("opencl/math/ArcCotHyp.", FORMAT_ODS, false))
2648 return;
2649 ScDocument& rDoc = xDocSh->GetDocument();
2650 ScDocument& rDocRes = xDocShRes->GetDocument();
2651 rDoc.CalcAll();
2653 // Verify ACotH Function
2654 for (SCROW i = 1; i <= 1000; ++i)
2656 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2657 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2658 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2662 void ScOpenCLTest::testMathFormulaArcSin()
2664 if(!initTestEnv("opencl/math/ArcSin.", FORMAT_ODS, false))
2665 return;
2666 ScDocument& rDoc = xDocSh->GetDocument();
2667 ScDocument& rDocRes = xDocShRes->GetDocument();
2668 rDoc.CalcAll();
2670 // Verify ACotH Function
2671 for (SCROW i = 1; i <= 1000; ++i)
2673 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2674 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2675 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2679 void ScOpenCLTest:: testFinancialVDBFormula()
2681 if(!initTestEnv("opencl/financial/VDB.", FORMAT_XLS, false))
2682 return;
2683 ScDocument& rDoc = xDocSh->GetDocument();
2684 ScDocument& rDocRes = xDocShRes->GetDocument();
2685 rDoc.CalcAll();
2687 for (SCROW i = 0; i <= 10; ++i)
2689 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
2690 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
2691 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2693 for (SCROW i = 15; i <= 26; ++i)
2695 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2696 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2697 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2699 for (SCROW i = 30; i <= 41; ++i)
2701 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2702 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2703 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2707 void ScOpenCLTest:: testFinancialIPMTFormula()
2709 if(!initTestEnv("opencl/financial/IPMT.", FORMAT_XLS, false))
2710 return;
2711 ScDocument& rDoc = xDocSh->GetDocument();
2712 ScDocument& rDocRes = xDocShRes->GetDocument();
2713 rDoc.CalcAll();
2715 for (SCROW i = 0; i <= 9; ++i)
2717 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
2718 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
2719 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2723 void ScOpenCLTest::testStatisticalFormulaChiSqDist()
2725 if(!initTestEnv("opencl/statistical/CHISQDIST.", FORMAT_ODS, false))
2726 return;
2727 ScDocument& rDoc = xDocSh->GetDocument();
2728 ScDocument& rDocRes = xDocShRes->GetDocument();
2729 rDoc.CalcAll();
2731 // Check the results of formula cells in the shared formula range.
2732 for (SCROW i = 1; i <= 9; ++i)
2734 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2735 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2736 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2738 for (SCROW i = 1; i <= 9; ++i)
2740 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2741 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2742 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2746 void ScOpenCLTest::testStatisticalFormulaConfidence()
2748 if(!initTestEnv("opencl/statistical/Confidence.", FORMAT_XLS, false))
2749 return;
2750 ScDocument& rDoc = xDocSh->GetDocument();
2751 ScDocument& rDocRes = xDocShRes->GetDocument();
2752 rDoc.CalcAll();
2754 // Check the results of formula cells in the shared formula range.
2755 for (SCROW i = 0; i <= 9; ++i)
2757 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2758 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2759 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2763 void ScOpenCLTest::testStatisticalFormulaFDist()
2765 if(!initTestEnv("opencl/statistical/Fdist.", FORMAT_XLS, false))
2766 return;
2767 ScDocument& rDoc = xDocSh->GetDocument();
2768 ScDocument& rDocRes = xDocShRes->GetDocument();
2769 rDoc.CalcAll();
2771 // Check the results of formula cells in the shared formula range.
2772 for (SCROW i = 0; i <= 9; ++i)
2774 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2775 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2776 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2780 void ScOpenCLTest::testFinancialCoupncdFormula()
2782 if(!initTestEnv("opencl/financial/Coupncd.", FORMAT_XLS, false))
2783 return;
2784 ScDocument& rDoc = xDocSh->GetDocument();
2785 ScDocument& rDocRes = xDocShRes->GetDocument();
2786 rDoc.CalcAll();
2788 for (SCROW i = 0; i <= 9; ++i)
2790 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
2791 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
2792 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2796 void ScOpenCLTest::testFinancialAccrintFormula()
2798 if(!initTestEnv("opencl/financial/Accrint.", FORMAT_XLS, false))
2799 return;
2800 ScDocument& rDoc = xDocSh->GetDocument();
2801 ScDocument& rDocRes = xDocShRes->GetDocument();
2802 rDoc.CalcAll();
2804 for (SCROW i = 0; i <= 9; ++i)
2806 double fLibre = rDoc.GetValue(ScAddress(7, i, 0));
2807 double fExcel = rDocRes.GetValue(ScAddress(7, i, 0));
2808 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2812 void ScOpenCLTest::testStatisticalFormulaCritBinom()
2814 if(!initTestEnv("opencl/statistical/CritBinom.", FORMAT_XLS, false))
2815 return;
2816 ScDocument& rDoc = xDocSh->GetDocument();
2817 ScDocument& rDocRes = xDocShRes->GetDocument();
2818 rDoc.CalcAll();
2820 // Check the results of formula cells in the shared formula range.
2821 for (SCROW i = 0; i <= 9; ++i)
2823 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2824 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2825 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2829 void ScOpenCLTest::testMathFormulaArcSinHyp()
2831 if(!initTestEnv("opencl/math/ArcSinHyp.", FORMAT_ODS, false))
2832 return;
2833 ScDocument& rDoc = xDocSh->GetDocument();
2834 ScDocument& rDocRes = xDocShRes->GetDocument();
2835 rDoc.CalcAll();
2837 // Verify ASinH Function
2838 for (SCROW i = 1; i <= 1000; ++i)
2840 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2841 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2842 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2846 void ScOpenCLTest::testMathFormulaArcTan()
2848 if(!initTestEnv("opencl/math/ArcTan.", FORMAT_ODS, false))
2849 return;
2850 ScDocument& rDoc = xDocSh->GetDocument();
2851 ScDocument& rDocRes = xDocShRes->GetDocument();
2852 rDoc.CalcAll();
2854 // Verify ATan Function
2855 for (SCROW i = 1; i <= 1000; ++i)
2857 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2858 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2859 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2863 void ScOpenCLTest::testMathFormulaArcTanHyp()
2865 if(!initTestEnv("opencl/math/ArcTanHyp.", FORMAT_ODS, false))
2866 return;
2867 ScDocument& rDoc = xDocSh->GetDocument();
2868 ScDocument& rDocRes = xDocShRes->GetDocument();
2869 rDoc.CalcAll();
2871 // Verify ATanH Function
2872 for (SCROW i = 1; i <= 1000; ++i)
2874 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
2875 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
2876 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2880 void ScOpenCLTest:: testFinacialNPER1Formula()
2882 if(!initTestEnv("opencl/financial/NPER1.", FORMAT_XLS, false))
2883 return;
2884 ScDocument& rDoc = xDocSh->GetDocument();
2885 ScDocument& rDocRes = xDocShRes->GetDocument();
2886 rDoc.CalcAll();
2888 for (SCROW i = 0; i <= 6; ++i)
2890 double fLibre = rDoc.GetValue(ScAddress(5, i, 0));
2891 double fExcel = rDocRes.GetValue(ScAddress(5, i, 0));
2892 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2896 void ScOpenCLTest::testMathFormulaArcTan2()
2898 if(!initTestEnv("opencl/math/ArcTan2.", FORMAT_ODS, false))
2899 return;
2900 ScDocument& rDoc = xDocSh->GetDocument();
2901 ScDocument& rDocRes = xDocShRes->GetDocument();
2902 rDoc.CalcAll();
2904 // Verify ATan2 Function
2905 for (SCROW i = 1; i <= 17; ++i)
2907 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2908 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2909 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.000001);
2913 void ScOpenCLTest::testStatisticalFormulaChiSqInv()
2915 if(!initTestEnv("opencl/statistical/CHISQINV.", FORMAT_ODS, false))
2916 return;
2917 ScDocument& rDoc = xDocSh->GetDocument();
2918 ScDocument& rDocRes = xDocShRes->GetDocument();
2919 rDoc.CalcAll();
2921 // Check the results of formula cells in the shared formula range.
2922 for (SCROW i = 1; i <= 9; ++i)
2924 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2925 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2926 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2930 void ScOpenCLTest::testMathFormulaBitAnd()
2932 if(!initTestEnv("opencl/math/BitAnd.", FORMAT_ODS, false))
2933 return;
2934 ScDocument& rDoc = xDocSh->GetDocument();
2935 ScDocument& rDocRes = xDocShRes->GetDocument();
2936 rDoc.CalcAll();
2938 // Verify BitAnd Function
2939 for (SCROW i = 1; i <= 1000; ++i)
2941 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2942 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2943 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2947 void ScOpenCLTest::testStatisticalFormulaPoisson()
2949 if(!initTestEnv("opencl/statistical/Poisson.", FORMAT_XLS, false))
2950 return;
2951 ScDocument& rDoc = xDocSh->GetDocument();
2952 ScDocument& rDocRes = xDocShRes->GetDocument();
2953 rDoc.CalcAll();
2955 // Check the results of formula cells in the shared formula range.
2956 for (SCROW i = 1; i <= 19; ++i)
2958 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2959 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2960 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2964 void ScOpenCLTest::testStatisticalFormulaExpondist()
2966 if(!initTestEnv("opencl/statistical/Expondist.", FORMAT_XLS, false))
2967 return;
2968 ScDocument& rDoc = xDocSh->GetDocument();
2969 ScDocument& rDocRes = xDocShRes->GetDocument();
2970 rDoc.CalcAll();
2972 // Check the results of formula cells in the shared formula range.
2973 for (SCROW i = 0; i <= 9; ++i)
2975 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
2976 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
2977 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2981 void ScOpenCLTest::testMathFormulaBitOr()
2983 if(!initTestEnv("opencl/math/BitOr.", FORMAT_ODS, false))
2984 return;
2985 ScDocument& rDoc = xDocSh->GetDocument();
2986 ScDocument& rDocRes = xDocShRes->GetDocument();
2987 rDoc.CalcAll();
2989 // Verify BitOr Function
2990 for (SCROW i = 1; i <= 20; ++i)
2992 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
2993 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
2994 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2998 void ScOpenCLTest::testMathFormulaOdd()
3000 if(!initTestEnv("opencl/math/odd.", FORMAT_XLS, false))
3001 return;
3002 ScDocument& rDoc = xDocSh->GetDocument();
3003 ScDocument& rDocRes = xDocShRes->GetDocument();
3004 rDoc.CalcAll();
3006 for (SCROW i = 0; i <= 15; ++i)
3008 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3009 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3010 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3014 void ScOpenCLTest::testMathFormulaLN()
3016 if(!initTestEnv("opencl/math/LN.", FORMAT_XLS, false))
3017 return;
3018 ScDocument& rDoc = xDocSh->GetDocument();
3019 ScDocument& rDocRes = xDocShRes->GetDocument();
3020 rDoc.CalcAll();
3022 // Check the results of formula cells in the shared formula range.
3023 for (SCROW i = 1; i <= 9; ++i)
3025 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3026 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3027 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3031 void ScOpenCLTest::testMathFormulaMod()
3033 if(!initTestEnv("opencl/math/mod.", FORMAT_XLS, false))
3034 return;
3035 ScDocument& rDoc = xDocSh->GetDocument();
3036 ScDocument& rDocRes = xDocShRes->GetDocument();
3037 rDoc.CalcAll();
3039 for (SCROW i = 0; i <= 15; ++i)
3041 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3042 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3043 if(fExcel == 0.0f)
3044 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 1e-10);
3045 else
3046 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3050 void ScOpenCLTest::testMathFormulaRound()
3052 if(!initTestEnv("opencl/math/ROUND.", FORMAT_XLS, false))
3053 return;
3054 ScDocument& rDoc = xDocSh->GetDocument();
3055 ScDocument& rDocRes = xDocShRes->GetDocument();
3056 rDoc.CalcAll();
3058 // Check the results of formula cells in the shared formula range.
3059 for (SCROW i = 1; i <= 9; ++i)
3061 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3062 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3063 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3065 for (SCROW i = 15; i <= 25; ++i)
3067 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3068 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3069 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3073 void ScOpenCLTest::testStatisticalFormulaGammaDist()
3075 if(!initTestEnv("opencl/statistical/GammaDist.", FORMAT_XLS, false))
3076 return;
3077 ScDocument& rDoc = xDocSh->GetDocument();
3078 ScDocument& rDocRes = xDocShRes->GetDocument();
3079 rDoc.CalcAll();
3081 // Check the results of formula cells in the shared formula range.
3082 for (SCROW i = 1; i <= 19; ++i)
3084 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3085 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3086 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3090 void ScOpenCLTest::testStatisticalFormulaGammaInv()
3092 if(!initTestEnv("opencl/statistical/GammaInv.", FORMAT_XLS, false))
3093 return;
3094 ScDocument& rDoc = xDocSh->GetDocument();
3095 ScDocument& rDocRes = xDocShRes->GetDocument();
3096 rDoc.CalcAll();
3098 // Check the results of formula cells in the shared formula range.
3099 for (SCROW i = 1; i <= 19; ++i)
3101 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3102 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3103 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3104 fLibre = rDoc.GetValue(ScAddress(4,i,0));
3105 fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3106 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3110 void ScOpenCLTest::testStatisticalFormulaFInv()
3112 if(!initTestEnv("opencl/statistical/FInv.", FORMAT_XLS, false))
3113 return;
3114 ScDocument& rDoc = xDocSh->GetDocument();
3115 ScDocument& rDocRes = xDocShRes->GetDocument();
3116 rDoc.CalcAll();
3118 // Check the results of formula cells in the shared formula range.
3119 for (SCROW i = 1; i <= 19; ++i)
3121 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3122 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3123 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3124 fLibre = rDoc.GetValue(ScAddress(4,i,0));
3125 fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3126 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3130 void ScOpenCLTest::testStatisticalFormulaFTest()
3132 if(!initTestEnv("opencl/statistical/FTest.", FORMAT_XLS, false))
3133 return;
3134 ScDocument& rDoc = xDocSh->GetDocument();
3135 ScDocument& rDocRes = xDocShRes->GetDocument();
3136 rDoc.CalcAll();
3138 // Check the results of formula cells in the shared formula range.
3139 for (SCROW i = 1; i <= 19; ++i)
3141 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3142 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3143 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3147 void ScOpenCLTest::testStatisticalFormulaB()
3149 if(!initTestEnv("opencl/statistical/B.", FORMAT_XLS, false))
3150 return;
3151 ScDocument& rDoc = xDocSh->GetDocument();
3152 ScDocument& rDocRes = xDocShRes->GetDocument();
3153 rDoc.CalcAll();
3155 // Check the results of formula cells in the shared formula range.
3156 for (SCROW i = 1; i <= 19; ++i)
3158 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3159 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3160 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3161 fLibre = rDoc.GetValue(ScAddress(5,i,0));
3162 fExcel = rDocRes.GetValue(ScAddress(5,i,0));
3163 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3167 void ScOpenCLTest::testStatisticalFormulaBetaDist()
3169 if(!initTestEnv("opencl/statistical/BetaDist.", FORMAT_ODS, false))
3170 return;
3171 ScDocument& rDoc = xDocSh->GetDocument();
3172 ScDocument& rDocRes = xDocShRes->GetDocument();
3173 rDoc.CalcAll();
3175 // Check the results of formula cells in the shared formula range.
3176 for (SCROW i = 1; i <= 19; ++i)
3178 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
3179 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
3180 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3181 fLibre = rDoc.GetValue(ScAddress(7,i,0));
3182 fExcel = rDocRes.GetValue(ScAddress(7,i,0));
3183 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3187 void ScOpenCLTest::testMathFormulaEven()
3189 if(!initTestEnv("opencl/math/even.", FORMAT_XLS, false))
3190 return;
3191 ScDocument& rDoc = xDocSh->GetDocument();
3192 ScDocument& rDocRes = xDocShRes->GetDocument();
3193 rDoc.CalcAll();
3195 for (SCROW i = 0; i <= 15; ++i)
3197 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3198 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3199 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3203 void ScOpenCLTest::testMathFormulaExp()
3205 if(!initTestEnv("opencl/math/exp.", FORMAT_ODS, false))
3206 return;
3207 ScDocument& rDoc = xDocSh->GetDocument();
3208 ScDocument& rDocRes = xDocShRes->GetDocument();
3209 rDoc.CalcAll();
3211 for (SCROW i = 0; i <= 15; ++i)
3213 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3214 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3215 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3219 void ScOpenCLTest::testStatisticalFormulaChiDist()
3221 if(!initTestEnv("opencl/statistical/ChiDist.", FORMAT_XLS, false))
3222 return;
3223 ScDocument& rDoc = xDocSh->GetDocument();
3224 ScDocument& rDocRes = xDocShRes->GetDocument();
3225 rDoc.CalcAll();
3227 // Check the results of formula cells in the shared formula range.
3228 for (SCROW i = 1; i <= 19; ++i)
3230 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3231 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3232 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3236 void ScOpenCLTest::testMathFormulaBitLshift()
3238 if(!initTestEnv("opencl/math/BitLshift.", FORMAT_ODS, false))
3239 return;
3240 ScDocument& rDoc = xDocSh->GetDocument();
3241 ScDocument& rDocRes = xDocShRes->GetDocument();
3242 rDoc.CalcAll();
3244 // Verify BitLshift Function
3245 for (SCROW i = 1; i <= 20; ++i)
3247 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3248 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3249 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3253 void ScOpenCLTest::testMathFormulaBitRshift()
3255 if(!initTestEnv("opencl/math/BitRshift.", FORMAT_ODS, false))
3256 return;
3257 ScDocument& rDoc = xDocSh->GetDocument();
3258 ScDocument& rDocRes = xDocShRes->GetDocument();
3259 rDoc.CalcAll();
3261 // Verify BitRshift Function
3262 for (SCROW i = 1; i <= 20; ++i)
3264 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3265 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3266 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3270 void ScOpenCLTest::testMathFormulaFloor()
3272 if(!initTestEnv("opencl/math/floor.", FORMAT_ODS, false))
3273 return;
3274 ScDocument& rDoc = xDocSh->GetDocument();
3275 ScDocument& rDocRes = xDocShRes->GetDocument();
3276 rDoc.CalcAll();
3278 for (SCROW i = 0; i <= 9; ++i)
3280 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3281 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3282 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3286 void ScOpenCLTest::testMathFormulaLog()
3288 if(!initTestEnv("opencl/math/log.", FORMAT_XLS, false))
3289 return;
3290 ScDocument& rDoc = xDocSh->GetDocument();
3291 ScDocument& rDocRes = xDocShRes->GetDocument();
3292 rDoc.CalcAll();
3294 for (SCROW i = 0; i <= 47; ++i)
3296 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3297 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3298 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3302 void ScOpenCLTest::testSpreadSheetFormulaVLookup()
3304 if(!initTestEnv("opencl/spreadsheet/VLookup.", FORMAT_XLS, false))
3305 return;
3306 ScDocument& rDoc = xDocSh->GetDocument();
3307 ScDocument& rDocRes = xDocShRes->GetDocument();
3308 rDoc.CalcAll();
3310 // Check the results of formula cells in the shared formula range.
3311 for (SCROW i = 1; i <= 32; ++i)
3313 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
3314 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
3315 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3317 for (SCROW i = 40; i <= 50; ++i)
3319 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
3320 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
3321 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3325 void ScOpenCLTest::testStatisticalFormulaChiInv()
3327 if(!initTestEnv("opencl/statistical/ChiInv.", FORMAT_XLS, false))
3328 return;
3329 ScDocument& rDoc = xDocSh->GetDocument();
3330 ScDocument& rDocRes = xDocShRes->GetDocument();
3331 rDoc.CalcAll();
3333 // Check the results of formula cells in the shared formula range.
3334 for (SCROW i = 1; i <= 10; ++i)
3336 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3337 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3338 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3342 void ScOpenCLTest::testMathFormulaConvert()
3344 if(!initTestEnv("opencl/math/convert.", FORMAT_XLS, false))
3345 return;
3346 ScDocument& rDoc = xDocSh->GetDocument();
3347 ScDocument& rDocRes = xDocShRes->GetDocument();
3348 rDoc.CalcAll();
3350 for (SCROW i = 0; i <= 3; ++i)
3352 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3353 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3354 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3358 void ScOpenCLTest::testMathCountIfsFormula()
3360 if(!initTestEnv("opencl/math/countifs.", FORMAT_XLS, false))
3361 return;
3362 ScDocument& rDoc = xDocSh->GetDocument();
3363 ScDocument& rDocRes = xDocShRes->GetDocument();
3364 xDocSh->DoHardRecalc();
3366 for (SCROW i = 1; i < 10; ++i)
3368 double fLibre = rDoc.GetValue(ScAddress(4, i, 0));
3369 double fExcel = rDocRes.GetValue(ScAddress(4, i, 0));
3370 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3374 void ScOpenCLTest::testMathFormulaBitXor()
3376 if(!initTestEnv("opencl/math/BitXor.", FORMAT_ODS, false))
3377 return;
3378 ScDocument& rDoc = xDocSh->GetDocument();
3379 ScDocument& rDocRes = xDocShRes->GetDocument();
3380 rDoc.CalcAll();
3382 // Verify BitXor Function
3383 for (SCROW i = 1; i <= 20; ++i)
3385 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3386 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3387 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3391 void ScOpenCLTest::testMathAverageIfsFormula()
3393 if(!initTestEnv("opencl/math/averageifs.", FORMAT_XLS, false))
3394 return;
3395 ScDocument& rDoc = xDocSh->GetDocument();
3396 ScDocument& rDocRes = xDocShRes->GetDocument();
3398 xDocSh->DoHardRecalc();
3400 for (SCROW i = 1; i <= 11; ++i)
3402 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3403 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3404 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3408 void ScOpenCLTest::testMathFormulaLog10()
3410 if(!initTestEnv("opencl/math/log10.", FORMAT_ODS, false))
3411 return;
3412 ScDocument& rDoc = xDocSh->GetDocument();
3413 ScDocument& rDocRes = xDocShRes->GetDocument();
3414 rDoc.CalcAll();
3416 for (SCROW i = 0; i <= 15; ++i)
3418 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3419 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3420 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3424 void ScOpenCLTest::testMathFormulaCombina()
3426 if(!initTestEnv("opencl/math/combina.", FORMAT_XLS, false))
3427 return;
3428 ScDocument& rDoc = xDocSh->GetDocument();
3429 ScDocument& rDocRes = xDocShRes->GetDocument();
3430 rDoc.CalcAll();
3432 for (SCROW i = 0; i <= 47; ++i)
3434 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3435 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3436 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3440 void ScOpenCLTest::testMathFormulaCeil()
3442 if(!initTestEnv("opencl/math/Ceil.", FORMAT_ODS, false))
3443 return;
3444 ScDocument& rDoc = xDocSh->GetDocument();
3445 ScDocument& rDocRes = xDocShRes->GetDocument();
3446 rDoc.CalcAll();
3448 // Verify Ceiling Function
3449 for (SCROW i = 1; i <= 20; ++i)
3451 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3452 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3453 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3457 void ScOpenCLTest::testMathFormulaSqrtPi()
3459 if(!initTestEnv("opencl/math/sqrtpi.", FORMAT_XLS, false))
3460 return;
3461 ScDocument& rDoc = xDocSh->GetDocument();
3462 ScDocument& rDocRes = xDocShRes->GetDocument();
3463 rDoc.CalcAll();
3465 for (SCROW i = 0; i < 20; ++i)
3467 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3468 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3469 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3473 void ScOpenCLTest::testStatisticalFormulaVarP()
3475 if(!initTestEnv("opencl/statistical/VarP.", FORMAT_XLS, false))
3476 return;
3477 ScDocument& rDoc = xDocSh->GetDocument();
3478 ScDocument& rDocRes = xDocShRes->GetDocument();
3479 rDoc.CalcAll();
3481 // Check the results of formula cells in the shared formula range.
3482 for (SCROW i = 1; i <= 20; ++i)
3484 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3485 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3486 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3490 void ScOpenCLTest::testStatisticalFormulaStDev()
3492 if(!initTestEnv("opencl/statistical/StDev.", FORMAT_XLS, false))
3493 return;
3494 ScDocument& rDoc = xDocSh->GetDocument();
3495 ScDocument& rDocRes = xDocShRes->GetDocument();
3496 rDoc.CalcAll();
3498 // Check the results of formula cells in the shared formula range.
3499 for (SCROW i = 1; i <= 20; ++i)
3501 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3502 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3503 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3507 void ScOpenCLTest::testStatisticalFormulaStDevP()
3509 if(!initTestEnv("opencl/statistical/StDevP.", FORMAT_XLS, false))
3510 return;
3511 ScDocument& rDoc = xDocSh->GetDocument();
3512 ScDocument& rDocRes = xDocShRes->GetDocument();
3513 rDoc.CalcAll();
3515 // Check the results of formula cells in the shared formula range.
3516 for (SCROW i = 1; i <= 20; ++i)
3518 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3519 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3520 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3524 void ScOpenCLTest::testStatisticalFormulaSlope()
3526 if(!initTestEnv("opencl/statistical/Slope.", FORMAT_XLS, false))
3527 return;
3528 ScDocument& rDoc = xDocSh->GetDocument();
3529 ScDocument& rDocRes = xDocShRes->GetDocument();
3530 rDoc.CalcAll();
3532 // Check the results of formula cells in the shared formula range.
3533 for (SCROW i = 1; i <= 20; ++i)
3535 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3536 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3537 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3541 void ScOpenCLTest::testStatisticalFormulaSTEYX()
3543 if(!initTestEnv("opencl/statistical/STEYX.", FORMAT_XLS, false))
3544 return;
3545 ScDocument& rDoc = xDocSh->GetDocument();
3546 ScDocument& rDocRes = xDocShRes->GetDocument();
3547 rDoc.CalcAll();
3549 // Check the results of formula cells in the shared formula range.
3550 for (SCROW i = 1; i <= 20; ++i)
3552 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3553 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3554 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3558 void ScOpenCLTest::testStatisticalFormulaZTest()
3560 if(!initTestEnv("opencl/statistical/ZTest.", FORMAT_XLS, false))
3561 return;
3562 ScDocument& rDoc = xDocSh->GetDocument();
3563 ScDocument& rDocRes = xDocShRes->GetDocument();
3564 rDoc.CalcAll();
3566 // Check the results of formula cells in the shared formula range.
3567 for (SCROW i = 1; i <= 20; ++i)
3569 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3570 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3571 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3575 void ScOpenCLTest::testStatisticalFormulaTTest()
3577 if(!initTestEnv("opencl/statistical/TTest.", FORMAT_XLS, false))
3578 return;
3579 ScDocument& rDoc = xDocSh->GetDocument();
3580 ScDocument& rDocRes = xDocShRes->GetDocument();
3581 rDoc.CalcAll();
3583 // Check the results of formula cells in the shared formula range.
3584 for (SCROW i = 1; i <= 20; ++i)
3586 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3587 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3588 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3592 void ScOpenCLTest::testStatisticalFormulaTDist()
3594 if(!initTestEnv("opencl/statistical/TDist.", FORMAT_XLS, false))
3595 return;
3596 ScDocument& rDoc = xDocSh->GetDocument();
3597 ScDocument& rDocRes = xDocShRes->GetDocument();
3598 rDoc.CalcAll();
3600 // Check the results of formula cells in the shared formula range.
3601 for (SCROW i = 1; i <= 20; ++i)
3603 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
3604 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
3605 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3609 void ScOpenCLTest::testStatisticalFormulaTInv()
3611 if(!initTestEnv("opencl/statistical/TInv.", FORMAT_XLS, false))
3612 return;
3613 ScDocument& rDoc = xDocSh->GetDocument();
3614 ScDocument& rDocRes = xDocShRes->GetDocument();
3615 rDoc.CalcAll();
3617 // Check the results of formula cells in the shared formula range.
3618 for (SCROW i = 1; i <= 20; ++i)
3620 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3621 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3622 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3626 void ScOpenCLTest::testStatisticalFormulaBinomDist()
3628 if(!initTestEnv("opencl/statistical/BinomDist.", FORMAT_XLS, false))
3629 return;
3630 ScDocument& rDoc = xDocSh->GetDocument();
3631 ScDocument& rDocRes = xDocShRes->GetDocument();
3632 rDoc.CalcAll();
3634 // Check the results of formula cells in the shared formula range.
3635 for (SCROW i = 1; i <= 9; ++i)
3637 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3638 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3639 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3643 void ScOpenCLTest::testMathFormulaProduct()
3645 if(!initTestEnv("opencl/math/product.", FORMAT_XLS, false))
3646 return;
3647 ScDocument& rDoc = xDocSh->GetDocument();
3648 ScDocument& rDocRes = xDocShRes->GetDocument();
3649 rDoc.CalcAll();
3651 for (SCROW i = 0; i <= 3; ++i)
3653 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3654 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3655 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3659 #if 0 //Disabled temporarily
3660 void ScOpenCLTest::testMathFormulaKombin()
3662 if(!initTestEnv("opencl/math/Kombin.", FORMAT_ODS, false))
3663 return;
3664 ScDocument& rDoc = xDocSh->GetDocument();
3665 ScDocument& rDocRes = xDocShRes->GetDocument();
3666 rDoc.CalcAll();
3668 // Verify Combin Function
3669 for (SCROW i = 1; i <= 20; ++i)
3671 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3672 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3673 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3676 #endif
3678 void ScOpenCLTest:: testArrayFormulaSumX2MY2()
3680 if(!initTestEnv("opencl/array/SUMX2MY2.", FORMAT_XLS, false))
3681 return;
3682 ScDocument& rDoc = xDocSh->GetDocument();
3683 ScDocument& rDocRes = xDocShRes->GetDocument();
3684 rDoc.CalcAll();
3686 for (SCROW i = 0; i <= 9; ++i)
3688 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3689 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3690 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3692 for (SCROW i = 20; i <= 26; ++i)
3694 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3695 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3696 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3700 void ScOpenCLTest::testStatisticalFormulaHypGeomDist()
3702 if(!initTestEnv("opencl/statistical/HypGeomDist.", FORMAT_XLS, false))
3703 return;
3704 ScDocument& rDoc = xDocSh->GetDocument();
3705 ScDocument& rDocRes = xDocShRes->GetDocument();
3706 rDoc.CalcAll();
3708 // Check the results of formula cells in the shared formula range.
3709 for (SCROW i = 1; i <= 19; ++i)
3711 double fLibre = rDoc.GetValue(ScAddress(4,i,0));
3712 double fExcel = rDocRes.GetValue(ScAddress(4,i,0));
3713 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3717 void ScOpenCLTest:: testArrayFormulaSumX2PY2()
3719 if(!initTestEnv("opencl/array/SUMX2PY2.", FORMAT_XLS, false))
3720 return;
3721 ScDocument& rDoc = xDocSh->GetDocument();
3722 ScDocument& rDocRes = xDocShRes->GetDocument();
3723 rDoc.CalcAll();
3725 for (SCROW i = 0; i <= 9; ++i)
3727 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3728 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3729 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3731 for (SCROW i = 20; i <= 26; ++i)
3733 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3734 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3735 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3739 void ScOpenCLTest::testStatisticalFormulaBetainv()
3741 if(!initTestEnv("opencl/statistical/Betainv.", FORMAT_XLS, false))
3742 return;
3743 ScDocument& rDoc = xDocSh->GetDocument();
3744 ScDocument& rDocRes = xDocShRes->GetDocument();
3745 rDoc.CalcAll();
3747 // Check the results of formula cells in the shared formula range.
3748 for (SCROW i = 1; i <= 19; ++i)
3750 double fLibre = rDoc.GetValue(ScAddress(5,i,0));
3751 double fExcel = rDocRes.GetValue(ScAddress(5,i,0));
3752 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3756 void ScOpenCLTest::testStatisticalFormulaMina()
3758 if(!initTestEnv("opencl/statistical/Mina.", FORMAT_XLS, false))
3759 return;
3760 ScDocument& rDoc = xDocSh->GetDocument();
3761 ScDocument& rDocRes = xDocShRes->GetDocument();
3762 rDoc.CalcAll();
3764 for (SCROW i = 0; i <= 9; ++i)
3766 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3767 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3768 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3772 void ScOpenCLTest:: testArrayFormulaSumXMY2()
3774 if(!initTestEnv("opencl/array/SUMXMY2.", FORMAT_XLS, false))
3775 return;
3776 ScDocument& rDoc = xDocSh->GetDocument();
3777 ScDocument& rDocRes = xDocShRes->GetDocument();
3778 rDoc.CalcAll();
3780 for (SCROW i = 0; i <= 9; ++i)
3782 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3783 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3784 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3786 for (SCROW i = 20; i <= 26; ++i)
3788 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3789 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3790 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3794 void ScOpenCLTest::testStatisticalFormulaCountA()
3796 if(!initTestEnv("opencl/statistical/counta.", FORMAT_XLS, false))
3797 return;
3798 ScDocument& rDoc = xDocSh->GetDocument();
3799 ScDocument& rDocRes = xDocShRes->GetDocument();
3800 rDoc.CalcAll();
3802 for (SCROW i = 0; i <= 9; ++i)
3804 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3805 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3806 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3810 void ScOpenCLTest::testStatisticalFormulaMaxa()
3812 if(!initTestEnv("opencl/statistical/Maxa.", FORMAT_XLS, false))
3813 return;
3814 ScDocument& rDoc = xDocSh->GetDocument();
3815 ScDocument& rDocRes = xDocShRes->GetDocument();
3816 rDoc.CalcAll();
3818 for (SCROW i = 0; i <= 9; ++i)
3820 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3821 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3822 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3826 void ScOpenCLTest::testMathFormulaSumProduct()
3828 if(!initTestEnv("opencl/math/sumproduct_mixSliding.", FORMAT_XLS, false))
3829 return;
3830 ScDocument& rDoc = xDocSh->GetDocument();
3831 ScDocument& rDocRes = xDocShRes->GetDocument();
3832 rDoc.CalcAll();
3834 // Check the results of formula cells in the shared formula range.
3835 for (SCROW i = 0; i <= 9; ++i)
3837 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
3838 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
3839 if ( i == 1 )
3840 CPPUNIT_ASSERT_DOUBLES_EQUAL(82, fLibre, fabs(0.0001*fExcel));
3841 else if ( i == 2 )
3842 CPPUNIT_ASSERT_DOUBLES_EQUAL(113, fLibre, fabs(0.0001*fExcel));
3843 else if ( i == 4 )
3844 CPPUNIT_ASSERT_DOUBLES_EQUAL(175, fLibre, fabs(0.0001*fExcel));
3845 else if ( i == 5 )
3846 CPPUNIT_ASSERT_DOUBLES_EQUAL(206, fLibre, fabs(0.0001*fExcel));
3847 else if ( i == 6 )
3848 CPPUNIT_ASSERT_DOUBLES_EQUAL(237, fLibre, fabs(0.0001*fExcel));
3849 else if ( i == 7 )
3850 CPPUNIT_ASSERT_DOUBLES_EQUAL(268, fLibre, fabs(0.0001*fExcel));
3851 else
3852 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3856 void ScOpenCLTest::testMathFormulaAverageIf()
3858 if(!initTestEnv("opencl/math/averageif.", FORMAT_XLS, false))
3859 return;
3860 ScDocument& rDoc = xDocSh->GetDocument();
3861 ScDocument& rDocRes = xDocShRes->GetDocument();
3862 rDoc.CalcAll();
3864 for (SCROW i = 2; i <= 21; ++i)
3866 double fLibre = rDoc.GetValue(ScAddress(6,i,0));
3867 double fExcel = rDocRes.GetValue(ScAddress(6,i,0));
3868 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3872 void ScOpenCLTest::testStatisticalFormulaAverageA()
3874 if(!initTestEnv("opencl/statistical/AverageA.", FORMAT_XLS, false))
3875 return;
3876 ScDocument& rDoc = xDocSh->GetDocument();
3877 ScDocument& rDocRes = xDocShRes->GetDocument();
3878 rDoc.CalcAll();
3880 for (SCROW i = 0; i <= 9; ++i)
3882 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3883 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3884 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3888 void ScOpenCLTest:: testLogicalFormulaAnd()
3890 if(!initTestEnv("opencl/logical/and.", FORMAT_XLS, false))
3891 return;
3892 ScDocument& rDoc = xDocSh->GetDocument();
3893 ScDocument& rDocRes = xDocShRes->GetDocument();
3894 rDoc.CalcAll();
3896 for (SCROW i = 1; i <= 20; ++i)
3898 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
3899 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
3900 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3902 for (SCROW i = 1; i <= 20; ++i)
3904 double fLibre = rDoc.GetValue(ScAddress(3, i, 0));
3905 double fExcel = rDocRes.GetValue(ScAddress(3, i, 0));
3906 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3910 void ScOpenCLTest::testStatisticalFormulaVarA()
3912 if(!initTestEnv("opencl/statistical/VarA.", FORMAT_XLS, false))
3913 return;
3914 ScDocument& rDoc = xDocSh->GetDocument();
3915 ScDocument& rDocRes = xDocShRes->GetDocument();
3916 rDoc.CalcAll();
3918 // Check the results of formula cells in the shared formula range.
3919 for (SCROW i = 1; i <= 20; ++i)
3921 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3922 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3923 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3927 void ScOpenCLTest::testStatisticalFormulaVarPA()
3929 if(!initTestEnv("opencl/statistical/VarPA.", FORMAT_XLS, false))
3930 return;
3931 ScDocument& rDoc = xDocSh->GetDocument();
3932 ScDocument& rDocRes = xDocShRes->GetDocument();
3933 rDoc.CalcAll();
3934 // Check the results of formula cells in the shared formula range.
3935 for (SCROW i = 1; i <= 20; ++i)
3937 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3938 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3939 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3943 void ScOpenCLTest::testStatisticalFormulaStDevA()
3945 if(!initTestEnv("opencl/statistical/StDevA.", FORMAT_XLS, false))
3946 return;
3947 ScDocument& rDoc = xDocSh->GetDocument();
3948 ScDocument& rDocRes = xDocShRes->GetDocument();
3949 rDoc.CalcAll();
3951 // Check the results of formula cells in the shared formula range.
3952 for (SCROW i = 1; i <= 20; ++i)
3954 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3955 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3956 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3960 void ScOpenCLTest::testStatisticalFormulaStDevPA()
3962 if(!initTestEnv("opencl/statistical/StDevPA.", FORMAT_XLS, false))
3963 return;
3964 ScDocument& rDoc = xDocSh->GetDocument();
3965 ScDocument& rDocRes = xDocShRes->GetDocument();
3966 rDoc.CalcAll();
3968 // Check the results of formula cells in the shared formula range.
3969 for (SCROW i = 1; i <= 20; ++i)
3971 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
3972 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
3973 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
3977 void ScOpenCLTest:: testFinancialMDurationFormula1()
3979 if(!initTestEnv("opencl/financial/MDuration1.", FORMAT_XLS, false))
3980 return;
3981 ScDocument& rDoc = xDocSh->GetDocument();
3982 ScDocument& rDocRes = xDocShRes->GetDocument();
3983 rDoc.CalcAll();
3985 for (SCROW i = 0; i <= 9; ++i)
3987 double fLibre = rDoc.GetValue(ScAddress(6, i, 0));
3988 double fExcel = rDocRes.GetValue(ScAddress(6, i, 0));
3989 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel,fLibre,fabs(0.00000000001*fExcel));
3993 void ScOpenCLTest::testMathFormulaSumProduct2()
3995 if(!initTestEnv("opencl/math/sumproductTest.", FORMAT_XLS, false))
3996 return;
3997 ScDocument& rDoc = xDocSh->GetDocument();
3998 ScDocument& rDocRes = xDocShRes->GetDocument();
3999 rDoc.CalcAll();
4001 // Check the results of formula cells in the shared formula range.
4002 for (SCROW i = 2; i <= 12; ++i)
4004 double fLibre = rDoc.GetValue(ScAddress(4,i,1));
4005 double fExcel = rDocRes.GetValue(ScAddress(4,i,1));
4006 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4010 void ScOpenCLTest:: testStatisticalParallelCountBug()
4012 if(!initTestEnv("opencl/statistical/parallel_count_bug_243.", FORMAT_ODS, false))
4013 return;
4014 ScDocument& rDoc = xDocSh->GetDocument();
4015 ScDocument& rDocRes = xDocShRes->GetDocument();
4016 rDoc.CalcAll();
4018 for (SCROW i = 0; i < 13; ++i)
4020 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
4021 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
4022 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4026 void ScOpenCLTest:: testLogicalFormulaOr()
4028 if(!initTestEnv("opencl/logical/or.", FORMAT_XLS, false))
4029 return;
4030 ScDocument& rDoc = xDocSh->GetDocument();
4031 ScDocument& rDocRes = xDocShRes->GetDocument();
4032 rDoc.CalcAll();
4034 for (SCROW i = 0; i < 20; ++i)
4036 double fLibre = rDoc.GetValue(ScAddress(2, i, 0));
4037 double fExcel = rDocRes.GetValue(ScAddress(2, i, 0));
4038 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4042 void ScOpenCLTest:: testLogicalFormulaNot()
4044 if(!initTestEnv("opencl/logical/not.", FORMAT_XLS, false))
4045 return;
4046 ScDocument& rDoc = xDocSh->GetDocument();
4047 ScDocument& rDocRes = xDocShRes->GetDocument();
4048 rDoc.CalcAll();
4050 for (SCROW i = 0; i < 3000; ++i)
4052 double fLibre = rDoc.GetValue(ScAddress(1, i, 0));
4053 double fExcel = rDocRes.GetValue(ScAddress(1, i, 0));
4054 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4058 void ScOpenCLTest:: testLogicalFormulaXor()
4060 if(!initTestEnv("opencl/logical/xor.", FORMAT_XLS, false))
4061 return;
4062 ScDocument& rDoc = xDocSh->GetDocument();
4063 ScDocument& rDocRes = xDocShRes->GetDocument();
4064 rDoc.CalcAll();
4066 for (SCROW i = 0; i < 3000; ++i)
4068 double fLibre = rDoc.GetValue(ScAddress(1, i, 0));
4069 double fExcel = rDocRes.GetValue(ScAddress(1, i, 0));
4070 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4074 void ScOpenCLTest::testDatabaseFormulaDcount()
4076 if(!initTestEnv("opencl/database/dcount.", FORMAT_XLS, false))
4077 return;
4078 ScDocument& rDoc = xDocSh->GetDocument();
4079 ScDocument& rDocRes = xDocShRes->GetDocument();
4080 rDoc.CalcAll();
4082 // Check the results of formula cells in the shared formula range.
4083 for (SCROW i = 1; i <= 32; ++i)
4085 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4086 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4087 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4091 void ScOpenCLTest::testDatabaseFormulaDcountA()
4093 if(!initTestEnv("opencl/database/dcountA.", FORMAT_XLS, false))
4094 return;
4095 ScDocument& rDoc = xDocSh->GetDocument();
4096 ScDocument& rDocRes = xDocShRes->GetDocument();
4097 rDoc.CalcAll();
4099 // Check the results of formula cells in the shared formula range.
4100 for (SCROW i = 1; i <= 32; ++i)
4102 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4103 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4104 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4108 void ScOpenCLTest::testDatabaseFormulaDmax()
4110 if(!initTestEnv("opencl/database/dmax.", FORMAT_XLS, false))
4111 return;
4112 ScDocument& rDoc = xDocSh->GetDocument();
4113 ScDocument& rDocRes = xDocShRes->GetDocument();
4114 rDoc.CalcAll();
4116 // Check the results of formula cells in the shared formula range.
4117 for (SCROW i = 1; i <= 32; ++i)
4119 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4120 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4121 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4125 void ScOpenCLTest::testDatabaseFormulaDmin()
4127 if(!initTestEnv("opencl/database/dmin.", FORMAT_XLS, false))
4128 return;
4129 ScDocument& rDoc = xDocSh->GetDocument();
4130 ScDocument& rDocRes = xDocShRes->GetDocument();
4131 rDoc.CalcAll();
4133 // Check the results of formula cells in the shared formula range.
4134 for (SCROW i = 1; i <= 32; ++i)
4136 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4137 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4138 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4142 void ScOpenCLTest::testDatabaseFormulaDproduct()
4144 if(!initTestEnv("opencl/database/dproduct.", FORMAT_XLS, false))
4145 return;
4146 ScDocument& rDoc = xDocSh->GetDocument();
4147 ScDocument& rDocRes = xDocShRes->GetDocument();
4148 rDoc.CalcAll();
4150 // Check the results of formula cells in the shared formula range.
4151 for (SCROW i = 1; i <= 32; ++i)
4153 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4154 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4155 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4159 void ScOpenCLTest::testDatabaseFormulaDaverage()
4161 if(!initTestEnv("opencl/database/daverage.", FORMAT_XLS, false))
4162 return;
4163 ScDocument& rDoc = xDocSh->GetDocument();
4164 ScDocument& rDocRes = xDocShRes->GetDocument();
4165 rDoc.CalcAll();
4167 // Check the results of formula cells in the shared formula range.
4168 for (SCROW i = 1; i <= 32; ++i)
4170 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4171 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4172 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4173 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4177 void ScOpenCLTest::testDatabaseFormulaDstdev()
4179 if(!initTestEnv("opencl/database/dstdev.", FORMAT_XLS, false))
4180 return;
4181 ScDocument& rDoc = xDocSh->GetDocument();
4182 ScDocument& rDocRes = xDocShRes->GetDocument();
4183 rDoc.CalcAll();
4185 // Check the results of formula cells in the shared formula range.
4186 for (SCROW i = 1; i <= 32; ++i)
4188 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4189 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4190 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4191 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4195 void ScOpenCLTest::testDatabaseFormulaDstdevp()
4197 if(!initTestEnv("opencl/database/dstdevp.", FORMAT_XLS, false))
4198 return;
4199 ScDocument& rDoc = xDocSh->GetDocument();
4200 ScDocument& rDocRes = xDocShRes->GetDocument();
4201 rDoc.CalcAll();
4203 // Check the results of formula cells in the shared formula range.
4204 for (SCROW i = 1; i <= 32; ++i)
4206 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4207 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4208 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4209 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4213 void ScOpenCLTest::testDatabaseFormulaDsum()
4215 if(!initTestEnv("opencl/database/dsum.", FORMAT_XLS, false))
4216 return;
4217 ScDocument& rDoc = xDocSh->GetDocument();
4218 ScDocument& rDocRes = xDocShRes->GetDocument();
4219 rDoc.CalcAll();
4221 // Check the results of formula cells in the shared formula range.
4222 for (SCROW i = 1; i <= 32; ++i)
4224 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4225 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4226 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4227 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4231 void ScOpenCLTest::testDatabaseFormulaDvar()
4233 if(!initTestEnv("opencl/database/dvar.", FORMAT_XLS, false))
4234 return;
4235 ScDocument& rDoc = xDocSh->GetDocument();
4236 ScDocument& rDocRes = xDocShRes->GetDocument();
4237 rDoc.CalcAll();
4239 // Check the results of formula cells in the shared formula range.
4240 for (SCROW i = 1; i <= 32; ++i)
4242 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4243 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4244 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4245 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4249 void ScOpenCLTest::testDatabaseFormulaDvarp()
4251 if(!initTestEnv("opencl/database/dvarp.", FORMAT_XLS, false))
4252 return;
4253 ScDocument& rDoc = xDocSh->GetDocument();
4254 ScDocument& rDocRes = xDocShRes->GetDocument();
4255 rDoc.CalcAll();
4257 // Check the results of formula cells in the shared formula range.
4258 for (SCROW i = 1; i <= 32; ++i)
4260 double fLibre = rDoc.GetValue(ScAddress(9,i,0));
4261 double fExcel = rDocRes.GetValue(ScAddress(10,i,0));
4262 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
4266 void ScOpenCLTest::testMathFormulaRoundUp()
4268 if(!initTestEnv("opencl/math/roundup.", FORMAT_XLS, false))
4269 return;
4270 ScDocument& rDoc = xDocSh->GetDocument();
4271 ScDocument& rDocRes = xDocShRes->GetDocument();
4272 rDoc.CalcAll();
4274 // Check the results of formula cells in the shared formula range.
4275 for (SCROW i = 1; i <= 9; ++i)
4277 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4278 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4279 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4283 void ScOpenCLTest::testMathFormulaRoundDown()
4285 if(!initTestEnv("opencl/math/rounddown.", FORMAT_XLS, false))
4286 return;
4287 ScDocument& rDoc = xDocSh->GetDocument();
4288 ScDocument& rDocRes = xDocShRes->GetDocument();
4289 rDoc.CalcAll();
4291 // Check the results of formula cells in the shared formula range.
4292 for (SCROW i = 1; i <= 9; ++i)
4294 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4295 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4296 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4300 void ScOpenCLTest::testMathFormulaInt()
4302 if(!initTestEnv("opencl/math/int.", FORMAT_XLS, false))
4303 return;
4304 ScDocument& rDoc = xDocSh->GetDocument();
4305 ScDocument& rDocRes = xDocShRes->GetDocument();
4306 rDoc.CalcAll();
4308 // Check the results of formula cells in the shared formula range.
4309 for (SCROW i = 1; i <= 9; ++i)
4311 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4312 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4313 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4317 void ScOpenCLTest::testMathFormulaRadians()
4319 if(!initTestEnv("opencl/math/radians.", FORMAT_XLS, false))
4320 return;
4321 ScDocument& rDoc = xDocSh->GetDocument();
4322 ScDocument& rDocRes = xDocShRes->GetDocument();
4323 rDoc.CalcAll();
4325 // Check the results of formula cells in the shared formula range.
4326 for (SCROW i = 1; i <= 9; ++i)
4328 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4329 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4330 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4334 void ScOpenCLTest::testMathFormulaDegrees()
4336 if(!initTestEnv("opencl/math/degrees.", FORMAT_XLS, false))
4337 return;
4338 ScDocument& rDoc = xDocSh->GetDocument();
4339 ScDocument& rDocRes = xDocShRes->GetDocument();
4340 rDoc.CalcAll();
4342 for (SCROW i = 0; i <= 200; ++i)
4344 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4345 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4346 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4350 void ScOpenCLTest::testMathFormulaIsEven()
4352 if(!initTestEnv("opencl/math/iseven.", FORMAT_XLS, false))
4353 return;
4354 ScDocument& rDoc = xDocSh->GetDocument();
4355 ScDocument& rDocRes = xDocShRes->GetDocument();
4356 rDoc.CalcAll();
4358 // Check the results of formula cells in the shared formula range.
4359 for (SCROW i = 1; i <= 9; ++i)
4361 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4362 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4363 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4367 void ScOpenCLTest::testMathFormulaCountIf()
4369 if(!initTestEnv("opencl/math/countif.", FORMAT_XLS, false))
4370 return;
4371 ScDocument& rDoc = xDocSh->GetDocument();
4372 ScDocument& rDocRes = xDocShRes->GetDocument();
4373 rDoc.CalcAll();
4375 for (SCROW i = 0; i <= 26; ++i)
4377 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4378 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4379 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4383 void ScOpenCLTest::testMathFormulaIsOdd()
4385 if(!initTestEnv("opencl/math/isodd.", FORMAT_XLS, false))
4386 return;
4387 ScDocument& rDoc = xDocSh->GetDocument();
4388 ScDocument& rDocRes = xDocShRes->GetDocument();
4389 rDoc.CalcAll();
4391 // Check the results of formula cells in the shared formula range.
4392 for (SCROW i = 1; i <= 9; ++i)
4394 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4395 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4396 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4400 void ScOpenCLTest::testMathFormulaFact()
4402 if(!initTestEnv("opencl/math/fact.", FORMAT_XLS, false))
4403 return;
4404 ScDocument& rDoc = xDocSh->GetDocument();
4405 ScDocument& rDocRes = xDocShRes->GetDocument();
4406 rDoc.CalcAll();
4408 for (SCROW i = 0; i <= 18; ++i)
4410 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4411 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4412 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4416 void ScOpenCLTest::testMathFormulaSEC()
4418 if(!initTestEnv("opencl/math/sec.", FORMAT_ODS, false))
4419 return;
4420 ScDocument& rDoc = xDocSh->GetDocument();
4421 ScDocument& rDocRes = xDocShRes->GetDocument();
4422 rDoc.CalcAll();
4424 for (SCROW i = 0; i <= 15; ++i)
4426 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4427 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4428 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4432 void ScOpenCLTest::testMathFormulaSECH()
4434 if(!initTestEnv("opencl/math/sech.", FORMAT_ODS, false))
4435 return;
4436 ScDocument& rDoc = xDocSh->GetDocument();
4437 ScDocument& rDocRes = xDocShRes->GetDocument();
4438 rDoc.CalcAll();
4440 for (SCROW i = 0; i <= 15; ++i)
4442 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4443 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4444 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4448 void ScOpenCLTest::testMathFormulaMROUND()
4450 if(!initTestEnv("opencl/math/MROUND.", FORMAT_XLS, false))
4451 return;
4452 ScDocument& rDoc = xDocSh->GetDocument();
4453 ScDocument& rDocRes = xDocShRes->GetDocument();
4454 rDoc.CalcAll();
4456 for (SCROW i = 0; i <= 13; ++i)
4458 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4459 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4460 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4464 void ScOpenCLTest::testMathFormulaQuotient()
4466 if(!initTestEnv("opencl/math/Quotient.", FORMAT_ODS, false))
4467 return;
4468 ScDocument& rDoc = xDocSh->GetDocument();
4469 ScDocument& rDocRes = xDocShRes->GetDocument();
4470 rDoc.CalcAll();
4472 // Verify BitAnd Function
4473 for (SCROW i = 1; i <= 20; ++i)
4475 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4476 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4477 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4481 void ScOpenCLTest::testMathFormulaSeriesSum()
4483 if(!initTestEnv("opencl/math/seriessum.", FORMAT_XLS, false))
4484 return;
4485 ScDocument& rDoc = xDocSh->GetDocument();
4486 ScDocument& rDocRes = xDocShRes->GetDocument();
4487 rDoc.CalcAll();
4489 for (SCROW i = 0; i <= 15; ++i)
4491 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4492 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4493 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4497 void ScOpenCLTest::testMathFormulaSumIf()
4499 if(!initTestEnv("opencl/math/sumif.", FORMAT_XLS, false))
4500 return;
4501 ScDocument& rDoc = xDocSh->GetDocument();
4502 ScDocument& rDocRes = xDocShRes->GetDocument();
4503 rDoc.CalcAll();
4505 for (SCROW i = 0; i <= 26; ++i)
4507 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4508 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4509 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4513 void ScOpenCLTest::testAddInFormulaBesseLJ()
4515 if(!initTestEnv("opencl/addin/besselj.", FORMAT_XLS, false))
4516 return;
4517 ScDocument& rDoc = xDocSh->GetDocument();
4518 ScDocument& rDocRes = xDocShRes->GetDocument();
4519 rDoc.CalcAll();
4521 // Check the results of formula cells in the shared formula range.
4522 for (SCROW i = 1; i <= 20; ++i)
4524 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4525 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4526 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4530 void ScOpenCLTest::testStatisticalFormulaAvedev()
4532 if(!initTestEnv("opencl/statistical/Avedev.", FORMAT_XLS, false))
4533 return;
4534 ScDocument& rDoc = xDocSh->GetDocument();
4535 ScDocument& rDocRes = xDocShRes->GetDocument();
4536 rDoc.CalcAll();
4538 // Check the results of formula cells in the shared formula range.
4539 for (SCROW i = 1; i <= 19; ++i)
4541 double fLibre = rDoc.GetValue(ScAddress(3,i,0));
4542 double fExcel = rDocRes.GetValue(ScAddress(3,i,0));
4543 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4547 void ScOpenCLTest::testNegSub()
4549 if(!initTestEnv("opencl/math/NegSub.", FORMAT_XLS, false))
4550 return;
4551 ScDocument& rDoc = xDocSh->GetDocument();
4552 ScDocument& rDocRes = xDocShRes->GetDocument();
4553 rDoc.CalcAll();
4555 // Check the results of formula cells in the shared formula range.
4556 for (SCROW i = 0; i <= 9; ++i)
4558 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4559 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4560 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4564 void ScOpenCLTest::testMathFormulaAverageIf_Mix()
4566 if(!initTestEnv("opencl/math/averageif_mix.", FORMAT_XLS, false))
4567 return;
4568 ScDocument& rDoc = xDocSh->GetDocument();
4569 ScDocument& rDocRes = xDocShRes->GetDocument();
4570 rDoc.CalcAll();
4572 for (SCROW i = 0; i <= 9; ++i)
4574 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4575 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4576 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4580 void ScOpenCLTest::testStatisticalFormulaKurt1()
4582 if(!initTestEnv("opencl/statistical/Kurt1.", FORMAT_XLS, false))
4583 return;
4584 ScDocument& rDoc = xDocSh->GetDocument();
4585 ScDocument& rDocRes = xDocShRes->GetDocument();
4586 rDoc.CalcAll();
4588 // Check the results of formula cells in the shared formula range.
4589 for (SCROW i = 1; i <= 19; ++i)
4591 double fLibre = rDoc.GetValue(ScAddress(2,i,0));
4592 double fExcel = rDocRes.GetValue(ScAddress(2,i,0));
4593 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4597 void ScOpenCLTest::testStatisticalFormulaHarMean1()
4599 if(!initTestEnv("opencl/statistical/HarMean1.", FORMAT_XLS, false))
4600 return;
4601 ScDocument& rDoc = xDocSh->GetDocument();
4602 ScDocument& rDocRes = xDocShRes->GetDocument();
4603 rDoc.CalcAll();
4605 // Check the results of formula cells in the shared formula range.
4606 for (SCROW i = 1; i <= 19; ++i)
4608 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4609 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4610 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4614 void ScOpenCLTest::testStatisticalFormulaVarA1()
4616 if(!initTestEnv("opencl/statistical/VarA1.", FORMAT_XLS, false))
4617 return;
4618 ScDocument& rDoc = xDocSh->GetDocument();
4619 ScDocument& rDocRes = xDocShRes->GetDocument();
4620 rDoc.CalcAll();
4622 // Check the results of formula cells in the shared formula range.
4623 for (SCROW i = 1; i <= 20; ++i)
4625 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4626 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4627 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4631 void ScOpenCLTest::testStatisticalFormulaVarPA1()
4633 if(!initTestEnv("opencl/statistical/VarPA1.", FORMAT_XLS, false))
4634 return;
4635 ScDocument& rDoc = xDocSh->GetDocument();
4636 ScDocument& rDocRes = xDocShRes->GetDocument();
4637 rDoc.CalcAll();
4639 // Check the results of formula cells in the shared formula range.
4640 for (SCROW i = 1; i <= 20; ++i)
4642 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4643 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4644 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4648 void ScOpenCLTest::testStatisticalFormulaStDevA1()
4650 if(!initTestEnv("opencl/statistical/StDevA1.", FORMAT_XLS, false))
4651 return;
4652 ScDocument& rDoc = xDocSh->GetDocument();
4653 ScDocument& rDocRes = xDocShRes->GetDocument();
4654 rDoc.CalcAll();
4656 // Check the results of formula cells in the shared formula range.
4657 for (SCROW i = 1; i <= 20; ++i)
4659 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4660 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4661 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4665 void ScOpenCLTest::testStatisticalFormulaStDevPA1()
4667 if(!initTestEnv("opencl/statistical/StDevPA1.", FORMAT_XLS, false))
4668 return;
4669 ScDocument& rDoc = xDocSh->GetDocument();
4670 ScDocument& rDocRes = xDocShRes->GetDocument();
4671 rDoc.CalcAll();
4673 // Check the results of formula cells in the shared formula range.
4674 for (SCROW i = 1; i <= 20; ++i)
4676 double fLibre = rDoc.GetValue(ScAddress(1,i,0));
4677 double fExcel = rDocRes.GetValue(ScAddress(1,i,0));
4678 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
4682 ScOpenCLTest::ScOpenCLTest()
4683 : ScBootstrapFixture( "sc/qa/unit/data" )
4687 void ScOpenCLTest::setUp()
4689 test::BootstrapFixture::setUp();
4690 // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
4691 // which is a private symbol to us, gets called
4692 m_xCalcComponent =
4693 getMultiServiceFactory()->
4694 createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
4695 CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is());
4698 void ScOpenCLTest::tearDown()
4700 //close test env
4701 if(xDocSh.is())
4703 xDocSh->DoClose();
4704 xDocSh.clear();
4706 if(xDocShRes.is())
4708 xDocShRes->DoClose();
4709 xDocShRes.clear();
4712 uno::Reference< lang::XComponent >
4713 ( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
4714 test::BootstrapFixture::tearDown();
4717 CPPUNIT_TEST_SUITE_REGISTRATION(ScOpenCLTest);
4719 CPPUNIT_PLUGIN_IMPLEMENT();
4721 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */