Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / unit / opencl-test-1.cxx
blob2cb392b3fe4b849ffae6c5358baacf2236c39f37
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 ScOpenCLTest1
19 : public ScModelTestBase
21 public:
22 ScOpenCLTest1();
25 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testCompilerHorizontal)
27 initTestEnv(u"ods/opencl/compiler/horizontal.ods");
28 ScDocument* pDoc = getScDoc();
29 ScDocument* pDocRes = getScDoc2();
30 pDoc->CalcAll();
32 // Check the results of formula cells in the shared formula range.
33 for (SCROW i = 1; i < 5; ++i)
35 double fLibre = pDoc->GetValue(ScAddress(12, i, 0));
36 double fExcel = pDocRes->GetValue(ScAddress(12, i, 0));
37 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
38 fLibre = pDoc->GetValue(ScAddress(13, i, 0));
39 fExcel = pDocRes->GetValue(ScAddress(13, i, 0));
40 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
41 fLibre = pDoc->GetValue(ScAddress(14, i, 0));
42 fExcel = pDocRes->GetValue(ScAddress(14, i, 0));
43 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
47 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testCompilerNested)
49 initTestEnv(u"ods/opencl/compiler/nested.ods");
50 ScDocument* pDoc = getScDoc();
51 ScDocument* pDocRes = getScDoc2();
52 pDoc->CalcAll();
54 // Check the results of formula cells in the shared formula range.
55 for (SCROW i = 1; i < 5; ++i)
57 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
58 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
59 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
63 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testCompilerString)
65 initTestEnv(u"ods/opencl/compiler/string.ods");
66 ScDocument* pDoc = getScDoc();
67 ScDocument* pDocRes = getScDoc2();
68 pDoc->CalcAll();
70 // Check the results of formula cells in the shared formula range.
71 for (SCROW i = 1; i < 5; ++i)
73 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
74 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
75 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
77 fLibre = pDoc->GetValue(ScAddress(3, i, 0));
78 fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
79 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
83 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testCompilerInEq)
85 initTestEnv(u"ods/opencl/compiler/ineq.ods");
86 ScDocument* pDoc = getScDoc();
87 ScDocument* pDocRes = getScDoc2();
88 pDoc->CalcAll();
90 // Check the results of formula cells in the shared formula range.
91 for (SCROW i = 1; i < 7; ++i)
93 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
94 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
95 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
99 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testCompilerPrecision)
101 initTestEnv(u"ods/opencl/compiler/precision.ods");
102 ScDocument* pDoc = getScDoc();
103 ScDocument* pDocRes = getScDoc2();
104 // Check that values with and without opencl are the same/similar enough.
105 enableOpenCL();
106 pDoc->CalcAll();
107 disableOpenCL();
108 pDoc->CalcAll();
110 // Check the results of formula cells in the shared formula range.
111 for (SCROW i = 1; i < 3; ++i)
113 double fOpenCL = pDoc->GetValue(ScAddress(0, i, 0));
114 double fNormal = pDocRes->GetValue(ScAddress(0, i, 0));
115 CPPUNIT_ASSERT_DOUBLES_EQUAL(fNormal, fOpenCL, fabs(1e-14*fOpenCL));
119 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testSystematic)
121 initTestEnv(u"xls/systematic.xls");
123 ScDocument* pDoc = getScDoc();
124 pDoc->CalcAll();
126 int nAVertBegin(0), nAVertEnd(0), nBVertBegin(0), nBVertEnd(0);
127 int nAHorEnd(0), nBHorEnd(0);
129 int nRow, nCol;
130 for (nRow = 0; nRow < 1000; ++nRow)
132 if (pDoc->GetString(ScAddress(0, nRow, 0)) == "a")
134 nAVertBegin = nRow + 1;
136 for (nCol = 0; nCol < 1000; ++nCol)
138 if (pDoc->GetString(ScAddress(nCol, nRow, 0)) != "a")
140 nAHorEnd = nCol;
141 break;
144 break;
147 for (; nRow < 1000; ++nRow)
149 if (pDoc->GetString(ScAddress(0, nRow, 0)) != "a")
151 nAVertEnd = nRow;
152 break;
156 for (; nRow < 1000; ++nRow)
158 if (pDoc->GetString(ScAddress(0, nRow, 0)) == "b")
160 nBVertBegin = nRow + 1;
162 for (nCol = 0; nCol < 1000; ++nCol)
164 if (pDoc->GetString(ScAddress(nCol, nRow, 0)) != "b")
166 nBHorEnd = nCol;
167 break;
170 break;
173 for (; nRow < 1000; ++nRow)
175 if (pDoc->GetString(ScAddress(0, nRow, 0)) != "b")
177 nBVertEnd = nRow;
178 break;
182 CPPUNIT_ASSERT(nAVertBegin != 0);
183 CPPUNIT_ASSERT(nBVertBegin != 0);
184 CPPUNIT_ASSERT(nAVertEnd > nAVertBegin + 100);
185 CPPUNIT_ASSERT(nBVertEnd > nBVertBegin + 100);
186 CPPUNIT_ASSERT_EQUAL(nAVertEnd-nAVertBegin, nBVertEnd-nBVertBegin);
187 CPPUNIT_ASSERT(nAHorEnd > 10);
188 CPPUNIT_ASSERT(nBHorEnd > 10);
189 CPPUNIT_ASSERT_EQUAL(nAHorEnd, nBHorEnd);
191 for (SCROW i = nAVertBegin; i < nAVertEnd; ++i)
193 for (int j = 1; j < nAHorEnd; ++j)
195 double fLibre = pDoc->GetValue(ScAddress(j, i, 0));
196 double fExcel = pDoc->GetValue(ScAddress(j, nBVertBegin + (i - nAVertBegin), 0));
198 const OString sFailedMessage =
199 OStringChar(static_cast<char>('A'+j)) +
200 OString::number(i+1) +
201 "!=" +
202 OStringChar(static_cast<char>('A'+j)) +
203 OString::number(nBVertBegin+(i-nAVertBegin)+1);
204 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(sFailedMessage.getStr(), fExcel, fLibre, 1e-10);
210 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testSharedFormulaXLS)
212 initTestEnv(u"xls/sum_ex.xls");
213 ScDocument* pDoc = getScDoc();
214 ScDocument* pDocRes = getScDoc2();
215 pDoc->CalcAll();
217 // Check the results of formula cells in the shared formula range.
218 for (SCROW i = 0; i < 5; ++i)
220 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
221 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
222 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
225 for (SCROW i = 6; i < 14; ++i)
227 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
228 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
229 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
232 for (SCROW i = 15; i < 18; ++i)
234 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
235 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
236 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
239 for (SCROW i = 19; i < 22; ++i)
241 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
242 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
243 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
246 for (SCROW i = 23; i < 25; ++i)
248 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
249 //double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
250 // There seems to be a bug in LibreOffice beta
251 ASSERT_DOUBLES_EQUAL(/*fExcel*/ 60.0, fLibre);
254 for (SCROW i = 25; i < 27; ++i)
256 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
257 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
258 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
261 for (SCROW i = 28; i < 35; ++i)
263 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
264 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
265 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
268 // workaround for a Calc beta bug
269 ASSERT_DOUBLES_EQUAL(25.0, pDoc->GetValue(ScAddress(2, 35, 0)));
270 ASSERT_DOUBLES_EQUAL(24.0, pDoc->GetValue(ScAddress(2, 36, 0)));
272 for (SCROW i = 38; i < 43; ++i)
274 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
275 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
276 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
279 for (SCROW i = 5; i < 10; ++i)
281 double fLibre = pDoc->GetValue(ScAddress(5, i, 1));
282 double fExcel = pDocRes->GetValue(ScAddress(5, i, 1));
283 ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
286 for (SCROW i = 5; i < 10; ++i)
288 for (SCCOL j = 6; j < 11; ++j)
290 double fLibre = pDoc->GetValue(ScAddress(j, i, 1));
291 double fExcel = pDocRes->GetValue(ScAddress(j, i, 1));
292 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
293 fabs(fExcel*0.0001));
298 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaCos)
300 initTestEnv(u"xls/opencl/math/cos.xls");
301 ScDocument* pDoc = getScDoc();
302 ScDocument* pDocRes = getScDoc2();
303 pDoc->CalcAll();
305 for (SCROW i = 0; i <= 15; ++i)
307 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
308 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
309 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
313 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaSinh)
315 initTestEnv(u"xls/opencl/math/sinh.xls");
316 ScDocument* pDoc = getScDoc();
317 ScDocument* pDocRes = getScDoc2();
318 ScDocShell* pDocSh = getScDocShell();
319 pDocSh->DoHardRecalc();
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(ScOpenCLTest1, testFinacialFormula)
331 initTestEnv(u"xls/opencl/financial/general.xls");
332 ScDocument* pDoc = getScDoc();
333 ScDocument* pDocRes = getScDoc2();
334 pDoc->CalcAll();
336 // Check the results of formula cells in the shared formula range.
337 for (SCROW i = 1; i <= 10; ++i)
339 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
340 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
341 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
344 for (SCROW i = 1; i <= 10; ++i)
346 double fLibre = pDoc->GetValue(ScAddress(6,i,1));
347 double fExcel = pDocRes->GetValue(ScAddress(6,i,1));
348 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
351 for (SCROW i = 1; i <= 10; ++i)
353 double fLibre = pDoc->GetValue(ScAddress(2,i,2));
354 double fExcel = pDocRes->GetValue(ScAddress(2,i,2));
355 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
358 for (SCROW i = 1; i <= 10; ++i)
360 double fLibre = pDoc->GetValue(ScAddress(6,i,3));
361 double fExcel = pDocRes->GetValue(ScAddress(6,i,3));
362 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
365 for (SCROW i = 0; i <= 9; ++i)
367 double fLibre = pDoc->GetValue(ScAddress(3,i,4));
368 double fExcel = pDocRes->GetValue(ScAddress(3,i,4));
369 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
372 for (SCROW i = 0; i <= 9; ++i)
374 double fLibre = pDoc->GetValue(ScAddress(3,i,5));
375 double fExcel = pDocRes->GetValue(ScAddress(3,i,5));
376 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
379 for (SCROW i = 0; i < 10; ++i)
381 double fLibre = pDoc->GetValue(ScAddress(5,i,6));
382 double fExcel = pDocRes->GetValue(ScAddress(5,i,6));
383 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
386 for (SCROW i = 1; i <= 9; ++i)
388 double fLibre = pDoc->GetValue(ScAddress(3,i,7));
389 double fExcel = pDocRes->GetValue(ScAddress(3,i,7));
390 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
393 for (SCROW i = 1; i <= 10; ++i)
395 double fLibre = pDoc->GetValue(ScAddress(3,i,8));
396 double fExcel = pDocRes->GetValue(ScAddress(3,i,8));
397 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
400 for (SCROW i = 1; i <= 9; ++i)
402 double fLibre = pDoc->GetValue(ScAddress(3,i,9));
403 double fExcel = pDocRes->GetValue(ScAddress(3,i,9));
404 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
407 for (SCROW i = 1; i <= 10; ++i)
409 double fLibre = pDoc->GetValue(ScAddress(2,i,10));
410 double fExcel = pDocRes->GetValue(ScAddress(2,i,10));
411 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
414 for (SCROW i = 1; i <= 10; ++i)
416 double fLibre = pDoc->GetValue(ScAddress(7,i,11));
417 double fExcel = pDocRes->GetValue(ScAddress(7,i,11));
418 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
421 for (SCROW i = 1; i <= 10; ++i)
423 double fLibre = pDoc->GetValue(ScAddress(5,i,12));
424 double fExcel = pDocRes->GetValue(ScAddress(5,i,12));
425 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
428 for (SCROW i = 0; i <= 12; ++i)
430 double fLibre = pDoc->GetValue(ScAddress(6,i,13));
431 double fExcel = pDocRes->GetValue(ScAddress(6,i,13));
432 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
435 for (SCROW i = 1; i <= 10; ++i)
437 double fLibre = pDoc->GetValue(ScAddress(3,i,14));
438 double fExcel = pDocRes->GetValue(ScAddress(3,i,14));
439 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
442 for (SCROW i = 1; i <= 10; ++i)
444 double fLibre = pDoc->GetValue(ScAddress(6,i,15));
445 double fExcel = pDocRes->GetValue(ScAddress(6,i,15));
446 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
449 for (SCROW i = 1; i <= 10; ++i)
451 double fLibre = pDoc->GetValue(ScAddress(6,i,16));
452 double fExcel = pDocRes->GetValue(ScAddress(6,i,16));
453 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
456 for (SCROW i = 1; i <= 5; ++i)
458 double fLibre = pDoc->GetValue(ScAddress(6,i,17));
459 double fExcel = pDocRes->GetValue(ScAddress(6,i,17));
460 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
463 for (SCROW i = 0; i <= 10; ++i)
465 double fLibre = pDoc->GetValue(ScAddress(3,i,18));
466 double fExcel = pDocRes->GetValue(ScAddress(3,i,18));
467 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
470 for (SCROW i = 0; i <= 18; ++i)
472 double fLibre = pDoc->GetValue(ScAddress(3,i,19));
473 double fExcel = pDocRes->GetValue(ScAddress(3,i,19));
474 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
478 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaCorrel)
480 initTestEnv(u"ods/opencl/statistical/Correl.ods");
481 ScDocument* pDoc = getScDoc();
482 ScDocument* pDocRes = getScDoc2();
483 pDoc->CalcAll();
485 // Check the results of formula cells in the shared formula range.
486 for (SCROW i = 1; i <= 20; ++i)
488 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
489 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
490 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
493 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaFisher)
495 initTestEnv(u"xls/opencl/statistical/Fisher.xls");
496 ScDocument* pDoc = getScDoc();
497 ScDocument* pDocRes = getScDoc2();
498 pDoc->CalcAll();
500 // Check the results of formula cells in the shared formula range.
501 for (SCROW i = 1; i <= 19; ++i)
503 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
504 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
505 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
509 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaFisherInv)
511 initTestEnv(u"xls/opencl/statistical/FisherInv.xls");
512 ScDocument* pDoc = getScDoc();
513 ScDocument* pDocRes = getScDoc2();
514 pDoc->CalcAll();
516 // Check the results of formula cells in the shared formula range.
517 for (SCROW i = 1; i <= 19; ++i)
519 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
520 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
521 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
525 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaGamma)
527 initTestEnv(u"xls/opencl/statistical/Gamma.xls");
528 ScDocument* pDoc = getScDoc();
529 ScDocument* pDocRes = getScDoc2();
530 pDoc->CalcAll();
532 // Check the results of formula cells in the shared formula range.
533 for (SCROW i = 1; i <= 19; ++i)
535 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
536 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
537 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
541 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialFvscheduleFormula)
543 initTestEnv(u"xls/opencl/financial/Fvschedule.xls");
544 ScDocument* pDoc = getScDoc();
545 ScDocument* pDocRes = getScDoc2();
546 pDoc->CalcAll();
548 for (SCROW i = 0; i <= 9; ++i)
550 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
551 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
552 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
556 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaAbs)
558 initTestEnv(u"ods/opencl/math/Abs.ods");
559 ScDocument* pDoc = getScDoc();
560 ScDocument* pDocRes = getScDoc2();
561 pDoc->CalcAll();
563 // Verify ABS Function
564 for (SCROW i = 1; i <= 1000; ++i)
566 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
567 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
568 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
572 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialSYDFormula)
574 initTestEnv(u"xls/opencl/financial/SYD.xls");
575 ScDocument* pDoc = getScDoc();
576 ScDocument* pDocRes = getScDoc2();
577 pDoc->CalcAll();
579 for (SCROW i = 0; i <= 9; ++i)
581 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
582 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
583 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
587 // this test has intermittent failures on OSX
588 #if !defined MACOSX
589 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialIRRFormula)
591 initTestEnv(u"xls/opencl/financial/IRR.xls");
592 ScDocument* pDoc = getScDoc();
593 ScDocument* pDocRes = getScDoc2();
594 pDoc->CalcAll();
596 for (SCROW i = 0; i <= 6; ++i)
598 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
599 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
600 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
603 #endif
605 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaGammaLn)
607 initTestEnv(u"xls/opencl/statistical/GammaLn.xls");
608 ScDocument* pDoc = getScDoc();
609 ScDocument* pDocRes = getScDoc2();
610 pDoc->CalcAll();
612 // Check the results of formula cells in the shared formula range.
613 for (SCROW i = 1; i <= 19; ++i)
615 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
616 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
617 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
621 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaGauss)
623 initTestEnv(u"xls/opencl/statistical/Gauss.xls");
624 ScDocument* pDoc = getScDoc();
625 ScDocument* pDocRes = getScDoc2();
626 pDoc->CalcAll();
628 // Check the results of formula cells in the shared formula range.
629 for (SCROW i = 1; i <= 19; ++i)
631 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
632 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
633 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
637 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaGeoMean)
639 initTestEnv(u"xls/opencl/statistical/GeoMean.xls");
640 ScDocument* pDoc = getScDoc();
641 ScDocument* pDocRes = getScDoc2();
642 pDoc->CalcAll();
644 // Check the results of formula cells in the shared formula range.
645 for (SCROW i = 1; i <= 19; ++i)
647 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
648 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
649 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
653 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaHarMean)
655 initTestEnv(u"xls/opencl/statistical/HarMean.xls");
656 ScDocument* pDoc = getScDoc();
657 ScDocument* pDocRes = getScDoc2();
658 pDoc->CalcAll();
660 // Check the results of formula cells in the shared formula range.
661 for (SCROW i = 1; i <= 19; ++i)
663 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
664 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
665 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
669 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialSLNFormula)
671 initTestEnv(u"xls/opencl/financial/SLN.xls");
672 ScDocument* pDoc = getScDoc();
673 ScDocument* pDocRes = getScDoc2();
674 pDoc->CalcAll();
676 for (SCROW i = 0; i <= 9; ++i)
678 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
679 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
680 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
684 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialMIRRFormula)
686 initTestEnv(u"xls/opencl/financial/MIRR.xls");
687 ScDocument* pDoc = getScDoc();
688 ScDocument* pDocRes = getScDoc2();
689 pDoc->CalcAll();
691 for (SCROW i = 0; i <= 6; ++i)
693 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
694 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
695 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
699 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialCoupdaybsFormula)
701 initTestEnv(u"xls/opencl/financial/Coupdaybs.xls");
702 ScDocument* pDoc = getScDoc();
703 ScDocument* pDocRes = getScDoc2();
704 pDoc->CalcAll();
706 for (SCROW i = 1; i <=10; ++i)
708 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
709 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
710 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
714 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialDollardeFormula)
716 initTestEnv(u"xls/opencl/financial/Dollarde.xls");
717 ScDocument* pDoc = getScDoc();
718 ScDocument* pDocRes = getScDoc2();
719 pDoc->CalcAll();
721 for (SCROW i = 0; i <= 9; ++i)
723 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
724 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
725 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
729 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialCoupdaysFormula)
731 initTestEnv(u"xls/opencl/financial/Coupdays.xls");
732 ScDocument* pDoc = getScDoc();
733 ScDocument* pDocRes = getScDoc2();
734 pDoc->CalcAll();
736 for (SCROW i = 1; i <=10; ++i)
738 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
739 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
740 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
745 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialCoupdaysncFormula)
747 initTestEnv(u"xls/opencl/financial/Coupdaysnc.xls");
748 ScDocument* pDoc = getScDoc();
749 ScDocument* pDocRes = getScDoc2();
750 pDoc->CalcAll();
752 for (SCROW i = 1; i <=10; ++i)
754 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
755 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
756 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
759 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialRateFormula)
761 initTestEnv(u"xls/opencl/financial/RATE.xls");
762 ScDocument* pDoc = getScDoc();
763 ScDocument* pDocRes = getScDoc2();
764 pDoc->CalcAll();
766 for (SCROW i = 1; i <= 5; ++i)
768 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
769 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
770 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
774 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialAccrintmFormula)
776 initTestEnv(u"xls/opencl/financial/Accrintm.xls");
777 ScDocument* pDoc = getScDoc();
778 ScDocument* pDocRes = getScDoc2();
779 pDoc->CalcAll();
781 for (SCROW i = 1; i <= 10; ++i)
783 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
784 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
785 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
789 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialCoupnumFormula)
791 initTestEnv(u"xls/opencl/financial/Coupnum.xls");
792 ScDocument* pDoc = getScDoc();
793 ScDocument* pDocRes = getScDoc2();
794 pDoc->CalcAll();
796 for (SCROW i = 0; i <= 9; ++i)
798 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
799 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
800 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
804 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaNegbinomdist)
806 initTestEnv(u"xls/opencl/statistical/Negbinomdist.xls");
807 ScDocument* pDoc = getScDoc();
808 ScDocument* pDocRes = getScDoc2();
809 pDoc->CalcAll();
811 // Check the results of formula cells in the shared formula range.
812 for (SCROW i = 0; i <= 9; ++i)
814 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
815 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
816 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
820 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaSin)
822 initTestEnv(u"xls/opencl/math/sin.xls");
823 ScDocument* pDoc = getScDoc();
824 ScDocument* pDocRes = getScDoc2();
825 pDoc->CalcAll();
827 for (SCROW i = 0; i <= 15; ++i)
829 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
830 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
831 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
835 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaTan)
837 initTestEnv(u"xls/opencl/math/tan.xls");
838 ScDocument* pDoc = getScDoc();
839 ScDocument* pDocRes = getScDoc2();
840 pDoc->CalcAll();
842 for (SCROW i = 0; i <= 15; ++i)
844 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
845 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
846 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
850 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaTanH)
852 initTestEnv(u"xls/opencl/math/tanh.xls");
853 ScDocument* pDoc = getScDoc();
854 ScDocument* pDocRes = getScDoc2();
855 pDoc->CalcAll();
857 for (SCROW i = 0; i <= 15; ++i)
859 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
860 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
861 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
865 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaSqrt)
867 initTestEnv(u"xls/opencl/math/sqrt.xls");
868 ScDocument* pDoc = getScDoc();
869 ScDocument* pDocRes = getScDoc2();
870 pDoc->CalcAll();
872 for (SCROW i = 0; i <= 15; ++i)
874 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
875 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
876 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
880 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialPriceFormula)
882 initTestEnv(u"xls/opencl/financial/Price.xls");
883 ScDocument* pDoc = getScDoc();
884 ScDocument* pDocRes = getScDoc2();
885 pDoc->CalcAll();
887 for (SCROW i = 1; i <= 10; ++i)
889 double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
890 double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
891 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
895 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialDollarfrFormula)
897 initTestEnv(u"xls/opencl/financial/Dollarfr.xls");
898 ScDocument* pDoc = getScDoc();
899 ScDocument* pDocRes = getScDoc2();
900 pDoc->CalcAll();
902 for (SCROW i = 0; i <= 9; ++i)
904 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
905 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
906 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
910 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialPriceDiscFormula)
912 initTestEnv(u"xls/opencl/financial/PriceDisc.xls");
913 ScDocument* pDoc = getScDoc();
914 ScDocument* pDocRes = getScDoc2();
915 pDoc->CalcAll();
917 for (SCROW i = 0; i <= 10; ++i)
919 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
920 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
921 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
925 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialODDLPRICEFormula)
927 initTestEnv(u"xls/opencl/financial/Oddlprice.xls");
928 ScDocument* pDoc = getScDoc();
929 ScDocument* pDocRes = getScDoc2();
930 pDoc->CalcAll();
932 for (SCROW i = 1; i <= 10; ++i)
934 double fLibre = pDoc->GetValue(ScAddress(8, i, 0));
935 double fExcel = pDocRes->GetValue(ScAddress(8, i, 0));
936 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
940 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialOddlyieldFormula)
942 initTestEnv(u"xls/opencl/financial/Oddlyield.xls");
943 ScDocument* pDoc = getScDoc();
944 ScDocument* pDocRes = getScDoc2();
945 pDoc->CalcAll();
947 for (SCROW i = 0; i <= 6; ++i)
949 double fLibre = pDoc->GetValue(ScAddress(8, i, 0));
950 double fExcel = pDocRes->GetValue(ScAddress(8, i, 0));
951 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
955 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialDISCFormula)
957 initTestEnv(u"xls/opencl/financial/DISC.xls");
958 ScDocument* pDoc = getScDoc();
959 ScDocument* pDocRes = getScDoc2();
960 pDoc->CalcAll();
962 for (SCROW i = 0; i <= 9; ++i)
964 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
965 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
966 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
970 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialPVFormula)
972 initTestEnv(u"xls/opencl/financial/PV.xls");
973 ScDocument* pDoc = getScDoc();
974 ScDocument* pDocRes = getScDoc2();
975 pDoc->CalcAll();
977 for (SCROW i = 0; i <= 9; ++i)
979 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
980 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
981 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
985 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialINTRATEFormula)
987 initTestEnv(u"xls/opencl/financial/INTRATE.xls");
988 ScDocument* pDoc = getScDoc();
989 ScDocument* pDocRes = getScDoc2();
990 pDoc->CalcAll();
992 for (SCROW i = 0; i <= 9; ++i)
994 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
995 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
996 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1000 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaStandard)
1002 initTestEnv(u"xls/opencl/statistical/Standard.xls");
1003 ScDocument* pDoc = getScDoc();
1004 ScDocument* pDocRes = getScDoc2();
1005 pDoc->CalcAll();
1007 // Check the results of formula cells in the shared formula range.
1008 for (SCROW i = 1; i <= 20; ++i)
1010 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
1011 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
1012 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1016 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaWeibull)
1018 initTestEnv(u"xls/opencl/statistical/Weibull.xls");
1019 ScDocument* pDoc = getScDoc();
1020 ScDocument* pDocRes = getScDoc2();
1021 pDoc->CalcAll();
1023 // Check the results of formula cells in the shared formula range.
1024 for (SCROW i = 1; i <= 20; ++i)
1026 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
1027 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
1028 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
1029 fExcel == 0?1e-4:fabs(1e-4*fExcel));
1033 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaPearson)
1035 initTestEnv(u"xls/opencl/statistical/Pearson.xls");
1036 ScDocument* pDoc = getScDoc();
1037 ScDocument* pDocRes = getScDoc2();
1038 pDoc->CalcAll();
1040 // Check the results of formula cells in the shared formula range.
1041 for (SCROW i = 1; i <= 9; ++i)
1043 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1044 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1045 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1049 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaRsq)
1051 initTestEnv(u"xls/opencl/statistical/Rsq.xls");
1052 ScDocument* pDoc = getScDoc();
1053 ScDocument* pDocRes = getScDoc2();
1054 pDoc->CalcAll();
1056 // Check the results of formula cells in the shared formula range.
1057 for (SCROW i = 1; i <= 9; ++i)
1059 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1060 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1061 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1065 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaCosh)
1067 initTestEnv(u"xls/opencl/math/cosh.xls");
1068 ScDocument* pDoc = getScDoc();
1069 ScDocument* pDocRes = getScDoc2();
1070 pDoc->CalcAll();
1072 for (SCROW i = 0; i <= 15; ++i)
1074 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1075 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1076 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1080 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaKurt)
1082 initTestEnv(u"xls/opencl/statistical/Kurt.xls");
1083 ScDocument* pDoc = getScDoc();
1084 ScDocument* pDocRes = getScDoc2();
1085 pDoc->CalcAll();
1087 // Check the results of formula cells in the shared formula range.
1088 for (SCROW i = 1; i <= 19; ++i)
1090 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1091 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1092 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1096 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaCot)
1098 initTestEnv(u"ods/opencl/math/cot.ods");
1099 ScDocument* pDoc = getScDoc();
1100 ScDocument* pDocRes = getScDoc2();
1101 pDoc->CalcAll();
1103 for (SCROW i = 0; i <= 15; ++i)
1105 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1106 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1107 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1111 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaCsc)
1113 initTestEnv(u"ods/opencl/math/csc.ods");
1114 ScDocument* pDoc = getScDoc();
1115 ScDocument* pDocRes = getScDoc2();
1116 pDoc->CalcAll();
1118 for (SCROW i = 0; i <= 15; ++i)
1120 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1121 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1122 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1126 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaCoth)
1128 initTestEnv(u"ods/opencl/math/coth.ods");
1129 ScDocument* pDoc = getScDoc();
1130 ScDocument* pDocRes = getScDoc2();
1131 pDoc->CalcAll();
1133 for (SCROW i = 0; i <= 15; ++i)
1135 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1136 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1137 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1141 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialXNPVFormula)
1143 initTestEnv(u"xls/opencl/financial/XNPV.xls");
1144 ScDocument* pDoc = getScDoc();
1145 ScDocument* pDocRes = getScDoc2();
1146 pDoc->CalcAll();
1148 for (SCROW i = 1; i <= 9; ++i)
1150 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
1151 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
1152 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1155 for (SCROW i = 16; i <= 26; ++i)
1157 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
1158 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
1159 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1163 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaIntercept)
1165 initTestEnv(u"xls/opencl/statistical/Intercept.xls");
1166 ScDocument* pDoc = getScDoc();
1167 ScDocument* pDocRes = getScDoc2();
1168 pDoc->CalcAll();
1170 for (SCROW i = 1; i <= 19; ++i)
1172 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1173 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1174 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1178 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialAmordegrcFormula)
1180 initTestEnv(u"xls/opencl/financial/Amordegrc.xls");
1181 ScDocument* pDoc = getScDoc();
1182 ScDocument* pDocRes = getScDoc2();
1183 pDoc->CalcAll();
1185 for (SCROW i = 0; i <= 9; ++i)
1187 double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
1188 double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
1189 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1193 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialISPMTFormula)
1195 initTestEnv(u"xls/opencl/financial/ISPMT.xls");
1196 ScDocument* pDoc = getScDoc();
1197 ScDocument* pDocRes = getScDoc2();
1198 pDoc->CalcAll();
1200 for (SCROW i = 0; i <= 9; ++i)
1202 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
1203 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
1204 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1208 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaMedian)
1210 initTestEnv(u"xls/opencl/statistical/Median.xls");
1211 ScDocument* pDoc = getScDoc();
1212 ScDocument* pDocRes = getScDoc2();
1213 pDoc->CalcAll();
1215 // Check the results of formula cells in the shared formula range.
1216 for (SCROW i = 1; i <= 9; ++i)
1218 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1219 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1220 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1224 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaNormdist)
1226 initTestEnv(u"xls/opencl/statistical/Normdist.xls");
1227 ScDocument* pDoc = getScDoc();
1228 ScDocument* pDocRes = getScDoc2();
1229 pDoc->CalcAll();
1231 // Check the results of formula cells in the shared formula range.
1232 for (SCROW i = 1; i <= 19; ++i)
1234 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
1235 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
1236 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1240 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaNormsdist)
1242 initTestEnv(u"xls/opencl/statistical/Normsdist.xls");
1243 ScDocument* pDoc = getScDoc();
1244 ScDocument* pDocRes = getScDoc2();
1245 pDoc->CalcAll();
1247 // Check the results of formula cells in the shared formula range.
1248 for (SCROW i = 1; i <= 19; ++i)
1250 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1251 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1252 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1256 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaPermut)
1258 initTestEnv(u"xls/opencl/statistical/Permut.xls");
1259 ScDocument* pDoc = getScDoc();
1260 ScDocument* pDocRes = getScDoc2();
1261 pDoc->CalcAll();
1263 // Check the results of formula cells in the shared formula range.
1264 for (SCROW i = 1; i <= 19; ++i)
1266 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1267 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1268 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1272 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaPermutation)
1274 initTestEnv(u"xls/opencl/statistical/Permutation.xls");
1275 ScDocument* pDoc = getScDoc();
1276 ScDocument* pDocRes = getScDoc2();
1277 pDoc->CalcAll();
1279 // Check the results of formula cells in the shared formula range.
1280 for (SCROW i = 1; i <= 9; ++i)
1282 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
1283 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
1284 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1288 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaPhi)
1290 initTestEnv(u"xls/opencl/statistical/Phi.xls");
1291 ScDocument* pDoc = getScDoc();
1292 ScDocument* pDocRes = getScDoc2();
1293 pDoc->CalcAll();
1295 // Check the results of formula cells in the shared formula range.
1296 for (SCROW i = 1; i <= 19; ++i)
1298 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1299 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1300 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1304 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaLogInv)
1306 initTestEnv(u"xls/opencl/statistical/LogInv.xls");
1307 ScDocument* pDoc = getScDoc();
1308 ScDocument* pDocRes = getScDoc2();
1309 pDoc->CalcAll();
1311 // Check the results of formula cells in the shared formula range.
1312 for (SCROW i = 1; i <= 19; ++i)
1314 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
1315 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
1316 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1320 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialNPERFormula)
1322 initTestEnv(u"xls/opencl/financial/NPER.xls");
1323 ScDocument* pDoc = getScDoc();
1324 ScDocument* pDocRes = getScDoc2();
1325 pDoc->CalcAll();
1327 for (SCROW i = 0; i <= 10; ++i)
1329 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
1330 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
1331 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1335 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaForecast)
1337 initTestEnv(u"xls/opencl/statistical/Forecast.xls");
1338 ScDocument* pDoc = getScDoc();
1339 ScDocument* pDocRes = getScDoc2();
1340 pDoc->CalcAll();
1342 // Check the results of formula cells in the shared formula range.
1343 for (SCROW i = 1; i <= 19; ++i)
1345 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
1346 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
1347 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1351 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialAmorlincFormula)
1353 initTestEnv(u"xls/opencl/financial/Amorlinc.xls");
1354 ScDocument* pDoc = getScDoc();
1355 ScDocument* pDocRes = getScDoc2();
1356 pDoc->CalcAll();
1358 for (SCROW i = 0; i <= 9; ++i)
1360 double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
1361 double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
1362 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1366 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialDDBFormula)
1368 initTestEnv(u"xls/opencl/financial/ddb.xls");
1369 ScDocument* pDoc = getScDoc();
1370 ScDocument* pDocRes = getScDoc2();
1371 pDoc->CalcAll();
1373 for (SCROW i = 0; i <= 9; ++i)
1375 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
1376 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
1377 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1380 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialPriceMatFormula)
1382 initTestEnv(u"xls/opencl/financial/PriceMat.xls");
1383 ScDocument* pDoc = getScDoc();
1384 ScDocument* pDocRes = getScDoc2();
1385 pDoc->CalcAll();
1387 for (SCROW i = 0; i <= 9; ++i)
1389 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1390 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1391 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1394 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialFormulaReceived)
1396 initTestEnv(u"xls/opencl/financial/Received.xls");
1397 ScDocument* pDoc = getScDoc();
1398 ScDocument* pDocRes = getScDoc2();
1399 pDoc->CalcAll();
1401 // Check the results of formula cells in the shared formula range.
1402 for (SCROW i = 0; i < 10; ++i)
1404 double fLibre = pDoc->GetValue(ScAddress(5,i,0));
1405 double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
1406 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1409 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialFormulaCumipmt)
1411 initTestEnv(u"xls/opencl/financial/Cumipmt.xls");
1412 ScDocument* pDoc = getScDoc();
1413 ScDocument* pDocRes = getScDoc2();
1414 pDoc->CalcAll();
1416 // Check the results of formula cells in the shared formula range.
1417 for (SCROW i = 1; i <= 10; ++i)
1419 double fLibre = pDoc->GetValue(ScAddress(6,i,0));
1420 double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
1421 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1424 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialFormulaCumprinc)
1426 initTestEnv(u"xls/opencl/financial/Cumprinc.xls");
1427 ScDocument* pDoc = getScDoc();
1428 ScDocument* pDocRes = getScDoc2();
1429 pDoc->CalcAll();
1431 // Check the results of formula cells in the shared formula range.
1432 for (SCROW i = 1; i <= 10; ++i)
1434 double fLibre = pDoc->GetValue(ScAddress(6,i,0));
1435 double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
1436 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1439 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialRRIFormula)
1441 initTestEnv(u"xls/opencl/financial/RRI.xls");
1442 ScDocument* pDoc = getScDoc();
1443 ScDocument* pDocRes = getScDoc2();
1444 pDoc->CalcAll();
1446 for (SCROW i = 0; i <= 9; ++i)
1448 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
1449 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
1450 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1453 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialEFFECT_ADDFormula)
1455 initTestEnv(u"xls/opencl/financial/EFFECT_ADD.xls");
1456 ScDocument* pDoc = getScDoc();
1457 ScDocument* pDocRes = getScDoc2();
1458 pDoc->CalcAll();
1460 for (SCROW i = 0; i <= 9; ++i)
1462 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
1463 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
1464 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1467 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialNominalFormula)
1469 initTestEnv(u"xls/opencl/financial/Nominal.xls");
1470 ScDocument* pDoc = getScDoc();
1471 ScDocument* pDocRes = getScDoc2();
1472 pDoc->CalcAll();
1475 // Check the results of formula cells in the shared formula range.
1476 for (SCROW i = 1; i <= 19; ++i)
1478 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
1479 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
1480 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1483 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialTBILLEQFormula)
1485 initTestEnv(u"xls/opencl/financial/TBILLEQ.xls");
1486 ScDocument* pDoc = getScDoc();
1487 ScDocument* pDocRes = getScDoc2();
1488 pDoc->CalcAll();
1490 for (SCROW i = 0; i <= 6; ++i)
1492 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
1493 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
1494 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1497 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialTBILLPRICEFormula)
1499 initTestEnv(u"xls/opencl/financial/TBILLPRICE.xls");
1500 ScDocument* pDoc = getScDoc();
1501 ScDocument* pDocRes = getScDoc2();
1502 pDoc->CalcAll();
1504 for (SCROW i = 0; i <= 6; ++i)
1506 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
1507 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
1508 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1511 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialTBILLYIELDFormula)
1513 initTestEnv(u"xls/opencl/financial/TBILLYIELD.xls");
1514 ScDocument* pDoc = getScDoc();
1515 ScDocument* pDocRes = getScDoc2();
1516 pDoc->CalcAll();
1518 for (SCROW i = 0; i <= 6; ++i)
1520 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
1521 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
1522 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1525 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialYIELDFormula)
1527 initTestEnv(u"xls/opencl/financial/YIELD.xls");
1528 ScDocument* pDoc = getScDoc();
1529 ScDocument* pDocRes = getScDoc2();
1530 pDoc->CalcAll();
1532 for (SCROW i = 0; i <= 6; ++i)
1534 double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
1535 double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
1536 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1540 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialYIELDDISCFormula)
1542 initTestEnv(u"xls/opencl/financial/YIELDDISC.xls");
1543 ScDocument* pDoc = getScDoc();
1544 ScDocument* pDocRes = getScDoc2();
1545 pDoc->CalcAll();
1547 for (SCROW i = 0; i <= 6; ++i)
1549 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
1550 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
1551 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1555 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialYIELDMATFormula)
1557 initTestEnv(u"xls/opencl/financial/YIELDMAT.xls");
1558 ScDocument* pDoc = getScDoc();
1559 ScDocument* pDocRes = getScDoc2();
1560 pDoc->CalcAll();
1562 for (SCROW i = 0; i <= 6; ++i)
1564 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1565 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1566 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1569 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialPMTFormula)
1571 initTestEnv(u"xls/opencl/financial/PMT.xls");
1572 ScDocument* pDoc = getScDoc();
1573 ScDocument* pDocRes = getScDoc2();
1574 pDoc->CalcAll();
1576 for (SCROW i = 0; i <= 6; ++i)
1578 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
1579 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
1580 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1584 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialDurationFormula)
1586 initTestEnv(u"ods/opencl/financial/Duration.ods");
1587 ScDocument* pDoc = getScDoc();
1588 ScDocument* pDocRes = getScDoc2();
1589 pDoc->CalcAll();
1591 for (SCROW i = 0; i <= 9; ++i)
1593 double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
1594 double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
1595 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1599 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaLogNormDist)
1601 initTestEnv(u"ods/opencl/statistical/LogNormDist.ods");
1602 ScDocument* pDoc = getScDoc();
1603 ScDocument* pDocRes = getScDoc2();
1604 pDoc->CalcAll();
1606 // Check the results of formula cells in the shared formula range.
1607 for (SCROW i = 1; i <= 19; ++i)
1609 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
1610 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
1611 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1615 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaArcCos)
1617 initTestEnv(u"ods/opencl/math/ArcCos.ods");
1618 ScDocument* pDoc = getScDoc();
1619 ScDocument* pDocRes = getScDoc2();
1620 pDoc->CalcAll();
1622 // Verify ACos Function
1623 for (SCROW i = 1; i <= 1000; ++i)
1625 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1626 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1627 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1631 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialPPMTFormula)
1633 initTestEnv(u"xls/opencl/financial/PPMT.xls");
1634 ScDocument* pDoc = getScDoc();
1635 ScDocument* pDocRes = getScDoc2();
1636 pDoc->CalcAll();
1638 for (SCROW i = 0; i <= 6; ++i)
1640 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1641 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1642 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1646 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialNPVFormula)
1648 initTestEnv(u"xls/opencl/financial/NPV.xls");
1649 ScDocument* pDoc = getScDoc();
1650 ScDocument* pDocRes = getScDoc2();
1651 pDoc->CalcAll();
1653 for (SCROW i = 0; i <= 6; ++i)
1655 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1656 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1657 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1661 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialDuration_ADDFormula)
1663 initTestEnv(u"xls/opencl/financial/Duration_ADD.xls");
1664 ScDocument* pDoc = getScDoc();
1665 ScDocument* pDocRes = getScDoc2();
1666 pDoc->CalcAll();
1668 for (SCROW i = 0; i <= 9; ++i)
1670 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1671 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1672 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1676 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaNorminv)
1678 initTestEnv(u"xls/opencl/statistical/Norminv.xls");
1679 ScDocument* pDoc = getScDoc();
1680 ScDocument* pDocRes = getScDoc2();
1681 pDoc->CalcAll();
1683 // Check the results of formula cells in the shared formula range.
1684 for (SCROW i = 1; i <= 19; ++i)
1686 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
1687 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
1688 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1692 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaNormsinv)
1694 initTestEnv(u"xls/opencl/statistical/Normsinv.xls");
1695 ScDocument* pDoc = getScDoc();
1696 ScDocument* pDocRes = getScDoc2();
1697 pDoc->CalcAll();
1699 // Check the results of formula cells in the shared formula range.
1700 for (SCROW i = 1; i <= 19; ++i)
1702 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1703 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1704 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1708 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaArcCosHyp)
1710 initTestEnv(u"ods/opencl/math/ArcCosHyp.ods");
1711 ScDocument* pDoc = getScDoc();
1712 ScDocument* pDocRes = getScDoc2();
1713 pDoc->CalcAll();
1715 // Verify ACosH Function
1716 for (SCROW i = 1; i <= 1000; ++i)
1718 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1719 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1720 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1724 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialMDurationFormula)
1726 initTestEnv(u"xls/opencl/financial/MDuration.xls");
1727 ScDocument* pDoc = getScDoc();
1728 ScDocument* pDocRes = getScDoc2();
1729 pDoc->CalcAll();
1731 for (SCROW i = 0; i <= 9; ++i)
1733 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1734 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1735 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1739 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaArcCot)
1741 initTestEnv(u"ods/opencl/math/ArcCot.ods");
1742 ScDocument* pDoc = getScDoc();
1743 ScDocument* pDocRes = getScDoc2();
1744 pDoc->CalcAll();
1746 // Verify ACot Function
1747 for (SCROW i = 1; i <= 1000; ++i)
1749 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1750 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1751 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1755 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialFVFormula)
1757 initTestEnv(u"xls/opencl/financial/FV.xls");
1758 ScDocument* pDoc = getScDoc();
1759 ScDocument* pDocRes = getScDoc2();
1760 pDoc->CalcAll();
1762 for (SCROW i = 0; i <= 9; ++i)
1764 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
1765 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
1766 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1770 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialDBFormula)
1772 initTestEnv(u"xls/opencl/financial/db.xls");
1773 ScDocument* pDoc = getScDoc();
1774 ScDocument* pDocRes = getScDoc2();
1775 pDoc->CalcAll();
1777 for (SCROW i = 0; i <= 9; ++i)
1779 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
1780 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
1781 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1785 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialCouppcdFormula)
1787 initTestEnv(u"xls/opencl/financial/Couppcd.xls");
1788 ScDocument* pDoc = getScDoc();
1789 ScDocument* pDocRes = getScDoc2();
1790 pDoc->CalcAll();
1792 for (SCROW i = 0; i <= 9; ++i)
1794 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
1795 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
1796 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1800 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathSumIfsFormula)
1802 initTestEnv(u"xls/opencl/math/sumifs.xls");
1803 ScDocument* pDoc = getScDoc();
1804 ScDocument* pDocRes = getScDoc2();
1805 ScDocShell* pDocSh = getScDocShell();
1806 pDocSh->DoHardRecalc();
1808 for (SCROW i = 2; i <= 11; ++i)
1810 double fLibre = pDoc->GetValue(ScAddress(5,i,0));
1811 double fExcel = pDocRes->GetValue(ScAddress(5,i,0));
1812 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1814 for (SCROW i = 2; i <= 11; ++i)
1816 double fLibre = pDoc->GetValue(ScAddress(6,i,0));
1817 double fExcel = pDocRes->GetValue(ScAddress(6,i,0));
1818 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1820 for (SCROW i = 2; i <= 11; ++i)
1822 double fLibre = pDoc->GetValue(ScAddress(7,i,0));
1823 double fExcel = pDocRes->GetValue(ScAddress(7,i,0));
1824 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1826 for (SCROW i = 2; i <= 11; ++i)
1828 double fLibre = pDoc->GetValue(ScAddress(8,i,0));
1829 double fExcel = pDocRes->GetValue(ScAddress(8,i,0));
1830 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1834 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaArcCotHyp)
1836 initTestEnv(u"ods/opencl/math/ArcCotHyp.ods");
1837 ScDocument* pDoc = getScDoc();
1838 ScDocument* pDocRes = getScDoc2();
1839 pDoc->CalcAll();
1841 // Verify ACotH Function
1842 for (SCROW i = 1; i <= 1000; ++i)
1844 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1845 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1846 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1850 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaArcSin)
1852 initTestEnv(u"ods/opencl/math/ArcSin.ods");
1853 ScDocument* pDoc = getScDoc();
1854 ScDocument* pDocRes = getScDoc2();
1855 pDoc->CalcAll();
1857 // Verify ACotH Function
1858 for (SCROW i = 1; i <= 1000; ++i)
1860 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1861 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1862 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1866 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialVDBFormula)
1868 initTestEnv(u"xls/opencl/financial/VDB.xls");
1869 ScDocument* pDoc = getScDoc();
1870 ScDocument* pDocRes = getScDoc2();
1871 pDoc->CalcAll();
1873 for (SCROW i = 0; i <= 10; ++i)
1875 double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
1876 double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
1877 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1879 for (SCROW i = 15; i <= 26; ++i)
1881 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1882 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1883 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1885 for (SCROW i = 30; i <= 41; ++i)
1887 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
1888 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
1889 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1893 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialIPMTFormula)
1895 initTestEnv(u"xls/opencl/financial/IPMT.xls");
1896 ScDocument* pDoc = getScDoc();
1897 ScDocument* pDocRes = getScDoc2();
1898 pDoc->CalcAll();
1900 for (SCROW i = 0; i <= 9; ++i)
1902 double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
1903 double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
1904 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1908 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaConfidence)
1910 initTestEnv(u"xls/opencl/statistical/Confidence.xls");
1911 ScDocument* pDoc = getScDoc();
1912 ScDocument* pDocRes = getScDoc2();
1913 pDoc->CalcAll();
1915 // Check the results of formula cells in the shared formula range.
1916 for (SCROW i = 0; i <= 9; ++i)
1918 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
1919 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
1920 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1924 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialCoupncdFormula)
1926 initTestEnv(u"xls/opencl/financial/Coupncd.xls");
1927 ScDocument* pDoc = getScDoc();
1928 ScDocument* pDocRes = getScDoc2();
1929 pDoc->CalcAll();
1931 for (SCROW i = 0; i <= 9; ++i)
1933 double fLibre = pDoc->GetValue(ScAddress(4, i, 0));
1934 double fExcel = pDocRes->GetValue(ScAddress(4, i, 0));
1935 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1939 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinancialAccrintFormula)
1941 initTestEnv(u"xls/opencl/financial/Accrint.xls");
1942 ScDocument* pDoc = getScDoc();
1943 ScDocument* pDocRes = getScDoc2();
1944 pDoc->CalcAll();
1946 for (SCROW i = 0; i <= 9; ++i)
1948 double fLibre = pDoc->GetValue(ScAddress(7, i, 0));
1949 double fExcel = pDocRes->GetValue(ScAddress(7, i, 0));
1950 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1954 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaCritBinom)
1956 initTestEnv(u"xls/opencl/statistical/CritBinom.xls");
1957 ScDocument* pDoc = getScDoc();
1958 ScDocument* pDocRes = getScDoc2();
1959 pDoc->CalcAll();
1961 // Check the results of formula cells in the shared formula range.
1962 for (SCROW i = 0; i <= 9; ++i)
1964 double fLibre = pDoc->GetValue(ScAddress(3,i,0));
1965 double fExcel = pDocRes->GetValue(ScAddress(3,i,0));
1966 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1970 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaArcSinHyp)
1972 initTestEnv(u"ods/opencl/math/ArcSinHyp.ods");
1973 ScDocument* pDoc = getScDoc();
1974 ScDocument* pDocRes = getScDoc2();
1975 pDoc->CalcAll();
1977 // Verify ASinH Function
1978 for (SCROW i = 1; i <= 1000; ++i)
1980 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1981 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1982 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
1986 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaArcTan)
1988 initTestEnv(u"ods/opencl/math/ArcTan.ods");
1989 ScDocument* pDoc = getScDoc();
1990 ScDocument* pDocRes = getScDoc2();
1991 pDoc->CalcAll();
1993 // Verify ATan Function
1994 for (SCROW i = 1; i <= 1000; ++i)
1996 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
1997 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
1998 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2002 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaArcTanHyp)
2004 initTestEnv(u"ods/opencl/math/ArcTanHyp.ods");
2005 ScDocument* pDoc = getScDoc();
2006 ScDocument* pDocRes = getScDoc2();
2007 pDoc->CalcAll();
2009 // Verify ATanH Function
2010 for (SCROW i = 1; i <= 1000; ++i)
2012 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
2013 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
2014 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2018 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testFinacialNPER1Formula)
2020 initTestEnv(u"xls/opencl/financial/NPER1.xls");
2021 ScDocument* pDoc = getScDoc();
2022 ScDocument* pDocRes = getScDoc2();
2023 pDoc->CalcAll();
2025 for (SCROW i = 0; i <= 6; ++i)
2027 double fLibre = pDoc->GetValue(ScAddress(5, i, 0));
2028 double fExcel = pDocRes->GetValue(ScAddress(5, i, 0));
2029 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2033 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaBitAnd)
2035 initTestEnv(u"ods/opencl/math/BitAnd.ods");
2036 ScDocument* pDoc = getScDoc();
2037 ScDocument* pDocRes = getScDoc2();
2038 pDoc->CalcAll();
2040 // Verify BitAnd Function
2041 for (SCROW i = 1; i <= 1000; ++i)
2043 double fLibre = pDoc->GetValue(ScAddress(2,i,0));
2044 double fExcel = pDocRes->GetValue(ScAddress(2,i,0));
2045 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2049 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaLN)
2051 initTestEnv(u"xls/opencl/math/LN.xls");
2052 ScDocument* pDoc = getScDoc();
2053 ScDocument* pDocRes = getScDoc2();
2054 pDoc->CalcAll();
2056 // Check the results of formula cells in the shared formula range.
2057 for (SCROW i = 1; i <= 9; ++i)
2059 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
2060 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
2061 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2065 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testMathFormulaRound)
2067 initTestEnv(u"xls/opencl/math/ROUND.xls");
2068 ScDocument* pDoc = getScDoc();
2069 ScDocument* pDocRes = getScDoc2();
2070 pDoc->CalcAll();
2072 // Check the results of formula cells in the shared formula range.
2073 for (SCROW i = 1; i <= 9; ++i)
2075 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
2076 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
2077 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2079 for (SCROW i = 15; i <= 25; ++i)
2081 double fLibre = pDoc->GetValue(ScAddress(1,i,0));
2082 double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
2083 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2087 CPPUNIT_TEST_FIXTURE(ScOpenCLTest1, testStatisticalFormulaGammaDist)
2089 initTestEnv(u"xls/opencl/statistical/GammaDist.xls");
2090 ScDocument* pDoc = getScDoc();
2091 ScDocument* pDocRes = getScDoc2();
2092 pDoc->CalcAll();
2094 // Check the results of formula cells in the shared formula range.
2095 for (SCROW i = 1; i <= 19; ++i)
2097 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
2098 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
2099 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
2103 ScOpenCLTest1::ScOpenCLTest1()
2104 : ScModelTestBase( "sc/qa/unit/data" )
2108 CPPUNIT_PLUGIN_IMPLEMENT();
2110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */