Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / unit / opencl-test-2.cxx
blob4c7fbdbcb96d644d3c4c6aa23410873e84135996
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 #include <sal/config.h>
5 #include <string_view>
7 #include "helper/qahelper.hxx"
9 #include <docsh.hxx>
10 #include <document.hxx>
12 #include <comphelper/sequence.hxx>
13 #include <comphelper/servicehelper.hxx>
15 using namespace ::com::sun::star;
16 using namespace ::com::sun::star::uno;
18 class ScOpenCLTest2
19 : public ScModelTestBase
21 public:
22 ScOpenCLTest2();
25 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaPi)
27 initTestEnv(u"xls/opencl/math/pi.xls");
28 ScDocument* pDoc = getScDoc();
29 ScDocument* pDocRes = getScDoc2();
30 pDoc->CalcAll();
32 for (SCROW i = 0; i <= 15; ++i)
34 double fLibre = pDoc->GetValue(ScAddress(0,i,0));
35 double fExcel = pDocRes->GetValue(ScAddress(0,i,0));
36 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
40 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaRandom)
42 initTestEnv(u"xls/opencl/math/random.xls");
43 ScDocument* pDoc = getScDoc();
44 ScDocument* pDocRes = getScDoc2();
45 pDoc->CalcAll();
47 for (SCROW i = 0; i <= 15; ++i)
49 pDoc->GetValue(ScAddress(0,i,0)); // LO
50 pDocRes->GetValue(ScAddress(0,i,0)); // Excel
51 //because the random numbers will always change,so give the test "true"
52 CPPUNIT_ASSERT(true);
56 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaSumSQ)
58 initTestEnv(u"xls/opencl/math/sumsq.xls");
59 ScDocument* pDoc = getScDoc();
60 ScDocument* pDocRes = getScDoc2();
61 pDoc->CalcAll();
63 for (SCROW i = 0; i < 20; ++i)
65 double fLibre = pDoc->GetValue(ScAddress(5,i,0));
66 double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
67 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
71 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaVar)
73 initTestEnv(u"xls/opencl/statistical/Var.xls");
74 ScDocument* pDoc = getScDoc();
75 ScDocument* pDocRes = getScDoc2();
76 pDoc->CalcAll();
78 // Check the results of formula cells in the shared formula range.
79 for (SCROW i = 1; i <= 20; ++i)
81 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
82 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
83 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
87 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaSkew)
89 initTestEnv(u"xls/opencl/statistical/Skew.xls");
90 ScDocument* pDoc = getScDoc();
91 ScDocument* pDocRes = getScDoc2();
92 pDoc->CalcAll();
94 // Check the results of formula cells in the shared formula range.
95 for (SCROW i = 1; i <= 20; ++i)
97 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
98 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
99 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
103 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaSkewp)
105 initTestEnv(u"xls/opencl/statistical/Skewp.xls");
106 ScDocument* pDoc = getScDoc();
107 ScDocument* pDocRes = getScDoc2();
108 pDoc->CalcAll();
110 // Check the results of formula cells in the shared formula range.
111 for (SCROW i = 1; i <= 20; ++i)
113 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
114 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
115 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
119 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaTrunc)
121 initTestEnv(u"xls/opencl/math/trunc.xls");
122 ScDocument* pDoc = getScDoc();
123 ScDocument* pDocRes = getScDoc2();
124 pDoc->CalcAll();
126 for (SCROW i = 0; i <= 15; ++i)
128 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
129 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
130 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
134 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaCovar)
136 initTestEnv(u"xls/opencl/statistical/Covar.xls");
137 ScDocument* pDoc = getScDoc();
138 ScDocument* pDocRes = getScDoc2();
139 pDoc->CalcAll();
141 // Check the results of formula cells in the shared formula range.
142 for (SCROW i = 0; i <= 16; ++i)
144 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
145 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
146 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
150 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaDevSq)
152 initTestEnv(u"xls/opencl/statistical/DevSq.xls");
153 ScDocument* pDoc = getScDoc();
154 ScDocument* pDocRes = getScDoc2();
155 pDoc->CalcAll();
157 // Check the results of formula cells in the shared formula range.
158 for (SCROW i = 0; i <= 11; ++i)
160 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
161 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
162 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
166 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaCscH)
168 initTestEnv(u"ods/opencl/math/csch.ods");
169 ScDocument* pDoc = getScDoc();
170 ScDocument* pDocRes = getScDoc2();
171 pDoc->CalcAll();
173 for (SCROW i = 0; i <= 15; ++i)
175 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
176 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
177 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
181 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaPower)
183 initTestEnv(u"ods/opencl/math/power.ods");
184 ScDocument* pDoc = getScDoc();
185 ScDocument* pDocRes = getScDoc2();
186 pDoc->CalcAll();
188 for (SCROW i = 0; i <= 15; ++i)
190 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
191 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
192 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
196 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaChiSqDist)
198 initTestEnv(u"ods/opencl/statistical/CHISQDIST.ods");
199 ScDocument* pDoc = getScDoc();
200 ScDocument* pDocRes = getScDoc2();
201 pDoc->CalcAll();
203 // Check the results of formula cells in the shared formula range.
204 for (SCROW i = 1; i <= 9; ++i)
206 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
207 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
208 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
210 for (SCROW i = 1; i <= 9; ++i)
212 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
213 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
214 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
218 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaFDist)
220 initTestEnv(u"xls/opencl/statistical/Fdist.xls");
221 ScDocument* pDoc = getScDoc();
222 ScDocument* pDocRes = getScDoc2();
223 pDoc->CalcAll();
225 // Check the results of formula cells in the shared formula range.
226 for (SCROW i = 0; i <= 9; ++i)
228 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
229 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
230 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
234 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaArcTan2)
236 initTestEnv(u"ods/opencl/math/ArcTan2.ods");
237 ScDocument* pDoc = getScDoc();
238 ScDocument* pDocRes = getScDoc2();
239 pDoc->CalcAll();
241 // Verify ATan2 Function
242 for (SCROW i = 1; i <= 17; ++i)
244 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
245 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
246 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.000001);
250 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaChiSqInv)
252 initTestEnv(u"ods/opencl/statistical/CHISQINV.ods");
253 ScDocument* pDoc = getScDoc();
254 ScDocument* pDocRes = getScDoc2();
255 pDoc->CalcAll();
257 // Check the results of formula cells in the shared formula range.
258 for (SCROW i = 1; i <= 9; ++i)
260 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
261 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
262 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
266 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaPoisson)
268 initTestEnv(u"xls/opencl/statistical/Poisson.xls");
269 ScDocument* pDoc = getScDoc();
270 ScDocument* pDocRes = getScDoc2();
271 pDoc->CalcAll();
273 // Check the results of formula cells in the shared formula range.
274 for (SCROW i = 1; i <= 19; ++i)
276 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
277 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
278 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
282 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaExpondist)
284 initTestEnv(u"xls/opencl/statistical/Expondist.xls");
285 ScDocument* pDoc = getScDoc();
286 ScDocument* pDocRes = getScDoc2();
287 pDoc->CalcAll();
289 // Check the results of formula cells in the shared formula range.
290 for (SCROW i = 0; i <= 9; ++i)
292 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
293 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
294 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
298 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaBitOr)
300 initTestEnv(u"ods/opencl/math/BitOr.ods");
301 ScDocument* pDoc = getScDoc();
302 ScDocument* pDocRes = getScDoc2();
303 pDoc->CalcAll();
305 // Verify BitOr Function
306 for (SCROW i = 1; i <= 20; ++i)
308 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
309 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
310 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
314 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaOdd)
316 initTestEnv(u"xls/opencl/math/odd.xls");
317 ScDocument* pDoc = getScDoc();
318 ScDocument* pDocRes = getScDoc2();
319 pDoc->CalcAll();
321 for (SCROW i = 0; i <= 15; ++i)
323 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
324 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
325 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
329 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaMod)
331 initTestEnv(u"xls/opencl/math/mod.xls");
332 ScDocument* pDoc = getScDoc();
333 ScDocument* pDocRes = getScDoc2();
334 pDoc->CalcAll();
336 for (SCROW i = 0; i <= 15; ++i)
338 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
339 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
340 if(fExcel == 0.0f)
341 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 1e-10);
342 else
343 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
347 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaGammaInv)
349 initTestEnv(u"xls/opencl/statistical/GammaInv.xls");
350 ScDocument* pDoc = getScDoc();
351 ScDocument* pDocRes = getScDoc2();
352 pDoc->CalcAll();
354 // Check the results of formula cells in the shared formula range.
355 for (SCROW i = 1; i <= 19; ++i)
357 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
358 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
359 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
360 fLibre = pDoc->GetValue(ScAddress(4,i,0));
361 fExcel = pDocRes->GetValue(ScAddress(4,i,0));
362 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
366 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaFInv)
368 initTestEnv(u"xls/opencl/statistical/FInv.xls");
369 ScDocument* pDoc = getScDoc();
370 ScDocument* pDocRes = getScDoc2();
371 pDoc->CalcAll();
373 // Check the results of formula cells in the shared formula range.
374 for (SCROW i = 1; i <= 19; ++i)
376 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
377 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
378 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
379 fLibre = pDoc->GetValue(ScAddress(4,i,0));
380 fExcel = pDocRes->GetValue(ScAddress(4,i,0));
381 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
385 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaFTest)
387 initTestEnv(u"xls/opencl/statistical/FTest.xls");
388 ScDocument* pDoc = getScDoc();
389 ScDocument* pDocRes = getScDoc2();
390 pDoc->CalcAll();
392 // Check the results of formula cells in the shared formula range.
393 for (SCROW i = 1; i <= 19; ++i)
395 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
396 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
397 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
401 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaB)
403 initTestEnv(u"xls/opencl/statistical/B.xls");
404 ScDocument* pDoc = getScDoc();
405 ScDocument* pDocRes = getScDoc2();
406 pDoc->CalcAll();
408 // Check the results of formula cells in the shared formula range.
409 for (SCROW i = 1; i <= 19; ++i)
411 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
412 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
413 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
414 fLibre = pDoc->GetValue(ScAddress(5,i,0));
415 fExcel = pDocRes->GetValue(ScAddress(5,i,0));
416 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
420 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaBetaDist)
422 initTestEnv(u"ods/opencl/statistical/BetaDist.ods");
423 ScDocument* pDoc = getScDoc();
424 ScDocument* pDocRes = getScDoc2();
425 pDoc->CalcAll();
427 // Check the results of formula cells in the shared formula range.
428 for (SCROW i = 1; i <= 19; ++i)
430 double fLibre = pDoc->GetValue(ScAddress(6,i,0));
431 double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
432 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
433 fLibre = pDoc->GetValue(ScAddress(7,i,0));
434 fExcel = pDocRes->GetValue(ScAddress(7,i,0));
435 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
439 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaEven)
441 initTestEnv(u"xls/opencl/math/even.xls");
442 ScDocument* pDoc = getScDoc();
443 ScDocument* pDocRes = getScDoc2();
444 pDoc->CalcAll();
446 for (SCROW i = 0; i <= 15; ++i)
448 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
449 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
450 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
454 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaExp)
456 initTestEnv(u"ods/opencl/math/exp.ods");
457 ScDocument* pDoc = getScDoc();
458 ScDocument* pDocRes = getScDoc2();
459 pDoc->CalcAll();
461 for (SCROW i = 0; i <= 15; ++i)
463 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
464 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
465 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
469 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaChiDist)
471 initTestEnv(u"xls/opencl/statistical/ChiDist.xls");
472 ScDocument* pDoc = getScDoc();
473 ScDocument* pDocRes = getScDoc2();
474 pDoc->CalcAll();
476 // Check the results of formula cells in the shared formula range.
477 for (SCROW i = 1; i <= 19; ++i)
479 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
480 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
481 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
485 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaBitLshift)
487 initTestEnv(u"ods/opencl/math/BitLshift.ods");
488 ScDocument* pDoc = getScDoc();
489 ScDocument* pDocRes = getScDoc2();
490 pDoc->CalcAll();
492 // Verify BitLshift Function
493 for (SCROW i = 1; i <= 20; ++i)
495 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
496 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
497 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
501 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaBitRshift)
503 initTestEnv(u"ods/opencl/math/BitRshift.ods");
504 ScDocument* pDoc = getScDoc();
505 ScDocument* pDocRes = getScDoc2();
506 pDoc->CalcAll();
508 // Verify BitRshift Function
509 for (SCROW i = 1; i <= 20; ++i)
511 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
512 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
513 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
517 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaFloor)
519 initTestEnv(u"ods/opencl/math/floor.ods");
520 ScDocument* pDoc = getScDoc();
521 ScDocument* pDocRes = getScDoc2();
522 pDoc->CalcAll();
524 for (SCROW i = 0; i <= 9; ++i)
526 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
527 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
528 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
532 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaLog)
534 initTestEnv(u"xls/opencl/math/log.xls");
535 ScDocument* pDoc = getScDoc();
536 ScDocument* pDocRes = getScDoc2();
537 pDoc->CalcAll();
539 for (SCROW i = 0; i <= 47; ++i)
541 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
542 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
543 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
547 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testSpreadSheetFormulaVLookup)
549 initTestEnv(u"xls/opencl/spreadsheet/VLookup.xls");
550 ScDocument* pDoc = getScDoc();
551 ScDocument* pDocRes = getScDoc2();
552 pDoc->CalcAll();
554 // Check the results of formula cells in the shared formula range.
555 for (SCROW i = 1; i <= 32; ++i)
557 double fLibre = pDoc->GetValue(ScAddress(5,i,0));
558 double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
559 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
561 for (SCROW i = 40; i <= 50; ++i)
563 double fLibre = pDoc->GetValue(ScAddress(5,i,0));
564 double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
565 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
569 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaChiInv)
571 initTestEnv(u"xls/opencl/statistical/ChiInv.xls");
572 ScDocument* pDoc = getScDoc();
573 ScDocument* pDocRes = getScDoc2();
574 pDoc->CalcAll();
576 // Check the results of formula cells in the shared formula range.
577 for (SCROW i = 1; i <= 10; ++i)
579 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
580 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
581 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
585 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaConvert)
587 initTestEnv(u"xls/opencl/math/convert.xls");
588 ScDocument* pDoc = getScDoc();
589 ScDocument* pDocRes = getScDoc2();
590 pDoc->CalcAll();
592 for (SCROW i = 0; i <= 3; ++i)
594 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
595 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
596 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
600 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathCountIfsFormula)
602 initTestEnv(u"xls/opencl/math/countifs.xls");
603 ScDocument* pDoc = getScDoc();
604 ScDocument* pDocRes = getScDoc2();
605 ScDocShell* pDocSh = getScDocShell();
606 pDocSh->DoHardRecalc();
608 for (SCROW i = 1; i < 10; ++i)
610 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
611 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
612 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
616 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaBitXor)
618 initTestEnv(u"ods/opencl/math/BitXor.ods");
619 ScDocument* pDoc = getScDoc();
620 ScDocument* pDocRes = getScDoc2();
621 pDoc->CalcAll();
623 // Verify BitXor Function
624 for (SCROW i = 1; i <= 20; ++i)
626 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
627 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
628 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
632 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathAverageIfsFormula)
634 initTestEnv(u"xls/opencl/math/averageifs.xls");
635 ScDocument* pDoc = getScDoc();
636 ScDocument* pDocRes = getScDoc2();
637 ScDocShell* pDocSh = getScDocShell();
639 pDocSh->DoHardRecalc();
641 for (SCROW i = 1; i <= 11; ++i)
643 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
644 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
645 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
649 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaLog10)
651 initTestEnv(u"ods/opencl/math/log10.ods");
652 ScDocument* pDoc = getScDoc();
653 ScDocument* pDocRes = getScDoc2();
654 pDoc->CalcAll();
656 for (SCROW i = 0; i <= 15; ++i)
658 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
659 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
660 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
664 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaCombina)
666 initTestEnv(u"xls/opencl/math/combina.xls");
667 ScDocument* pDoc = getScDoc();
668 ScDocument* pDocRes = getScDoc2();
669 pDoc->CalcAll();
671 for (SCROW i = 0; i <= 47; ++i)
673 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
674 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
675 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
679 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaCeil)
681 initTestEnv(u"ods/opencl/math/Ceil.ods");
682 ScDocument* pDoc = getScDoc();
683 ScDocument* pDocRes = getScDoc2();
684 pDoc->CalcAll();
686 // Verify Ceiling Function
687 for (SCROW i = 1; i <= 20; ++i)
689 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
690 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
691 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
695 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaSqrtPi)
697 initTestEnv(u"xls/opencl/math/sqrtpi.xls");
698 ScDocument* pDoc = getScDoc();
699 ScDocument* pDocRes = getScDoc2();
700 pDoc->CalcAll();
702 for (SCROW i = 0; i < 20; ++i)
704 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
705 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
706 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
710 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaVarP)
712 initTestEnv(u"xls/opencl/statistical/VarP.xls");
713 ScDocument* pDoc = getScDoc();
714 ScDocument* pDocRes = getScDoc2();
715 pDoc->CalcAll();
717 // Check the results of formula cells in the shared formula range.
718 for (SCROW i = 1; i <= 20; ++i)
720 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
721 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
722 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
726 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaStDev)
728 initTestEnv(u"xls/opencl/statistical/StDev.xls");
729 ScDocument* pDoc = getScDoc();
730 ScDocument* pDocRes = getScDoc2();
731 pDoc->CalcAll();
733 // Check the results of formula cells in the shared formula range.
734 for (SCROW i = 1; i <= 20; ++i)
736 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
737 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
738 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
742 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaStDevP)
744 initTestEnv(u"xls/opencl/statistical/StDevP.xls");
745 ScDocument* pDoc = getScDoc();
746 ScDocument* pDocRes = getScDoc2();
747 pDoc->CalcAll();
749 // Check the results of formula cells in the shared formula range.
750 for (SCROW i = 1; i <= 20; ++i)
752 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
753 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
754 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
758 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaSlope)
760 initTestEnv(u"xls/opencl/statistical/Slope.xls");
761 ScDocument* pDoc = getScDoc();
762 ScDocument* pDocRes = getScDoc2();
763 pDoc->CalcAll();
765 // Check the results of formula cells in the shared formula range.
766 for (SCROW i = 1; i <= 20; ++i)
768 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
769 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
770 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
774 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaSTEYX)
776 initTestEnv(u"xls/opencl/statistical/STEYX.xls");
777 ScDocument* pDoc = getScDoc();
778 ScDocument* pDocRes = getScDoc2();
779 pDoc->CalcAll();
781 // Check the results of formula cells in the shared formula range.
782 for (SCROW i = 1; i <= 20; ++i)
784 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
785 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
786 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
790 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaZTest)
792 initTestEnv(u"xls/opencl/statistical/ZTest.xls");
793 ScDocument* pDoc = getScDoc();
794 ScDocument* pDocRes = getScDoc2();
795 pDoc->CalcAll();
797 // Check the results of formula cells in the shared formula range.
798 for (SCROW i = 1; i <= 20; ++i)
800 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
801 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
802 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
806 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaTTest)
808 initTestEnv(u"xls/opencl/statistical/TTest.xls");
809 ScDocument* pDoc = getScDoc();
810 ScDocument* pDocRes = getScDoc2();
811 pDoc->CalcAll();
813 // Check the results of formula cells in the shared formula range.
814 for (SCROW i = 1; i <= 20; ++i)
816 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
817 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
818 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
822 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaTDist)
824 initTestEnv(u"xls/opencl/statistical/TDist.xls");
825 ScDocument* pDoc = getScDoc();
826 ScDocument* pDocRes = getScDoc2();
827 pDoc->CalcAll();
829 // Check the results of formula cells in the shared formula range.
830 for (SCROW i = 1; i <= 20; ++i)
832 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
833 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
834 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
838 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaTInv)
840 initTestEnv(u"xls/opencl/statistical/TInv.xls");
841 ScDocument* pDoc = getScDoc();
842 ScDocument* pDocRes = getScDoc2();
843 pDoc->CalcAll();
845 // Check the results of formula cells in the shared formula range.
846 for (SCROW i = 1; i <= 20; ++i)
848 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
849 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
850 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
854 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaBinomDist)
856 initTestEnv(u"xls/opencl/statistical/BinomDist.xls");
857 ScDocument* pDoc = getScDoc();
858 ScDocument* pDocRes = getScDoc2();
859 pDoc->CalcAll();
861 // Check the results of formula cells in the shared formula range.
862 for (SCROW i = 1; i <= 9; ++i)
864 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
865 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
866 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
870 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaProduct)
872 initTestEnv(u"xls/opencl/math/product.xls");
873 ScDocument* pDoc = getScDoc();
874 ScDocument* pDocRes = getScDoc2();
875 pDoc->CalcAll();
877 for (SCROW i = 0; i <= 3; ++i)
879 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
880 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
881 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
885 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaKombin)
887 initTestEnv(u"ods/opencl/math/Kombin.ods");
888 ScDocument* pDoc = getScDoc();
889 ScDocument* pDocRes = getScDoc2();
890 pDoc->CalcAll();
892 // Verify Combin Function
893 for (SCROW i = 1; i <= 20; ++i)
895 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
896 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
897 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
901 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testArrayFormulaSumX2MY2)
903 initTestEnv(u"xls/opencl/array/SUMX2MY2.xls");
904 ScDocument* pDoc = getScDoc();
905 ScDocument* pDocRes = getScDoc2();
906 pDoc->CalcAll();
908 for (SCROW i = 0; i <= 9; ++i)
910 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
911 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
912 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
914 for (SCROW i = 20; i <= 26; ++i)
916 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
917 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
918 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
922 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaHypGeomDist)
924 initTestEnv(u"xls/opencl/statistical/HypGeomDist.xls");
925 ScDocument* pDoc = getScDoc();
926 ScDocument* pDocRes = getScDoc2();
927 pDoc->CalcAll();
929 // Check the results of formula cells in the shared formula range.
930 for (SCROW i = 1; i <= 19; ++i)
932 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
933 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
934 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
938 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testArrayFormulaSumX2PY2)
940 initTestEnv(u"xls/opencl/array/SUMX2PY2.xls");
941 ScDocument* pDoc = getScDoc();
942 ScDocument* pDocRes = getScDoc2();
943 pDoc->CalcAll();
945 for (SCROW i = 0; i <= 9; ++i)
947 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
948 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
949 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
951 for (SCROW i = 20; i <= 26; ++i)
953 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
954 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
955 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
959 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaBetainv)
961 initTestEnv(u"xls/opencl/statistical/Betainv.xls");
962 ScDocument* pDoc = getScDoc();
963 ScDocument* pDocRes = getScDoc2();
964 pDoc->CalcAll();
966 // Check the results of formula cells in the shared formula range.
967 for (SCROW i = 1; i <= 19; ++i)
969 double fLibre = pDoc->GetValue(ScAddress(5,i,0));
970 double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
971 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
975 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaMina)
977 initTestEnv(u"xls/opencl/statistical/Mina.xls");
978 ScDocument* pDoc = getScDoc();
979 ScDocument* pDocRes = getScDoc2();
980 pDoc->CalcAll();
982 for (SCROW i = 0; i <= 9; ++i)
984 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
985 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
986 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
990 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testArrayFormulaSumXMY2)
992 initTestEnv(u"xls/opencl/array/SUMXMY2.xls");
993 ScDocument* pDoc = getScDoc();
994 ScDocument* pDocRes = getScDoc2();
995 pDoc->CalcAll();
997 for (SCROW i = 0; i <= 9; ++i)
999 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
1000 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
1001 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1003 for (SCROW i = 20; i <= 26; ++i)
1005 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
1006 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
1007 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1011 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaCountA)
1013 initTestEnv(u"xls/opencl/statistical/counta.xls");
1014 ScDocument* pDoc = getScDoc();
1015 ScDocument* pDocRes = getScDoc2();
1016 pDoc->CalcAll();
1018 for (SCROW i = 0; i <= 9; ++i)
1020 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1021 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1022 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1026 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaMaxa)
1028 initTestEnv(u"xls/opencl/statistical/Maxa.xls");
1029 ScDocument* pDoc = getScDoc();
1030 ScDocument* pDocRes = getScDoc2();
1031 pDoc->CalcAll();
1033 for (SCROW i = 0; i <= 9; ++i)
1035 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1036 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1037 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1041 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaSumProduct)
1043 initTestEnv(u"xls/opencl/math/sumproduct_mixSliding.xls");
1044 ScDocument* pDoc = getScDoc();
1045 ScDocument* pDocRes = getScDoc2();
1046 pDoc->CalcAll();
1048 // Check the results of formula cells in the shared formula range.
1049 for (SCROW i = 0; i <= 9; ++i)
1051 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1052 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1053 if ( i == 1 )
1054 CPPUNIT_ASSERT_DOUBLES_EQUAL(82, fLibre, fabs(0.0001*fExcel));
1055 else if ( i == 2 )
1056 CPPUNIT_ASSERT_DOUBLES_EQUAL(113, fLibre, fabs(0.0001*fExcel));
1057 else if ( i == 4 )
1058 CPPUNIT_ASSERT_DOUBLES_EQUAL(175, fLibre, fabs(0.0001*fExcel));
1059 else if ( i == 5 )
1060 CPPUNIT_ASSERT_DOUBLES_EQUAL(206, fLibre, fabs(0.0001*fExcel));
1061 else if ( i == 6 )
1062 CPPUNIT_ASSERT_DOUBLES_EQUAL(237, fLibre, fabs(0.0001*fExcel));
1063 else if ( i == 7 )
1064 CPPUNIT_ASSERT_DOUBLES_EQUAL(268, fLibre, fabs(0.0001*fExcel));
1065 else
1066 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1070 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaAverageIf)
1072 initTestEnv(u"xls/opencl/math/averageif.xls");
1073 ScDocument* pDoc = getScDoc();
1074 ScDocument* pDocRes = getScDoc2();
1075 pDoc->CalcAll();
1077 for (SCROW i = 2; i <= 21; ++i)
1079 double fLibre = pDoc->GetValue(ScAddress(6,i,0));
1080 double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
1081 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1085 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaAverageA)
1087 initTestEnv(u"xls/opencl/statistical/AverageA.xls");
1088 ScDocument* pDoc = getScDoc();
1089 ScDocument* pDocRes = getScDoc2();
1090 pDoc->CalcAll();
1092 for (SCROW i = 0; i <= 9; ++i)
1094 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1095 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1096 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1100 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testLogicalFormulaAnd)
1102 initTestEnv(u"xls/opencl/logical/and.xls");
1103 ScDocument* pDoc = getScDoc();
1104 ScDocument* pDocRes = getScDoc2();
1105 pDoc->CalcAll();
1107 for (SCROW i = 1; i <= 20; ++i)
1109 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
1110 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
1111 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1113 for (SCROW i = 1; i <= 20; ++i)
1115 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
1116 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
1117 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1121 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaVarA)
1123 initTestEnv(u"xls/opencl/statistical/VarA.xls");
1124 ScDocument* pDoc = getScDoc();
1125 ScDocument* pDocRes = getScDoc2();
1126 pDoc->CalcAll();
1128 // Check the results of formula cells in the shared formula range.
1129 for (SCROW i = 1; i <= 20; ++i)
1131 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1132 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1133 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1137 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaVarPA)
1139 initTestEnv(u"xls/opencl/statistical/VarPA.xls");
1140 ScDocument* pDoc = getScDoc();
1141 ScDocument* pDocRes = getScDoc2();
1142 pDoc->CalcAll();
1143 // Check the results of formula cells in the shared formula range.
1144 for (SCROW i = 1; i <= 20; ++i)
1146 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1147 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1148 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1152 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaStDevA)
1154 initTestEnv(u"xls/opencl/statistical/StDevA.xls");
1155 ScDocument* pDoc = getScDoc();
1156 ScDocument* pDocRes = getScDoc2();
1157 pDoc->CalcAll();
1159 // Check the results of formula cells in the shared formula range.
1160 for (SCROW i = 1; i <= 20; ++i)
1162 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1163 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1164 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1168 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaStDevPA)
1170 initTestEnv(u"xls/opencl/statistical/StDevPA.xls");
1171 ScDocument* pDoc = getScDoc();
1172 ScDocument* pDocRes = getScDoc2();
1173 pDoc->CalcAll();
1175 // Check the results of formula cells in the shared formula range.
1176 for (SCROW i = 1; i <= 20; ++i)
1178 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1179 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1180 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1184 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testFinancialMDurationFormula1)
1186 initTestEnv(u"xls/opencl/financial/MDuration1.xls");
1187 ScDocument* pDoc = getScDoc();
1188 ScDocument* pDocRes = getScDoc2();
1189 pDoc->CalcAll();
1191 for (SCROW i = 0; i <= 9; ++i)
1193 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1194 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1195 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel,fLibre,fabs(0.00000000001*fExcel));
1199 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaSumProduct2)
1201 initTestEnv(u"xls/opencl/math/sumproductTest.xls");
1202 ScDocument* pDoc = getScDoc();
1203 ScDocument* pDocRes = getScDoc2();
1204 pDoc->CalcAll();
1206 // Check the results of formula cells in the shared formula range.
1207 for (SCROW i = 2; i <= 12; ++i)
1209 double fLibre = pDoc->GetValue(ScAddress(4,i,1));
1210 double fExcel = pDocRes->GetValue(ScAddress(4,i,1));
1211 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1215 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalParallelCountBug)
1217 initTestEnv(u"ods/opencl/statistical/parallel_count_bug_243.ods");
1218 ScDocument* pDoc = getScDoc();
1219 ScDocument* pDocRes = getScDoc2();
1220 pDoc->CalcAll();
1222 for (SCROW i = 0; i < 13; ++i)
1224 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
1225 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
1226 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1230 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testLogicalFormulaOr)
1232 initTestEnv(u"xls/opencl/logical/or.xls");
1233 ScDocument* pDoc = getScDoc();
1234 ScDocument* pDocRes = getScDoc2();
1235 pDoc->CalcAll();
1237 for (SCROW i = 0; i < 20; ++i)
1239 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
1240 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
1241 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1245 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testLogicalFormulaNot)
1247 initTestEnv(u"xls/opencl/logical/not.xls");
1248 ScDocument* pDoc = getScDoc();
1249 ScDocument* pDocRes = getScDoc2();
1250 pDoc->CalcAll();
1252 for (SCROW i = 0; i < 3000; ++i)
1254 double fLibre = pDoc->GetValue(ScAddress(1, i, 0));
1255 double fExcel = pDocRes->GetValue(ScAddress(1, i, 0));
1256 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1260 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testLogicalFormulaXor)
1262 initTestEnv(u"xls/opencl/logical/xor.xls");
1263 ScDocument* pDoc = getScDoc();
1264 ScDocument* pDocRes = getScDoc2();
1265 pDoc->CalcAll();
1267 for (SCROW i = 0; i < 3000; ++i)
1269 double fLibre = pDoc->GetValue(ScAddress(1, i, 0));
1270 double fExcel = pDocRes->GetValue(ScAddress(1, i, 0));
1271 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1275 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDcount)
1277 initTestEnv(u"xls/opencl/database/dcount.xls");
1278 ScDocument* pDoc = getScDoc();
1279 ScDocument* pDocRes = getScDoc2();
1280 pDoc->CalcAll();
1282 // Check the results of formula cells in the shared formula range.
1283 for (SCROW i = 1; i <= 32; ++i)
1285 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1286 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1287 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1291 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDcountA)
1293 initTestEnv(u"xls/opencl/database/dcountA.xls");
1294 ScDocument* pDoc = getScDoc();
1295 ScDocument* pDocRes = getScDoc2();
1296 pDoc->CalcAll();
1298 // Check the results of formula cells in the shared formula range.
1299 for (SCROW i = 1; i <= 32; ++i)
1301 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1302 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1303 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1307 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDmax)
1309 initTestEnv(u"xls/opencl/database/dmax.xls");
1310 ScDocument* pDoc = getScDoc();
1311 ScDocument* pDocRes = getScDoc2();
1312 pDoc->CalcAll();
1314 // Check the results of formula cells in the shared formula range.
1315 for (SCROW i = 1; i <= 32; ++i)
1317 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1318 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1319 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1323 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDmin)
1325 initTestEnv(u"xls/opencl/database/dmin.xls");
1326 ScDocument* pDoc = getScDoc();
1327 ScDocument* pDocRes = getScDoc2();
1328 pDoc->CalcAll();
1330 // Check the results of formula cells in the shared formula range.
1331 for (SCROW i = 1; i <= 32; ++i)
1333 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1334 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1335 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1339 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDproduct)
1341 initTestEnv(u"xls/opencl/database/dproduct.xls");
1342 ScDocument* pDoc = getScDoc();
1343 ScDocument* pDocRes = getScDoc2();
1344 pDoc->CalcAll();
1346 // Check the results of formula cells in the shared formula range.
1347 for (SCROW i = 1; i <= 32; ++i)
1349 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1350 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1351 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1355 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDaverage)
1357 initTestEnv(u"xls/opencl/database/daverage.xls");
1358 ScDocument* pDoc = getScDoc();
1359 ScDocument* pDocRes = getScDoc2();
1360 pDoc->CalcAll();
1362 // Check the results of formula cells in the shared formula range.
1363 for (SCROW i = 1; i <= 32; ++i)
1365 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1366 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1367 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1368 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1372 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDstdev)
1374 initTestEnv(u"xls/opencl/database/dstdev.xls");
1375 ScDocument* pDoc = getScDoc();
1376 ScDocument* pDocRes = getScDoc2();
1377 pDoc->CalcAll();
1379 // Check the results of formula cells in the shared formula range.
1380 for (SCROW i = 1; i <= 32; ++i)
1382 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1383 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1384 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1385 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1389 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDstdevp)
1391 initTestEnv(u"xls/opencl/database/dstdevp.xls");
1392 ScDocument* pDoc = getScDoc();
1393 ScDocument* pDocRes = getScDoc2();
1394 pDoc->CalcAll();
1396 // Check the results of formula cells in the shared formula range.
1397 for (SCROW i = 1; i <= 32; ++i)
1399 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1400 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1401 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1402 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1406 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDsum)
1408 initTestEnv(u"xls/opencl/database/dsum.xls");
1409 ScDocument* pDoc = getScDoc();
1410 ScDocument* pDocRes = getScDoc2();
1411 pDoc->CalcAll();
1413 // Check the results of formula cells in the shared formula range.
1414 for (SCROW i = 1; i <= 32; ++i)
1416 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1417 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1418 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1419 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1423 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDvar)
1425 initTestEnv(u"xls/opencl/database/dvar.xls");
1426 ScDocument* pDoc = getScDoc();
1427 ScDocument* pDocRes = getScDoc2();
1428 pDoc->CalcAll();
1430 // Check the results of formula cells in the shared formula range.
1431 for (SCROW i = 1; i <= 32; ++i)
1433 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1434 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1435 //CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1436 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1440 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testDatabaseFormulaDvarp)
1442 initTestEnv(u"xls/opencl/database/dvarp.xls");
1443 ScDocument* pDoc = getScDoc();
1444 ScDocument* pDocRes = getScDoc2();
1445 pDoc->CalcAll();
1447 // Check the results of formula cells in the shared formula range.
1448 for (SCROW i = 1; i <= 32; ++i)
1450 double fLibre = pDoc->GetValue(ScAddress(9,i,0));
1451 double fExcel = pDocRes->GetValue(ScAddress(10,i,0));
1452 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00000000001));
1456 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaRoundUp)
1458 initTestEnv(u"xls/opencl/math/roundup.xls");
1459 ScDocument* pDoc = getScDoc();
1460 ScDocument* pDocRes = getScDoc2();
1461 pDoc->CalcAll();
1463 // Check the results of formula cells in the shared formula range.
1464 for (SCROW i = 1; i <= 9; ++i)
1466 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1467 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1468 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1472 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaRoundDown)
1474 initTestEnv(u"xls/opencl/math/rounddown.xls");
1475 ScDocument* pDoc = getScDoc();
1476 ScDocument* pDocRes = getScDoc2();
1477 pDoc->CalcAll();
1479 // Check the results of formula cells in the shared formula range.
1480 for (SCROW i = 1; i <= 9; ++i)
1482 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1483 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1484 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1488 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaInt)
1490 initTestEnv(u"xls/opencl/math/int.xls");
1491 ScDocument* pDoc = getScDoc();
1492 ScDocument* pDocRes = getScDoc2();
1493 pDoc->CalcAll();
1495 // Check the results of formula cells in the shared formula range.
1496 for (SCROW i = 1; i <= 9; ++i)
1498 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1499 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1500 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1504 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaRadians)
1506 initTestEnv(u"xls/opencl/math/radians.xls");
1507 ScDocument* pDoc = getScDoc();
1508 ScDocument* pDocRes = getScDoc2();
1509 pDoc->CalcAll();
1511 // Check the results of formula cells in the shared formula range.
1512 for (SCROW i = 1; i <= 9; ++i)
1514 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1515 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1516 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1520 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaDegrees)
1522 initTestEnv(u"xls/opencl/math/degrees.xls");
1523 ScDocument* pDoc = getScDoc();
1524 ScDocument* pDocRes = getScDoc2();
1525 pDoc->CalcAll();
1527 for (SCROW i = 0; i <= 200; ++i)
1529 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1530 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1531 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1535 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaIsEven)
1537 initTestEnv(u"xls/opencl/math/iseven.xls");
1538 ScDocument* pDoc = getScDoc();
1539 ScDocument* pDocRes = getScDoc2();
1540 pDoc->CalcAll();
1542 // Check the results of formula cells in the shared formula range.
1543 for (SCROW i = 1; i <= 9; ++i)
1545 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1546 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1547 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1551 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaCountIf)
1553 initTestEnv(u"xls/opencl/math/countif.xls");
1554 ScDocument* pDoc = getScDoc();
1555 ScDocument* pDocRes = getScDoc2();
1556 pDoc->CalcAll();
1558 for (SCROW i = 0; i <= 26; ++i)
1560 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1561 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1562 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1566 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaIsOdd)
1568 initTestEnv(u"xls/opencl/math/isodd.xls");
1569 ScDocument* pDoc = getScDoc();
1570 ScDocument* pDocRes = getScDoc2();
1571 pDoc->CalcAll();
1573 // Check the results of formula cells in the shared formula range.
1574 for (SCROW i = 1; i <= 9; ++i)
1576 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1577 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1578 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1582 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaFact)
1584 initTestEnv(u"xls/opencl/math/fact.xls");
1585 ScDocument* pDoc = getScDoc();
1586 ScDocument* pDocRes = getScDoc2();
1587 pDoc->CalcAll();
1589 for (SCROW i = 0; i <= 18; ++i)
1591 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1592 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1593 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1597 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaSEC)
1599 initTestEnv(u"ods/opencl/math/sec.ods");
1600 ScDocument* pDoc = getScDoc();
1601 ScDocument* pDocRes = getScDoc2();
1602 pDoc->CalcAll();
1604 for (SCROW i = 0; i <= 15; ++i)
1606 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1607 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1608 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1612 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaSECH)
1614 initTestEnv(u"ods/opencl/math/sech.ods");
1615 ScDocument* pDoc = getScDoc();
1616 ScDocument* pDocRes = getScDoc2();
1617 pDoc->CalcAll();
1619 for (SCROW i = 0; i <= 15; ++i)
1621 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1622 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1623 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1627 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaMROUND)
1629 initTestEnv(u"xls/opencl/math/MROUND.xls");
1630 ScDocument* pDoc = getScDoc();
1631 ScDocument* pDocRes = getScDoc2();
1632 pDoc->CalcAll();
1634 for (SCROW i = 0; i <= 13; ++i)
1636 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1637 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1638 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1642 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaQuotient)
1644 initTestEnv(u"ods/opencl/math/Quotient.ods");
1645 ScDocument* pDoc = getScDoc();
1646 ScDocument* pDocRes = getScDoc2();
1647 pDoc->CalcAll();
1649 // Verify BitAnd Function
1650 for (SCROW i = 1; i <= 20; ++i)
1652 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1653 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1654 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1658 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaSeriesSum)
1660 initTestEnv(u"xls/opencl/math/seriessum.xls");
1661 ScDocument* pDoc = getScDoc();
1662 ScDocument* pDocRes = getScDoc2();
1663 pDoc->CalcAll();
1665 for (SCROW i = 0; i <= 15; ++i)
1667 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1668 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1669 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1673 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaSumIf)
1675 initTestEnv(u"xls/opencl/math/sumif.xls");
1676 ScDocument* pDoc = getScDoc();
1677 ScDocument* pDocRes = getScDoc2();
1678 pDoc->CalcAll();
1680 for (SCROW i = 0; i <= 26; ++i)
1682 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1683 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1684 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1688 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testAddInFormulaBesseLJ)
1690 initTestEnv(u"xls/opencl/addin/besselj.xls");
1691 ScDocument* pDoc = getScDoc();
1692 ScDocument* pDocRes = getScDoc2();
1693 pDoc->CalcAll();
1695 // Check the results of formula cells in the shared formula range.
1696 for (SCROW i = 1; i <= 20; ++i)
1698 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1699 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1700 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1704 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaAvedev)
1706 initTestEnv(u"xls/opencl/statistical/Avedev.xls");
1707 ScDocument* pDoc = getScDoc();
1708 ScDocument* pDocRes = getScDoc2();
1709 pDoc->CalcAll();
1711 // Check the results of formula cells in the shared formula range.
1712 for (SCROW i = 1; i <= 19; ++i)
1714 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
1715 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
1716 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1720 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testNegSub)
1722 initTestEnv(u"xls/opencl/math/NegSub.xls");
1723 ScDocument* pDoc = getScDoc();
1724 ScDocument* pDocRes = getScDoc2();
1725 pDoc->CalcAll();
1727 // Check the results of formula cells in the shared formula range.
1728 for (SCROW i = 0; i <= 9; ++i)
1730 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1731 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1732 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1736 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testMathFormulaAverageIf_Mix)
1738 initTestEnv(u"xls/opencl/math/averageif_mix.xls");
1739 ScDocument* pDoc = getScDoc();
1740 ScDocument* pDocRes = getScDoc2();
1741 pDoc->CalcAll();
1743 for (SCROW i = 0; i <= 9; ++i)
1745 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1746 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1747 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1751 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaKurt1)
1753 initTestEnv(u"xls/opencl/statistical/Kurt1.xls");
1754 ScDocument* pDoc = getScDoc();
1755 ScDocument* pDocRes = getScDoc2();
1756 pDoc->CalcAll();
1758 // Check the results of formula cells in the shared formula range.
1759 for (SCROW i = 1; i <= 19; ++i)
1761 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1762 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1763 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1767 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaHarMean1)
1769 initTestEnv(u"xls/opencl/statistical/HarMean1.xls");
1770 ScDocument* pDoc = getScDoc();
1771 ScDocument* pDocRes = getScDoc2();
1772 pDoc->CalcAll();
1774 // Check the results of formula cells in the shared formula range.
1775 for (SCROW i = 1; i <= 19; ++i)
1777 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1778 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1779 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1783 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaVarA1)
1785 initTestEnv(u"xls/opencl/statistical/VarA1.xls");
1786 ScDocument* pDoc = getScDoc();
1787 ScDocument* pDocRes = getScDoc2();
1788 pDoc->CalcAll();
1790 // Check the results of formula cells in the shared formula range.
1791 for (SCROW i = 1; i <= 20; ++i)
1793 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1794 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1795 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1799 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaVarPA1)
1801 initTestEnv(u"xls/opencl/statistical/VarPA1.xls");
1802 ScDocument* pDoc = getScDoc();
1803 ScDocument* pDocRes = getScDoc2();
1804 pDoc->CalcAll();
1806 // Check the results of formula cells in the shared formula range.
1807 for (SCROW i = 1; i <= 20; ++i)
1809 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1810 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1811 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1815 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaStDevA1)
1817 initTestEnv(u"xls/opencl/statistical/StDevA1.xls");
1818 ScDocument* pDoc = getScDoc();
1819 ScDocument* pDocRes = getScDoc2();
1820 pDoc->CalcAll();
1822 // Check the results of formula cells in the shared formula range.
1823 for (SCROW i = 1; i <= 20; ++i)
1825 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1826 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1827 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1831 CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaStDevPA1)
1833 initTestEnv(u"xls/opencl/statistical/StDevPA1.xls");
1834 ScDocument* pDoc = getScDoc();
1835 ScDocument* pDocRes = getScDoc2();
1836 pDoc->CalcAll();
1838 // Check the results of formula cells in the shared formula range.
1839 for (SCROW i = 1; i <= 20; ++i)
1841 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1842 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1843 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1847 ScOpenCLTest2::ScOpenCLTest2()
1848 : ScModelTestBase( "sc/qa/unit/data" )
1852 CPPUNIT_PLUGIN_IMPLEMENT();
1854 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */