1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 #include <sal/config.h>
7 #include "helper/qahelper.hxx"
10 #include <document.hxx>
11 #include <formulagroup.hxx>
13 #include <com/sun/star/document/MacroExecMode.hpp>
14 #include <comphelper/sequence.hxx>
16 using namespace ::com::sun::star
;
17 using namespace ::com::sun::star::uno
;
20 : public ScModelTestBase
26 * Turn on OpenCL group interpreter. Call this after the document is
27 * loaded and before performing formula calculation.
32 void testSystematic();
33 void testSharedFormulaXLS();
35 void testSharedFormulaXLSGroundWater();
36 void testSharedFormulaXLSStockHistory();
38 void testFinacialFormula();
39 void testStatisticalFormulaFisher();
40 void testStatisticalFormulaFisherInv();
41 void testStatisticalFormulaGamma();
42 void testFinacialFvscheduleFormula();
43 // this test has intermittent failures on OSX
45 void testFinacialIRRFormula();
47 void testFinacialMIRRFormula();
48 void testFinacialRateFormula();
49 void testFinancialAccrintmFormula();
50 void testFinancialAccrintFormula();
51 void testCompilerHorizontal();
52 void testCompilerNested();
53 void testFinacialSLNFormula();
54 void testStatisticalFormulaGammaLn();
55 void testStatisticalFormulaGauss();
56 void testStatisticalFormulaGeoMean();
57 void testStatisticalFormulaHarMean();
58 void testFinancialCoupdaybsFormula();
59 void testFinacialDollardeFormula();
60 void testCompilerString();
61 void testCompilerInEq();
62 void testCompilerPrecision();
63 void testFinacialDollarfrFormula();
64 void testFinacialSYDFormula();
65 void testStatisticalFormulaCorrel();
66 void testFinancialCoupdaysFormula();
67 void testFinancialCoupdaysncFormula();
68 void testFinacialDISCFormula();
69 void testFinacialINTRATEFormula();
70 void testMathFormulaCos();
71 void testMathFormulaCsc();
72 void testStatisticalFormulaRsq();
73 void testStatisticalFormulaPearson();
74 void testStatisticalFormulaNegbinomdist();
75 void testFinacialXNPVFormula();
76 void testFinacialPriceMatFormula();
77 void testFinacialFormulaReceived();
78 void testFinancialFormulaCumipmt();
79 void testFinancialFormulaCumprinc();
80 void testFinacialRRIFormula();
81 void testFinacialEFFECT_ADDFormula();
82 void testFinacialNominalFormula();
83 void testFinacialTBILLEQFormula();
84 void testFinacialTBILLPRICEFormula();
85 void testFinacialTBILLYIELDFormula();
86 void testFinacialYIELDFormula();
87 void testFinacialYIELDDISCFormula();
88 void testFinacialYIELDMATFormula();
89 void testFinacialPMTFormula();
90 void testFinacialPPMTFormula();
91 void testFinancialISPMTFormula();
92 void testFinacialPriceFormula();
93 void testFinancialDurationFormula();
94 void testFinancialCoupnumFormula();
95 void testMathFormulaSinh();
96 void testMathFormulaAbs();
97 void testFinacialPVFormula();
98 void testMathFormulaSin();
99 void testMathFormulaTan();
100 void testMathFormulaTanH();
101 void testStatisticalFormulaStandard();
102 void testStatisticalFormulaWeibull();
103 void testStatisticalFormulaMedian();
104 void testFinancialDuration_ADDFormula();
105 void testFinancialAmordegrcFormula();
106 void testFinancialAmorlincFormula();
107 void testFinancialDDBFormula();
108 void testFinancialFVFormula();
109 void testFinancialMDurationFormula();
110 void testMathSumIfsFormula();
111 void testFinancialVDBFormula();
112 void testStatisticalFormulaKurt();
113 void testFinacialNPERFormula();
114 void testStatisticalFormulaNormdist();
115 void testMathFormulaArcCos();
116 void testMathFormulaSqrt();
117 void testMathFormulaArcCosHyp();
118 void testFinacialNPVFormula();
119 void testStatisticalFormulaNormsdist();
120 void testStatisticalFormulaNorminv();
121 void testStatisticalFormulaNormsinv();
122 void testStatisticalFormulaPermut();
123 void testStatisticalFormulaPermutation();
124 void testStatisticalFormulaPhi();
125 void testFinancialIPMTFormula();
126 void testStatisticalFormulaConfidence();
127 void testStatisticalFormulaIntercept();
128 void testFinacialODDLPRICEFormula();
129 void testFinacialOddlyieldFormula();
130 void testFinacialPriceDiscFormula();
131 void testFinancialDBFormula();
132 void testFinancialCouppcdFormula();
133 void testFinancialCoupncdFormula();
134 void testStatisticalFormulaLogInv();
135 void testMathFormulaArcCot();
136 void testMathFormulaCosh();
137 void testStatisticalFormulaCritBinom();
138 void testMathFormulaArcCotHyp();
139 void testMathFormulaArcSin();
140 void testMathFormulaArcSinHyp();
141 void testMathFormulaArcTan();
142 void testMathFormulaArcTanHyp();
143 void testMathFormulaBitAnd();
144 void testStatisticalFormulaForecast();
145 void testStatisticalFormulaLogNormDist();
146 void testStatisticalFormulaGammaDist();
147 void testMathFormulaLN();
148 void testMathFormulaRound();
149 void testMathFormulaCot();
150 void testMathFormulaCoth();
151 void testFinacialNPER1Formula();
153 CPPUNIT_TEST_SUITE(ScOpenCLTest1
);
154 CPPUNIT_TEST(testSystematic
);
155 CPPUNIT_TEST(testSharedFormulaXLS
);
156 CPPUNIT_TEST(testFinacialFormula
);
157 CPPUNIT_TEST(testStatisticalFormulaFisher
);
158 CPPUNIT_TEST(testStatisticalFormulaFisherInv
);
159 CPPUNIT_TEST(testStatisticalFormulaGamma
);
160 CPPUNIT_TEST(testFinacialFvscheduleFormula
);
161 // this test has intermittent failures on OSX
163 CPPUNIT_TEST(testFinacialIRRFormula
);
165 CPPUNIT_TEST(testFinacialMIRRFormula
);
166 CPPUNIT_TEST(testFinacialRateFormula
);
167 CPPUNIT_TEST(testCompilerHorizontal
);
168 CPPUNIT_TEST(testCompilerNested
);
169 CPPUNIT_TEST(testFinacialSLNFormula
);
170 CPPUNIT_TEST(testFinancialAccrintmFormula
);
171 CPPUNIT_TEST(testStatisticalFormulaGammaLn
);
172 CPPUNIT_TEST(testStatisticalFormulaGauss
);
173 CPPUNIT_TEST(testStatisticalFormulaGeoMean
);
174 CPPUNIT_TEST(testStatisticalFormulaHarMean
);
175 CPPUNIT_TEST(testFinancialCoupdaybsFormula
);
176 CPPUNIT_TEST(testFinacialDollardeFormula
);
177 CPPUNIT_TEST(testCompilerString
);
178 CPPUNIT_TEST(testCompilerInEq
);
179 CPPUNIT_TEST(testCompilerPrecision
);
180 CPPUNIT_TEST(testFinacialDollarfrFormula
);
181 CPPUNIT_TEST(testFinacialSYDFormula
);
182 CPPUNIT_TEST(testStatisticalFormulaCorrel
);
183 CPPUNIT_TEST(testFinancialCoupdaysFormula
);
184 CPPUNIT_TEST(testFinancialCoupdaysncFormula
);
185 CPPUNIT_TEST(testFinacialDISCFormula
);
186 CPPUNIT_TEST(testFinacialINTRATEFormula
);
187 CPPUNIT_TEST(testMathFormulaCos
);
188 CPPUNIT_TEST(testStatisticalFormulaNegbinomdist
);
189 CPPUNIT_TEST(testStatisticalFormulaRsq
);
190 CPPUNIT_TEST(testStatisticalFormulaPearson
);
191 CPPUNIT_TEST(testMathFormulaCsc
);
192 CPPUNIT_TEST(testFinacialPriceMatFormula
);
193 CPPUNIT_TEST(testFinacialXNPVFormula
);
194 CPPUNIT_TEST(testFinacialFormulaReceived
);
195 CPPUNIT_TEST(testFinancialFormulaCumipmt
);
196 CPPUNIT_TEST(testFinancialFormulaCumprinc
);
197 CPPUNIT_TEST(testFinacialRRIFormula
);
198 CPPUNIT_TEST(testFinacialEFFECT_ADDFormula
);
199 CPPUNIT_TEST(testFinacialNominalFormula
);
200 CPPUNIT_TEST(testFinacialTBILLEQFormula
);
201 CPPUNIT_TEST(testFinacialTBILLPRICEFormula
);
202 CPPUNIT_TEST(testFinacialTBILLYIELDFormula
);
203 CPPUNIT_TEST(testFinacialYIELDFormula
);
204 CPPUNIT_TEST(testFinacialYIELDDISCFormula
);
205 CPPUNIT_TEST(testFinacialYIELDMATFormula
);
206 CPPUNIT_TEST(testFinacialPPMTFormula
);
207 CPPUNIT_TEST(testFinacialPMTFormula
);
208 CPPUNIT_TEST(testFinancialISPMTFormula
);
209 CPPUNIT_TEST(testFinacialPriceFormula
);
210 CPPUNIT_TEST(testFinancialDurationFormula
);
211 CPPUNIT_TEST(testFinancialCoupnumFormula
);
212 CPPUNIT_TEST(testMathFormulaSinh
);
213 CPPUNIT_TEST(testMathFormulaAbs
);
214 CPPUNIT_TEST(testFinacialPVFormula
);
215 CPPUNIT_TEST(testMathFormulaSin
);
216 CPPUNIT_TEST(testMathFormulaTan
);
217 CPPUNIT_TEST(testMathFormulaTanH
);
218 CPPUNIT_TEST(testStatisticalFormulaStandard
);
219 CPPUNIT_TEST(testStatisticalFormulaWeibull
);
220 CPPUNIT_TEST(testStatisticalFormulaMedian
);
221 CPPUNIT_TEST(testFinancialDuration_ADDFormula
);
222 CPPUNIT_TEST(testFinancialAmordegrcFormula
);
223 CPPUNIT_TEST(testFinancialAmorlincFormula
);
224 CPPUNIT_TEST(testFinancialDDBFormula
);
225 CPPUNIT_TEST(testFinancialFVFormula
);
226 CPPUNIT_TEST(testFinancialMDurationFormula
);
227 CPPUNIT_TEST(testMathSumIfsFormula
);
228 CPPUNIT_TEST(testFinancialVDBFormula
);
229 CPPUNIT_TEST(testStatisticalFormulaKurt
);
230 CPPUNIT_TEST(testFinacialNPERFormula
);
231 CPPUNIT_TEST(testStatisticalFormulaNormdist
);
232 CPPUNIT_TEST(testMathFormulaArcCos
);
233 CPPUNIT_TEST(testMathFormulaSqrt
);
234 CPPUNIT_TEST(testMathFormulaArcCosHyp
);
235 CPPUNIT_TEST(testFinacialNPVFormula
);
236 CPPUNIT_TEST(testStatisticalFormulaNormsdist
);
237 CPPUNIT_TEST(testStatisticalFormulaNorminv
);
238 CPPUNIT_TEST(testStatisticalFormulaNormsinv
);
239 CPPUNIT_TEST(testStatisticalFormulaPermut
);
240 CPPUNIT_TEST(testStatisticalFormulaPermutation
);
241 CPPUNIT_TEST(testStatisticalFormulaPhi
);
242 CPPUNIT_TEST(testFinancialIPMTFormula
);
243 CPPUNIT_TEST(testStatisticalFormulaConfidence
);
244 CPPUNIT_TEST(testStatisticalFormulaIntercept
);
245 CPPUNIT_TEST(testFinacialODDLPRICEFormula
);
246 CPPUNIT_TEST(testFinacialOddlyieldFormula
);
247 CPPUNIT_TEST(testFinacialPriceDiscFormula
);
248 CPPUNIT_TEST(testFinancialDBFormula
);
249 CPPUNIT_TEST(testFinancialCouppcdFormula
);
250 CPPUNIT_TEST(testFinancialCoupncdFormula
);
251 CPPUNIT_TEST(testFinancialAccrintFormula
);
252 CPPUNIT_TEST(testStatisticalFormulaLogInv
);
253 CPPUNIT_TEST(testMathFormulaArcCot
);
254 CPPUNIT_TEST(testMathFormulaCosh
);
255 CPPUNIT_TEST(testStatisticalFormulaCritBinom
);
256 CPPUNIT_TEST(testMathFormulaArcCotHyp
);
257 CPPUNIT_TEST(testMathFormulaArcSin
);
258 CPPUNIT_TEST(testMathFormulaArcSinHyp
);
259 CPPUNIT_TEST(testMathFormulaArcTan
);
260 CPPUNIT_TEST(testMathFormulaArcTanHyp
);
261 CPPUNIT_TEST(testMathFormulaBitAnd
);
262 CPPUNIT_TEST(testStatisticalFormulaForecast
);
263 CPPUNIT_TEST(testStatisticalFormulaLogNormDist
);
264 CPPUNIT_TEST(testStatisticalFormulaGammaDist
);
265 CPPUNIT_TEST(testMathFormulaLN
);
266 CPPUNIT_TEST(testMathFormulaRound
);
267 CPPUNIT_TEST(testMathFormulaCot
);
268 CPPUNIT_TEST(testMathFormulaCoth
);
269 CPPUNIT_TEST(testFinacialNPER1Formula
);
270 CPPUNIT_TEST_SUITE_END();
273 void initTestEnv(std::u16string_view fileName
);
275 ScDocument
* getScDoc2();
278 void ScOpenCLTest1::initTestEnv(std::u16string_view fileName
)
280 // Some documents contain macros, disable them, otherwise
281 // the "Error, BASIC runtime error." dialog is prompted
282 // and it crashes in tearDown
283 std::vector
<beans::PropertyValue
> args
;
284 beans::PropertyValue aMacroValue
;
285 aMacroValue
.Name
= "MacroExecutionMode";
286 aMacroValue
.Handle
= -1;
287 aMacroValue
.Value
<<= document::MacroExecMode::NEVER_EXECUTE
;
288 aMacroValue
.State
= beans::PropertyState_DIRECT_VALUE
;
289 args
.push_back(aMacroValue
);
292 CPPUNIT_ASSERT(!ScCalcConfig::isOpenCLEnabled());
294 // Open the document with OpenCL disabled
295 mxComponent
= mxDesktop
->loadComponentFromURL(
296 createFileURL(fileName
), "_default", 0, comphelper::containerToSequence(args
));
299 CPPUNIT_ASSERT(ScCalcConfig::isOpenCLEnabled());
301 // it's not possible to open the same document twice, thus, create a temp file
302 createTempCopy(fileName
);
304 // Open the document with OpenCL enabled
305 mxComponent2
= mxDesktop
->loadComponentFromURL(
306 maTempFile
.GetURL(), "_default", 0, comphelper::containerToSequence(args
));
308 // Check there are 2 documents
309 uno::Reference
<frame::XFrames
> xFrames
= mxDesktop
->getFrames();
310 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(2), xFrames
->getCount());
313 ScDocument
* ScOpenCLTest1::getScDoc2()
315 ScModelObj
* pModelObj
= dynamic_cast<ScModelObj
*>(mxComponent2
.get());
316 CPPUNIT_ASSERT(pModelObj
);
317 return pModelObj
->GetDocument();
320 void ScOpenCLTest1::enableOpenCL()
322 sc::FormulaGroupInterpreter::enableOpenCL_UnitTestsOnly();
325 void ScOpenCLTest1::disableOpenCL()
327 sc::FormulaGroupInterpreter::disableOpenCL_UnitTestsOnly();
330 void ScOpenCLTest1::testCompilerHorizontal()
332 initTestEnv(u
"ods/opencl/compiler/horizontal.ods");
333 ScDocument
* pDoc
= getScDoc();
334 ScDocument
* pDocRes
= getScDoc2();
337 // Check the results of formula cells in the shared formula range.
338 for (SCROW i
= 1; i
< 5; ++i
)
340 double fLibre
= pDoc
->GetValue(ScAddress(12, i
, 0));
341 double fExcel
= pDocRes
->GetValue(ScAddress(12, i
, 0));
342 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
343 fLibre
= pDoc
->GetValue(ScAddress(13, i
, 0));
344 fExcel
= pDocRes
->GetValue(ScAddress(13, i
, 0));
345 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
346 fLibre
= pDoc
->GetValue(ScAddress(14, i
, 0));
347 fExcel
= pDocRes
->GetValue(ScAddress(14, i
, 0));
348 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
352 void ScOpenCLTest1::testCompilerNested()
354 initTestEnv(u
"ods/opencl/compiler/nested.ods");
355 ScDocument
* pDoc
= getScDoc();
356 ScDocument
* pDocRes
= getScDoc2();
359 // Check the results of formula cells in the shared formula range.
360 for (SCROW i
= 1; i
< 5; ++i
)
362 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
363 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
364 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
368 void ScOpenCLTest1::testCompilerString()
370 initTestEnv(u
"ods/opencl/compiler/string.ods");
371 ScDocument
* pDoc
= getScDoc();
372 ScDocument
* pDocRes
= getScDoc2();
375 // Check the results of formula cells in the shared formula range.
376 for (SCROW i
= 1; i
< 5; ++i
)
378 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
379 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
380 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
382 fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
383 fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
384 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
388 void ScOpenCLTest1::testCompilerInEq()
390 initTestEnv(u
"ods/opencl/compiler/ineq.ods");
391 ScDocument
* pDoc
= getScDoc();
392 ScDocument
* pDocRes
= getScDoc2();
395 // Check the results of formula cells in the shared formula range.
396 for (SCROW i
= 1; i
< 7; ++i
)
398 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
399 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
400 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
404 void ScOpenCLTest1::testCompilerPrecision()
406 initTestEnv(u
"ods/opencl/compiler/precision.ods");
407 ScDocument
* pDoc
= getScDoc();
408 ScDocument
* pDocRes
= getScDoc2();
409 // Check that values with and without opencl are the same/similar enough.
415 // Check the results of formula cells in the shared formula range.
416 for (SCROW i
= 1; i
< 3; ++i
)
418 double fOpenCL
= pDoc
->GetValue(ScAddress(0, i
, 0));
419 double fNormal
= pDocRes
->GetValue(ScAddress(0, i
, 0));
420 CPPUNIT_ASSERT_DOUBLES_EQUAL(fNormal
, fOpenCL
, fabs(1e-14*fOpenCL
));
425 void ScOpenCLTest1::testSharedFormulaXLSStockHistory()
427 initTestEnv(u
"xls/stock-history.xls");
428 ScDocument
* pDoc
= getScDoc();
429 ScDocument
* pDocRes
= getScDoc2();
430 ScDocShell
* pDocSh
= getScDocShell();
431 pDocSh
->DoHardRecalc();
433 // Check the results of formula cells in the shared formula range.
434 for (SCROW i
= 33; i
< 44; ++i
)
435 { // Cell H34:H44 in S&P 500 (tab 1)
436 double fLibre
= pDoc
->GetValue(ScAddress(7, i
, 1));
437 double fExcel
= pDocRes
->GetValue(ScAddress(7, i
, 1));
438 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, 0.0001*fExcel
);
441 for (SCROW i
= 33; i
< 44; ++i
)
442 { // Cell J34:J44 in S&P 500 (tab 1)
443 double fLibre
= pDoc
->GetValue(ScAddress(9, i
, 1));
444 double fExcel
= pDocRes
->GetValue(ScAddress(9, i
, 1));
445 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, 0.0001*fExcel
);
449 void ScOpenCLTest1::testSharedFormulaXLSGroundWater()
451 initTestEnv(u
"xls/ground-water-daily.xls");
452 ScDocument
* pDoc
= getScDoc();
453 ScDocument
* pDocRes
= getScDoc2();
454 ScDocShell
* pDocSh
= getScDocShell();
455 pDocSh
->DoHardRecalc();
457 // Check the results of formula cells in the shared formula range.
458 for (SCROW i
= 5; i
<= 77; ++i
)
460 double fLibre
= pDoc
->GetValue(ScAddress(11,i
,1));
461 double fExcel
= pDocRes
->GetValue(ScAddress(11,i
,1));
462 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
469 void ScOpenCLTest1::testSystematic()
471 initTestEnv(u
"xls/systematic.xls");
473 ScDocument
* pDoc
= getScDoc();
476 int nAVertBegin(0), nAVertEnd(0), nBVertBegin(0), nBVertEnd(0);
477 int nAHorEnd(0), nBHorEnd(0);
480 for (nRow
= 0; nRow
< 1000; ++nRow
)
482 if (pDoc
->GetString(ScAddress(0, nRow
, 0)) == "a")
484 nAVertBegin
= nRow
+ 1;
486 for (nCol
= 0; nCol
< 1000; ++nCol
)
488 if (pDoc
->GetString(ScAddress(nCol
, nRow
, 0)) != "a")
497 for (; nRow
< 1000; ++nRow
)
499 if (pDoc
->GetString(ScAddress(0, nRow
, 0)) != "a")
506 for (; nRow
< 1000; ++nRow
)
508 if (pDoc
->GetString(ScAddress(0, nRow
, 0)) == "b")
510 nBVertBegin
= nRow
+ 1;
512 for (nCol
= 0; nCol
< 1000; ++nCol
)
514 if (pDoc
->GetString(ScAddress(nCol
, nRow
, 0)) != "b")
523 for (; nRow
< 1000; ++nRow
)
525 if (pDoc
->GetString(ScAddress(0, nRow
, 0)) != "b")
532 CPPUNIT_ASSERT(nAVertBegin
!= 0);
533 CPPUNIT_ASSERT(nBVertBegin
!= 0);
534 CPPUNIT_ASSERT(nAVertEnd
> nAVertBegin
+ 100);
535 CPPUNIT_ASSERT(nBVertEnd
> nBVertBegin
+ 100);
536 CPPUNIT_ASSERT_EQUAL(nAVertEnd
-nAVertBegin
, nBVertEnd
-nBVertBegin
);
537 CPPUNIT_ASSERT(nAHorEnd
> 10);
538 CPPUNIT_ASSERT(nBHorEnd
> 10);
539 CPPUNIT_ASSERT_EQUAL(nAHorEnd
, nBHorEnd
);
541 for (SCROW i
= nAVertBegin
; i
< nAVertEnd
; ++i
)
543 for (int j
= 1; j
< nAHorEnd
; ++j
)
545 double fLibre
= pDoc
->GetValue(ScAddress(j
, i
, 0));
546 double fExcel
= pDoc
->GetValue(ScAddress(j
, nBVertBegin
+ (i
- nAVertBegin
), 0));
548 const OString sFailedMessage
=
549 OStringChar(static_cast<char>('A'+j
)) +
550 OString::number(i
+1) +
552 OStringChar(static_cast<char>('A'+j
)) +
553 OString::number(nBVertBegin
+(i
-nAVertBegin
)+1);
554 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(sFailedMessage
.getStr(), fExcel
, fLibre
, 1e-10);
560 void ScOpenCLTest1::testSharedFormulaXLS()
562 initTestEnv(u
"xls/sum_ex.xls");
563 ScDocument
* pDoc
= getScDoc();
564 ScDocument
* pDocRes
= getScDoc2();
567 // Check the results of formula cells in the shared formula range.
568 for (SCROW i
= 0; i
< 5; ++i
)
570 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
571 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
572 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
575 for (SCROW i
= 6; i
< 14; ++i
)
577 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
578 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
579 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
582 for (SCROW i
= 15; i
< 18; ++i
)
584 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
585 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
586 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
589 for (SCROW i
= 19; i
< 22; ++i
)
591 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
592 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
593 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
596 for (SCROW i
= 23; i
< 25; ++i
)
598 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
599 //double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
600 // There seems to be a bug in LibreOffice beta
601 ASSERT_DOUBLES_EQUAL(/*fExcel*/ 60.0, fLibre
);
604 for (SCROW i
= 25; i
< 27; ++i
)
606 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
607 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
608 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
611 for (SCROW i
= 28; i
< 35; ++i
)
613 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
614 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
615 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
618 // workaround for a Calc beta bug
619 ASSERT_DOUBLES_EQUAL(25.0, pDoc
->GetValue(ScAddress(2, 35, 0)));
620 ASSERT_DOUBLES_EQUAL(24.0, pDoc
->GetValue(ScAddress(2, 36, 0)));
622 for (SCROW i
= 38; i
< 43; ++i
)
624 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
625 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
626 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
629 for (SCROW i
= 5; i
< 10; ++i
)
631 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 1));
632 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 1));
633 ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
);
636 for (SCROW i
= 5; i
< 10; ++i
)
638 for (SCCOL j
= 6; j
< 11; ++j
)
640 double fLibre
= pDoc
->GetValue(ScAddress(j
, i
, 1));
641 double fExcel
= pDocRes
->GetValue(ScAddress(j
, i
, 1));
642 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
,
643 fabs(fExcel
*0.0001));
648 void ScOpenCLTest1::testMathFormulaCos()
650 initTestEnv(u
"xls/opencl/math/cos.xls");
651 ScDocument
* pDoc
= getScDoc();
652 ScDocument
* pDocRes
= getScDoc2();
655 for (SCROW i
= 0; i
<= 15; ++i
)
657 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
658 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
659 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
663 void ScOpenCLTest1::testMathFormulaSinh()
665 initTestEnv(u
"xls/opencl/math/sinh.xls");
666 ScDocument
* pDoc
= getScDoc();
667 ScDocument
* pDocRes
= getScDoc2();
668 ScDocShell
* pDocSh
= getScDocShell();
669 pDocSh
->DoHardRecalc();
671 for (SCROW i
= 0; i
<= 15; ++i
)
673 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
674 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
675 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
679 void ScOpenCLTest1::testFinacialFormula()
681 initTestEnv(u
"xls/opencl/financial/general.xls");
682 ScDocument
* pDoc
= getScDoc();
683 ScDocument
* pDocRes
= getScDoc2();
686 // Check the results of formula cells in the shared formula range.
687 for (SCROW i
= 1; i
<= 10; ++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
));
694 for (SCROW i
= 1; i
<= 10; ++i
)
696 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,1));
697 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,1));
698 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
701 for (SCROW i
= 1; i
<= 10; ++i
)
703 double fLibre
= pDoc
->GetValue(ScAddress(2,i
,2));
704 double fExcel
= pDocRes
->GetValue(ScAddress(2,i
,2));
705 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
708 for (SCROW i
= 1; i
<= 10; ++i
)
710 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,3));
711 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,3));
712 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
715 for (SCROW i
= 0; i
<= 9; ++i
)
717 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,4));
718 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,4));
719 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
722 for (SCROW i
= 0; i
<= 9; ++i
)
724 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,5));
725 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,5));
726 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
729 for (SCROW i
= 0; i
< 10; ++i
)
731 double fLibre
= pDoc
->GetValue(ScAddress(5,i
,6));
732 double fExcel
= pDocRes
->GetValue(ScAddress(5,i
,6));
733 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
736 for (SCROW i
= 1; i
<= 9; ++i
)
738 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,7));
739 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,7));
740 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
743 for (SCROW i
= 1; i
<= 10; ++i
)
745 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,8));
746 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,8));
747 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
750 for (SCROW i
= 1; i
<= 9; ++i
)
752 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,9));
753 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,9));
754 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
757 for (SCROW i
= 1; i
<= 10; ++i
)
759 double fLibre
= pDoc
->GetValue(ScAddress(2,i
,10));
760 double fExcel
= pDocRes
->GetValue(ScAddress(2,i
,10));
761 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
764 for (SCROW i
= 1; i
<= 10; ++i
)
766 double fLibre
= pDoc
->GetValue(ScAddress(7,i
,11));
767 double fExcel
= pDocRes
->GetValue(ScAddress(7,i
,11));
768 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
771 for (SCROW i
= 1; i
<= 10; ++i
)
773 double fLibre
= pDoc
->GetValue(ScAddress(5,i
,12));
774 double fExcel
= pDocRes
->GetValue(ScAddress(5,i
,12));
775 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
778 for (SCROW i
= 0; i
<= 12; ++i
)
780 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,13));
781 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,13));
782 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
785 for (SCROW i
= 1; i
<= 10; ++i
)
787 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,14));
788 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,14));
789 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
792 for (SCROW i
= 1; i
<= 10; ++i
)
794 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,15));
795 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,15));
796 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
799 for (SCROW i
= 1; i
<= 10; ++i
)
801 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,16));
802 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,16));
803 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
806 for (SCROW i
= 1; i
<= 5; ++i
)
808 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,17));
809 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,17));
810 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
813 for (SCROW i
= 0; i
<= 10; ++i
)
815 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,18));
816 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,18));
817 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
820 for (SCROW i
= 0; i
<= 18; ++i
)
822 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,19));
823 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,19));
824 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
828 void ScOpenCLTest1::testStatisticalFormulaCorrel()
830 initTestEnv(u
"ods/opencl/statistical/Correl.ods");
831 ScDocument
* pDoc
= getScDoc();
832 ScDocument
* pDocRes
= getScDoc2();
835 // Check the results of formula cells in the shared formula range.
836 for (SCROW i
= 1; i
<= 20; ++i
)
838 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
839 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
840 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
843 void ScOpenCLTest1::testStatisticalFormulaFisher()
845 initTestEnv(u
"xls/opencl/statistical/Fisher.xls");
846 ScDocument
* pDoc
= getScDoc();
847 ScDocument
* pDocRes
= getScDoc2();
850 // Check the results of formula cells in the shared formula range.
851 for (SCROW i
= 1; i
<= 19; ++i
)
853 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
854 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
855 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
859 void ScOpenCLTest1::testStatisticalFormulaFisherInv()
861 initTestEnv(u
"xls/opencl/statistical/FisherInv.xls");
862 ScDocument
* pDoc
= getScDoc();
863 ScDocument
* pDocRes
= getScDoc2();
866 // Check the results of formula cells in the shared formula range.
867 for (SCROW i
= 1; i
<= 19; ++i
)
869 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
870 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
871 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
875 void ScOpenCLTest1::testStatisticalFormulaGamma()
877 initTestEnv(u
"xls/opencl/statistical/Gamma.xls");
878 ScDocument
* pDoc
= getScDoc();
879 ScDocument
* pDocRes
= getScDoc2();
882 // Check the results of formula cells in the shared formula range.
883 for (SCROW i
= 1; i
<= 19; ++i
)
885 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
886 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
887 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
891 void ScOpenCLTest1::testFinacialFvscheduleFormula()
893 initTestEnv(u
"xls/opencl/financial/Fvschedule.xls");
894 ScDocument
* pDoc
= getScDoc();
895 ScDocument
* pDocRes
= getScDoc2();
898 for (SCROW i
= 0; i
<= 9; ++i
)
900 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
901 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
902 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
906 void ScOpenCLTest1::testMathFormulaAbs()
908 initTestEnv(u
"ods/opencl/math/Abs.ods");
909 ScDocument
* pDoc
= getScDoc();
910 ScDocument
* pDocRes
= getScDoc2();
913 // Verify ABS Function
914 for (SCROW i
= 1; i
<= 1000; ++i
)
916 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
917 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
918 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
922 void ScOpenCLTest1::testFinacialSYDFormula()
924 initTestEnv(u
"xls/opencl/financial/SYD.xls");
925 ScDocument
* pDoc
= getScDoc();
926 ScDocument
* pDocRes
= getScDoc2();
929 for (SCROW i
= 0; i
<= 9; ++i
)
931 double fLibre
= pDoc
->GetValue(ScAddress(4, i
, 0));
932 double fExcel
= pDocRes
->GetValue(ScAddress(4, i
, 0));
933 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
937 // this test has intermittent failures on OSX
939 void ScOpenCLTest1::testFinacialIRRFormula()
941 initTestEnv(u
"xls/opencl/financial/IRR.xls");
942 ScDocument
* pDoc
= getScDoc();
943 ScDocument
* pDocRes
= getScDoc2();
946 for (SCROW i
= 0; i
<= 6; ++i
)
948 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
949 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
950 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
955 void ScOpenCLTest1::testStatisticalFormulaGammaLn()
957 initTestEnv(u
"xls/opencl/statistical/GammaLn.xls");
958 ScDocument
* pDoc
= getScDoc();
959 ScDocument
* pDocRes
= getScDoc2();
962 // Check the results of formula cells in the shared formula range.
963 for (SCROW i
= 1; i
<= 19; ++i
)
965 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
966 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
967 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
971 void ScOpenCLTest1::testStatisticalFormulaGauss()
973 initTestEnv(u
"xls/opencl/statistical/Gauss.xls");
974 ScDocument
* pDoc
= getScDoc();
975 ScDocument
* pDocRes
= getScDoc2();
978 // Check the results of formula cells in the shared formula range.
979 for (SCROW i
= 1; i
<= 19; ++i
)
981 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
982 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
983 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
987 void ScOpenCLTest1::testStatisticalFormulaGeoMean()
989 initTestEnv(u
"xls/opencl/statistical/GeoMean.xls");
990 ScDocument
* pDoc
= getScDoc();
991 ScDocument
* pDocRes
= getScDoc2();
994 // Check the results of formula cells in the shared formula range.
995 for (SCROW i
= 1; i
<= 19; ++i
)
997 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
998 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
999 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1003 void ScOpenCLTest1::testStatisticalFormulaHarMean()
1005 initTestEnv(u
"xls/opencl/statistical/HarMean.xls");
1006 ScDocument
* pDoc
= getScDoc();
1007 ScDocument
* pDocRes
= getScDoc2();
1010 // Check the results of formula cells in the shared formula range.
1011 for (SCROW i
= 1; i
<= 19; ++i
)
1013 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1014 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1015 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1019 void ScOpenCLTest1::testFinacialSLNFormula()
1021 initTestEnv(u
"xls/opencl/financial/SLN.xls");
1022 ScDocument
* pDoc
= getScDoc();
1023 ScDocument
* pDocRes
= getScDoc2();
1026 for (SCROW i
= 0; i
<= 9; ++i
)
1028 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1029 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1030 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1034 void ScOpenCLTest1::testFinacialMIRRFormula()
1036 initTestEnv(u
"xls/opencl/financial/MIRR.xls");
1037 ScDocument
* pDoc
= getScDoc();
1038 ScDocument
* pDocRes
= getScDoc2();
1041 for (SCROW i
= 0; i
<= 6; ++i
)
1043 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1044 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1045 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1049 void ScOpenCLTest1::testFinancialCoupdaybsFormula()
1051 initTestEnv(u
"xls/opencl/financial/Coupdaybs.xls");
1052 ScDocument
* pDoc
= getScDoc();
1053 ScDocument
* pDocRes
= getScDoc2();
1056 for (SCROW i
= 1; i
<=10; ++i
)
1058 double fLibre
= pDoc
->GetValue(ScAddress(4, i
, 0));
1059 double fExcel
= pDocRes
->GetValue(ScAddress(4, i
, 0));
1060 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1064 void ScOpenCLTest1::testFinacialDollardeFormula()
1066 initTestEnv(u
"xls/opencl/financial/Dollarde.xls");
1067 ScDocument
* pDoc
= getScDoc();
1068 ScDocument
* pDocRes
= getScDoc2();
1071 for (SCROW i
= 0; i
<= 9; ++i
)
1073 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
1074 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
1075 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1079 void ScOpenCLTest1::testFinancialCoupdaysFormula()
1081 initTestEnv(u
"xls/opencl/financial/Coupdays.xls");
1082 ScDocument
* pDoc
= getScDoc();
1083 ScDocument
* pDocRes
= getScDoc2();
1086 for (SCROW i
= 1; i
<=10; ++i
)
1088 double fLibre
= pDoc
->GetValue(ScAddress(4, i
, 0));
1089 double fExcel
= pDocRes
->GetValue(ScAddress(4, i
, 0));
1090 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1095 void ScOpenCLTest1::testFinancialCoupdaysncFormula()
1097 initTestEnv(u
"xls/opencl/financial/Coupdaysnc.xls");
1098 ScDocument
* pDoc
= getScDoc();
1099 ScDocument
* pDocRes
= getScDoc2();
1102 for (SCROW i
= 1; i
<=10; ++i
)
1104 double fLibre
= pDoc
->GetValue(ScAddress(4, i
, 0));
1105 double fExcel
= pDocRes
->GetValue(ScAddress(4, i
, 0));
1106 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1109 void ScOpenCLTest1::testFinacialRateFormula()
1111 initTestEnv(u
"xls/opencl/financial/RATE.xls");
1112 ScDocument
* pDoc
= getScDoc();
1113 ScDocument
* pDocRes
= getScDoc2();
1116 for (SCROW i
= 1; i
<= 5; ++i
)
1118 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
1119 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
1120 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1124 void ScOpenCLTest1::testFinancialAccrintmFormula()
1126 initTestEnv(u
"xls/opencl/financial/Accrintm.xls");
1127 ScDocument
* pDoc
= getScDoc();
1128 ScDocument
* pDocRes
= getScDoc2();
1131 for (SCROW i
= 1; i
<= 10; ++i
)
1133 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
1134 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
1135 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1139 void ScOpenCLTest1::testFinancialCoupnumFormula()
1141 initTestEnv(u
"xls/opencl/financial/Coupnum.xls");
1142 ScDocument
* pDoc
= getScDoc();
1143 ScDocument
* pDocRes
= getScDoc2();
1146 for (SCROW i
= 0; i
<= 9; ++i
)
1148 double fLibre
= pDoc
->GetValue(ScAddress(4, i
, 0));
1149 double fExcel
= pDocRes
->GetValue(ScAddress(4, i
, 0));
1150 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1154 void ScOpenCLTest1::testStatisticalFormulaNegbinomdist()
1156 initTestEnv(u
"xls/opencl/statistical/Negbinomdist.xls");
1157 ScDocument
* pDoc
= getScDoc();
1158 ScDocument
* pDocRes
= getScDoc2();
1161 // Check the results of formula cells in the shared formula range.
1162 for (SCROW i
= 0; i
<= 9; ++i
)
1164 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,0));
1165 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,0));
1166 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1170 void ScOpenCLTest1::testMathFormulaSin()
1172 initTestEnv(u
"xls/opencl/math/sin.xls");
1173 ScDocument
* pDoc
= getScDoc();
1174 ScDocument
* pDocRes
= getScDoc2();
1177 for (SCROW i
= 0; i
<= 15; ++i
)
1179 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1180 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1181 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1185 void ScOpenCLTest1::testMathFormulaTan()
1187 initTestEnv(u
"xls/opencl/math/tan.xls");
1188 ScDocument
* pDoc
= getScDoc();
1189 ScDocument
* pDocRes
= getScDoc2();
1192 for (SCROW i
= 0; i
<= 15; ++i
)
1194 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1195 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1196 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1200 void ScOpenCLTest1::testMathFormulaTanH()
1202 initTestEnv(u
"xls/opencl/math/tanh.xls");
1203 ScDocument
* pDoc
= getScDoc();
1204 ScDocument
* pDocRes
= getScDoc2();
1207 for (SCROW i
= 0; i
<= 15; ++i
)
1209 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1210 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1211 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1215 void ScOpenCLTest1::testMathFormulaSqrt()
1217 initTestEnv(u
"xls/opencl/math/sqrt.xls");
1218 ScDocument
* pDoc
= getScDoc();
1219 ScDocument
* pDocRes
= getScDoc2();
1222 for (SCROW i
= 0; i
<= 15; ++i
)
1224 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1225 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1226 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1230 void ScOpenCLTest1::testFinacialPriceFormula()
1232 initTestEnv(u
"xls/opencl/financial/Price.xls");
1233 ScDocument
* pDoc
= getScDoc();
1234 ScDocument
* pDocRes
= getScDoc2();
1237 for (SCROW i
= 1; i
<= 10; ++i
)
1239 double fLibre
= pDoc
->GetValue(ScAddress(7, i
, 0));
1240 double fExcel
= pDocRes
->GetValue(ScAddress(7, i
, 0));
1241 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1245 void ScOpenCLTest1::testFinacialDollarfrFormula()
1247 initTestEnv(u
"xls/opencl/financial/Dollarfr.xls");
1248 ScDocument
* pDoc
= getScDoc();
1249 ScDocument
* pDocRes
= getScDoc2();
1252 for (SCROW i
= 0; i
<= 9; ++i
)
1254 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
1255 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
1256 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1260 void ScOpenCLTest1::testFinacialPriceDiscFormula()
1262 initTestEnv(u
"xls/opencl/financial/PriceDisc.xls");
1263 ScDocument
* pDoc
= getScDoc();
1264 ScDocument
* pDocRes
= getScDoc2();
1267 for (SCROW i
= 0; i
<= 10; ++i
)
1269 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
1270 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
1271 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1275 void ScOpenCLTest1::testFinacialODDLPRICEFormula()
1277 initTestEnv(u
"xls/opencl/financial/Oddlprice.xls");
1278 ScDocument
* pDoc
= getScDoc();
1279 ScDocument
* pDocRes
= getScDoc2();
1282 for (SCROW i
= 1; i
<= 10; ++i
)
1284 double fLibre
= pDoc
->GetValue(ScAddress(8, i
, 0));
1285 double fExcel
= pDocRes
->GetValue(ScAddress(8, i
, 0));
1286 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1290 void ScOpenCLTest1:: testFinacialOddlyieldFormula()
1292 initTestEnv(u
"xls/opencl/financial/Oddlyield.xls");
1293 ScDocument
* pDoc
= getScDoc();
1294 ScDocument
* pDocRes
= getScDoc2();
1297 for (SCROW i
= 0; i
<= 6; ++i
)
1299 double fLibre
= pDoc
->GetValue(ScAddress(8, i
, 0));
1300 double fExcel
= pDocRes
->GetValue(ScAddress(8, i
, 0));
1301 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1305 void ScOpenCLTest1::testFinacialDISCFormula()
1307 initTestEnv(u
"xls/opencl/financial/DISC.xls");
1308 ScDocument
* pDoc
= getScDoc();
1309 ScDocument
* pDocRes
= getScDoc2();
1312 for (SCROW i
= 0; i
<= 9; ++i
)
1314 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
1315 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
1316 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1320 void ScOpenCLTest1:: testFinacialPVFormula()
1322 initTestEnv(u
"xls/opencl/financial/PV.xls");
1323 ScDocument
* pDoc
= getScDoc();
1324 ScDocument
* pDocRes
= getScDoc2();
1327 for (SCROW i
= 0; i
<= 9; ++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 void ScOpenCLTest1::testFinacialINTRATEFormula()
1337 initTestEnv(u
"xls/opencl/financial/INTRATE.xls");
1338 ScDocument
* pDoc
= getScDoc();
1339 ScDocument
* pDocRes
= getScDoc2();
1342 for (SCROW i
= 0; i
<= 9; ++i
)
1344 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
1345 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
1346 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1350 void ScOpenCLTest1::testStatisticalFormulaStandard()
1352 initTestEnv(u
"xls/opencl/statistical/Standard.xls");
1353 ScDocument
* pDoc
= getScDoc();
1354 ScDocument
* pDocRes
= getScDoc2();
1357 // Check the results of formula cells in the shared formula range.
1358 for (SCROW i
= 1; i
<= 20; ++i
)
1360 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,0));
1361 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,0));
1362 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1366 void ScOpenCLTest1::testStatisticalFormulaWeibull()
1368 initTestEnv(u
"xls/opencl/statistical/Weibull.xls");
1369 ScDocument
* pDoc
= getScDoc();
1370 ScDocument
* pDocRes
= getScDoc2();
1373 // Check the results of formula cells in the shared formula range.
1374 for (SCROW i
= 1; i
<= 20; ++i
)
1376 double fLibre
= pDoc
->GetValue(ScAddress(4,i
,0));
1377 double fExcel
= pDocRes
->GetValue(ScAddress(4,i
,0));
1378 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
,
1379 fExcel
== 0?1e-4:fabs(1e-4*fExcel
));
1383 void ScOpenCLTest1::testStatisticalFormulaPearson()
1385 initTestEnv(u
"xls/opencl/statistical/Pearson.xls");
1386 ScDocument
* pDoc
= getScDoc();
1387 ScDocument
* pDocRes
= getScDoc2();
1390 // Check the results of formula cells in the shared formula range.
1391 for (SCROW i
= 1; i
<= 9; ++i
)
1393 double fLibre
= pDoc
->GetValue(ScAddress(2,i
,0));
1394 double fExcel
= pDocRes
->GetValue(ScAddress(2,i
,0));
1395 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1399 void ScOpenCLTest1::testStatisticalFormulaRsq()
1401 initTestEnv(u
"xls/opencl/statistical/Rsq.xls");
1402 ScDocument
* pDoc
= getScDoc();
1403 ScDocument
* pDocRes
= getScDoc2();
1406 // Check the results of formula cells in the shared formula range.
1407 for (SCROW i
= 1; i
<= 9; ++i
)
1409 double fLibre
= pDoc
->GetValue(ScAddress(2,i
,0));
1410 double fExcel
= pDocRes
->GetValue(ScAddress(2,i
,0));
1411 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1415 void ScOpenCLTest1::testMathFormulaCosh()
1417 initTestEnv(u
"xls/opencl/math/cosh.xls");
1418 ScDocument
* pDoc
= getScDoc();
1419 ScDocument
* pDocRes
= getScDoc2();
1422 for (SCROW i
= 0; i
<= 15; ++i
)
1424 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1425 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1426 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1430 void ScOpenCLTest1::testStatisticalFormulaKurt()
1432 initTestEnv(u
"xls/opencl/statistical/Kurt.xls");
1433 ScDocument
* pDoc
= getScDoc();
1434 ScDocument
* pDocRes
= getScDoc2();
1437 // Check the results of formula cells in the shared formula range.
1438 for (SCROW i
= 1; i
<= 19; ++i
)
1440 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1441 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1442 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1446 void ScOpenCLTest1::testMathFormulaCot()
1448 initTestEnv(u
"ods/opencl/math/cot.ods");
1449 ScDocument
* pDoc
= getScDoc();
1450 ScDocument
* pDocRes
= getScDoc2();
1453 for (SCROW i
= 0; i
<= 15; ++i
)
1455 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1456 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1457 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1461 void ScOpenCLTest1::testMathFormulaCsc()
1463 initTestEnv(u
"ods/opencl/math/csc.ods");
1464 ScDocument
* pDoc
= getScDoc();
1465 ScDocument
* pDocRes
= getScDoc2();
1468 for (SCROW i
= 0; i
<= 15; ++i
)
1470 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1471 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1472 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1476 void ScOpenCLTest1::testMathFormulaCoth()
1478 initTestEnv(u
"ods/opencl/math/coth.ods");
1479 ScDocument
* pDoc
= getScDoc();
1480 ScDocument
* pDocRes
= getScDoc2();
1483 for (SCROW i
= 0; i
<= 15; ++i
)
1485 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1486 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1487 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1491 void ScOpenCLTest1::testFinacialXNPVFormula()
1493 initTestEnv(u
"xls/opencl/financial/XNPV.xls");
1494 ScDocument
* pDoc
= getScDoc();
1495 ScDocument
* pDocRes
= getScDoc2();
1498 for (SCROW i
= 1; i
<= 9; ++i
)
1500 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1501 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1502 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1505 for (SCROW i
= 16; i
<= 26; ++i
)
1507 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1508 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1509 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1513 void ScOpenCLTest1::testStatisticalFormulaIntercept()
1515 initTestEnv(u
"xls/opencl/statistical/Intercept.xls");
1516 ScDocument
* pDoc
= getScDoc();
1517 ScDocument
* pDocRes
= getScDoc2();
1520 for (SCROW i
= 1; i
<= 19; ++i
)
1522 double fLibre
= pDoc
->GetValue(ScAddress(2,i
,0));
1523 double fExcel
= pDocRes
->GetValue(ScAddress(2,i
,0));
1524 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1528 void ScOpenCLTest1::testFinancialAmordegrcFormula()
1530 initTestEnv(u
"xls/opencl/financial/Amordegrc.xls");
1531 ScDocument
* pDoc
= getScDoc();
1532 ScDocument
* pDocRes
= getScDoc2();
1535 for (SCROW i
= 0; i
<= 9; ++i
)
1537 double fLibre
= pDoc
->GetValue(ScAddress(7, i
, 0));
1538 double fExcel
= pDocRes
->GetValue(ScAddress(7, i
, 0));
1539 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1543 void ScOpenCLTest1:: testFinancialISPMTFormula()
1545 initTestEnv(u
"xls/opencl/financial/ISPMT.xls");
1546 ScDocument
* pDoc
= getScDoc();
1547 ScDocument
* pDocRes
= getScDoc2();
1550 for (SCROW i
= 0; i
<= 9; ++i
)
1552 double fLibre
= pDoc
->GetValue(ScAddress(4, i
, 0));
1553 double fExcel
= pDocRes
->GetValue(ScAddress(4, i
, 0));
1554 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1558 void ScOpenCLTest1::testStatisticalFormulaMedian()
1560 initTestEnv(u
"xls/opencl/statistical/Median.xls");
1561 ScDocument
* pDoc
= getScDoc();
1562 ScDocument
* pDocRes
= getScDoc2();
1565 // Check the results of formula cells in the shared formula range.
1566 for (SCROW i
= 1; i
<= 9; ++i
)
1568 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1569 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1570 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1574 void ScOpenCLTest1::testStatisticalFormulaNormdist()
1576 initTestEnv(u
"xls/opencl/statistical/Normdist.xls");
1577 ScDocument
* pDoc
= getScDoc();
1578 ScDocument
* pDocRes
= getScDoc2();
1581 // Check the results of formula cells in the shared formula range.
1582 for (SCROW i
= 1; i
<= 19; ++i
)
1584 double fLibre
= pDoc
->GetValue(ScAddress(4,i
,0));
1585 double fExcel
= pDocRes
->GetValue(ScAddress(4,i
,0));
1586 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1590 void ScOpenCLTest1::testStatisticalFormulaNormsdist()
1592 initTestEnv(u
"xls/opencl/statistical/Normsdist.xls");
1593 ScDocument
* pDoc
= getScDoc();
1594 ScDocument
* pDocRes
= getScDoc2();
1597 // Check the results of formula cells in the shared formula range.
1598 for (SCROW i
= 1; i
<= 19; ++i
)
1600 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1601 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1602 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1606 void ScOpenCLTest1::testStatisticalFormulaPermut()
1608 initTestEnv(u
"xls/opencl/statistical/Permut.xls");
1609 ScDocument
* pDoc
= getScDoc();
1610 ScDocument
* pDocRes
= getScDoc2();
1613 // Check the results of formula cells in the shared formula range.
1614 for (SCROW i
= 1; i
<= 19; ++i
)
1616 double fLibre
= pDoc
->GetValue(ScAddress(2,i
,0));
1617 double fExcel
= pDocRes
->GetValue(ScAddress(2,i
,0));
1618 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1622 void ScOpenCLTest1::testStatisticalFormulaPermutation()
1624 initTestEnv(u
"xls/opencl/statistical/Permutation.xls");
1625 ScDocument
* pDoc
= getScDoc();
1626 ScDocument
* pDocRes
= getScDoc2();
1629 // Check the results of formula cells in the shared formula range.
1630 for (SCROW i
= 1; i
<= 9; ++i
)
1632 double fLibre
= pDoc
->GetValue(ScAddress(2,i
,0));
1633 double fExcel
= pDocRes
->GetValue(ScAddress(2,i
,0));
1634 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1638 void ScOpenCLTest1::testStatisticalFormulaPhi()
1640 initTestEnv(u
"xls/opencl/statistical/Phi.xls");
1641 ScDocument
* pDoc
= getScDoc();
1642 ScDocument
* pDocRes
= getScDoc2();
1645 // Check the results of formula cells in the shared formula range.
1646 for (SCROW i
= 1; i
<= 19; ++i
)
1648 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1649 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1650 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1654 void ScOpenCLTest1::testStatisticalFormulaLogInv()
1656 initTestEnv(u
"xls/opencl/statistical/LogInv.xls");
1657 ScDocument
* pDoc
= getScDoc();
1658 ScDocument
* pDocRes
= getScDoc2();
1661 // Check the results of formula cells in the shared formula range.
1662 for (SCROW i
= 1; i
<= 19; ++i
)
1664 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,0));
1665 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,0));
1666 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1670 void ScOpenCLTest1::testFinacialNPERFormula()
1672 initTestEnv(u
"xls/opencl/financial/NPER.xls");
1673 ScDocument
* pDoc
= getScDoc();
1674 ScDocument
* pDocRes
= getScDoc2();
1677 for (SCROW i
= 0; i
<= 10; ++i
)
1679 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
1680 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
1681 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1685 void ScOpenCLTest1::testStatisticalFormulaForecast()
1687 initTestEnv(u
"xls/opencl/statistical/Forecast.xls");
1688 ScDocument
* pDoc
= getScDoc();
1689 ScDocument
* pDocRes
= getScDoc2();
1692 // Check the results of formula cells in the shared formula range.
1693 for (SCROW i
= 1; i
<= 19; ++i
)
1695 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,0));
1696 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,0));
1697 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1701 void ScOpenCLTest1::testFinancialAmorlincFormula()
1703 initTestEnv(u
"xls/opencl/financial/Amorlinc.xls");
1704 ScDocument
* pDoc
= getScDoc();
1705 ScDocument
* pDocRes
= getScDoc2();
1708 for (SCROW i
= 0; i
<= 9; ++i
)
1710 double fLibre
= pDoc
->GetValue(ScAddress(7, i
, 0));
1711 double fExcel
= pDocRes
->GetValue(ScAddress(7, i
, 0));
1712 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1716 void ScOpenCLTest1::testFinancialDDBFormula()
1718 initTestEnv(u
"xls/opencl/financial/ddb.xls");
1719 ScDocument
* pDoc
= getScDoc();
1720 ScDocument
* pDocRes
= getScDoc2();
1723 for (SCROW i
= 0; i
<= 9; ++i
)
1725 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
1726 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
1727 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1730 void ScOpenCLTest1::testFinacialPriceMatFormula()
1732 initTestEnv(u
"xls/opencl/financial/PriceMat.xls");
1733 ScDocument
* pDoc
= getScDoc();
1734 ScDocument
* pDocRes
= getScDoc2();
1737 for (SCROW i
= 0; i
<= 9; ++i
)
1739 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
1740 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
1741 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1744 void ScOpenCLTest1::testFinacialFormulaReceived()
1746 initTestEnv(u
"xls/opencl/financial/Received.xls");
1747 ScDocument
* pDoc
= getScDoc();
1748 ScDocument
* pDocRes
= getScDoc2();
1751 // Check the results of formula cells in the shared formula range.
1752 for (SCROW i
= 0; i
< 10; ++i
)
1754 double fLibre
= pDoc
->GetValue(ScAddress(5,i
,0));
1755 double fExcel
= pDocRes
->GetValue(ScAddress(5,i
,0));
1756 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1759 void ScOpenCLTest1::testFinancialFormulaCumipmt()
1761 initTestEnv(u
"xls/opencl/financial/Cumipmt.xls");
1762 ScDocument
* pDoc
= getScDoc();
1763 ScDocument
* pDocRes
= getScDoc2();
1766 // Check the results of formula cells in the shared formula range.
1767 for (SCROW i
= 1; i
<= 10; ++i
)
1769 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,0));
1770 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,0));
1771 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1774 void ScOpenCLTest1::testFinancialFormulaCumprinc()
1776 initTestEnv(u
"xls/opencl/financial/Cumprinc.xls");
1777 ScDocument
* pDoc
= getScDoc();
1778 ScDocument
* pDocRes
= getScDoc2();
1781 // Check the results of formula cells in the shared formula range.
1782 for (SCROW i
= 1; i
<= 10; ++i
)
1784 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,0));
1785 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,0));
1786 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1789 void ScOpenCLTest1::testFinacialRRIFormula()
1791 initTestEnv(u
"xls/opencl/financial/RRI.xls");
1792 ScDocument
* pDoc
= getScDoc();
1793 ScDocument
* pDocRes
= getScDoc2();
1796 for (SCROW i
= 0; i
<= 9; ++i
)
1798 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1799 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1800 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1803 void ScOpenCLTest1::testFinacialEFFECT_ADDFormula()
1805 initTestEnv(u
"xls/opencl/financial/EFFECT_ADD.xls");
1806 ScDocument
* pDoc
= getScDoc();
1807 ScDocument
* pDocRes
= getScDoc2();
1810 for (SCROW i
= 0; i
<= 9; ++i
)
1812 double fLibre
= pDoc
->GetValue(ScAddress(2, i
, 0));
1813 double fExcel
= pDocRes
->GetValue(ScAddress(2, i
, 0));
1814 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1817 void ScOpenCLTest1::testFinacialNominalFormula()
1819 initTestEnv(u
"xls/opencl/financial/Nominal.xls");
1820 ScDocument
* pDoc
= getScDoc();
1821 ScDocument
* pDocRes
= getScDoc2();
1825 // Check the results of formula cells in the shared formula range.
1826 for (SCROW i
= 1; i
<= 19; ++i
)
1828 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,0));
1829 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,0));
1830 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1833 void ScOpenCLTest1::testFinacialTBILLEQFormula()
1835 initTestEnv(u
"xls/opencl/financial/TBILLEQ.xls");
1836 ScDocument
* pDoc
= getScDoc();
1837 ScDocument
* pDocRes
= getScDoc2();
1840 for (SCROW i
= 0; i
<= 6; ++i
)
1842 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1843 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1844 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1847 void ScOpenCLTest1::testFinacialTBILLPRICEFormula()
1849 initTestEnv(u
"xls/opencl/financial/TBILLPRICE.xls");
1850 ScDocument
* pDoc
= getScDoc();
1851 ScDocument
* pDocRes
= getScDoc2();
1854 for (SCROW i
= 0; i
<= 6; ++i
)
1856 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1857 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1858 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1861 void ScOpenCLTest1::testFinacialTBILLYIELDFormula()
1863 initTestEnv(u
"xls/opencl/financial/TBILLYIELD.xls");
1864 ScDocument
* pDoc
= getScDoc();
1865 ScDocument
* pDocRes
= getScDoc2();
1868 for (SCROW i
= 0; i
<= 6; ++i
)
1870 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1871 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1872 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1875 void ScOpenCLTest1::testFinacialYIELDFormula()
1877 initTestEnv(u
"xls/opencl/financial/YIELD.xls");
1878 ScDocument
* pDoc
= getScDoc();
1879 ScDocument
* pDocRes
= getScDoc2();
1882 for (SCROW i
= 0; i
<= 6; ++i
)
1884 double fLibre
= pDoc
->GetValue(ScAddress(7, i
, 0));
1885 double fExcel
= pDocRes
->GetValue(ScAddress(7, i
, 0));
1886 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1890 void ScOpenCLTest1::testFinacialYIELDDISCFormula()
1892 initTestEnv(u
"xls/opencl/financial/YIELDDISC.xls");
1893 ScDocument
* pDoc
= getScDoc();
1894 ScDocument
* pDocRes
= getScDoc2();
1897 for (SCROW i
= 0; i
<= 6; ++i
)
1899 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
1900 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
1901 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1905 void ScOpenCLTest1::testFinacialYIELDMATFormula()
1907 initTestEnv(u
"xls/opencl/financial/YIELDMAT.xls");
1908 ScDocument
* pDoc
= getScDoc();
1909 ScDocument
* pDocRes
= getScDoc2();
1912 for (SCROW i
= 0; i
<= 6; ++i
)
1914 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
1915 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
1916 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1919 void ScOpenCLTest1:: testFinacialPMTFormula()
1921 initTestEnv(u
"xls/opencl/financial/PMT.xls");
1922 ScDocument
* pDoc
= getScDoc();
1923 ScDocument
* pDocRes
= getScDoc2();
1926 for (SCROW i
= 0; i
<= 6; ++i
)
1928 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
1929 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
1930 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1934 void ScOpenCLTest1:: testFinancialDurationFormula()
1936 initTestEnv(u
"ods/opencl/financial/Duration.ods");
1937 ScDocument
* pDoc
= getScDoc();
1938 ScDocument
* pDocRes
= getScDoc2();
1941 for (SCROW i
= 0; i
<= 9; ++i
)
1943 double fLibre
= pDoc
->GetValue(ScAddress(3, i
, 0));
1944 double fExcel
= pDocRes
->GetValue(ScAddress(3, i
, 0));
1945 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1949 void ScOpenCLTest1::testStatisticalFormulaLogNormDist()
1951 initTestEnv(u
"ods/opencl/statistical/LogNormDist.ods");
1952 ScDocument
* pDoc
= getScDoc();
1953 ScDocument
* pDocRes
= getScDoc2();
1956 // Check the results of formula cells in the shared formula range.
1957 for (SCROW i
= 1; i
<= 19; ++i
)
1959 double fLibre
= pDoc
->GetValue(ScAddress(4,i
,0));
1960 double fExcel
= pDocRes
->GetValue(ScAddress(4,i
,0));
1961 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1965 void ScOpenCLTest1::testMathFormulaArcCos()
1967 initTestEnv(u
"ods/opencl/math/ArcCos.ods");
1968 ScDocument
* pDoc
= getScDoc();
1969 ScDocument
* pDocRes
= getScDoc2();
1972 // Verify ACos Function
1973 for (SCROW i
= 1; i
<= 1000; ++i
)
1975 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
1976 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
1977 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1981 void ScOpenCLTest1:: testFinacialPPMTFormula()
1983 initTestEnv(u
"xls/opencl/financial/PPMT.xls");
1984 ScDocument
* pDoc
= getScDoc();
1985 ScDocument
* pDocRes
= getScDoc2();
1988 for (SCROW i
= 0; i
<= 6; ++i
)
1990 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
1991 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
1992 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
1996 void ScOpenCLTest1:: testFinacialNPVFormula()
1998 initTestEnv(u
"xls/opencl/financial/NPV.xls");
1999 ScDocument
* pDoc
= getScDoc();
2000 ScDocument
* pDocRes
= getScDoc2();
2003 for (SCROW i
= 0; i
<= 6; ++i
)
2005 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
2006 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
2007 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2011 void ScOpenCLTest1:: testFinancialDuration_ADDFormula()
2013 initTestEnv(u
"xls/opencl/financial/Duration_ADD.xls");
2014 ScDocument
* pDoc
= getScDoc();
2015 ScDocument
* pDocRes
= getScDoc2();
2018 for (SCROW i
= 0; i
<= 9; ++i
)
2020 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
2021 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
2022 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2026 void ScOpenCLTest1::testStatisticalFormulaNorminv()
2028 initTestEnv(u
"xls/opencl/statistical/Norminv.xls");
2029 ScDocument
* pDoc
= getScDoc();
2030 ScDocument
* pDocRes
= getScDoc2();
2033 // Check the results of formula cells in the shared formula range.
2034 for (SCROW i
= 1; i
<= 19; ++i
)
2036 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,0));
2037 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,0));
2038 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2042 void ScOpenCLTest1::testStatisticalFormulaNormsinv()
2044 initTestEnv(u
"xls/opencl/statistical/Normsinv.xls");
2045 ScDocument
* pDoc
= getScDoc();
2046 ScDocument
* pDocRes
= getScDoc2();
2049 // Check the results of formula cells in the shared formula range.
2050 for (SCROW i
= 1; i
<= 19; ++i
)
2052 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2053 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2054 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2058 void ScOpenCLTest1::testMathFormulaArcCosHyp()
2060 initTestEnv(u
"ods/opencl/math/ArcCosHyp.ods");
2061 ScDocument
* pDoc
= getScDoc();
2062 ScDocument
* pDocRes
= getScDoc2();
2065 // Verify ACosH Function
2066 for (SCROW i
= 1; i
<= 1000; ++i
)
2068 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2069 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2070 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2074 void ScOpenCLTest1:: testFinancialMDurationFormula()
2076 initTestEnv(u
"xls/opencl/financial/MDuration.xls");
2077 ScDocument
* pDoc
= getScDoc();
2078 ScDocument
* pDocRes
= getScDoc2();
2081 for (SCROW i
= 0; i
<= 9; ++i
)
2083 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
2084 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
2085 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2089 void ScOpenCLTest1::testMathFormulaArcCot()
2091 initTestEnv(u
"ods/opencl/math/ArcCot.ods");
2092 ScDocument
* pDoc
= getScDoc();
2093 ScDocument
* pDocRes
= getScDoc2();
2096 // Verify ACot Function
2097 for (SCROW i
= 1; i
<= 1000; ++i
)
2099 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2100 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2101 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2105 void ScOpenCLTest1:: testFinancialFVFormula()
2107 initTestEnv(u
"xls/opencl/financial/FV.xls");
2108 ScDocument
* pDoc
= getScDoc();
2109 ScDocument
* pDocRes
= getScDoc2();
2112 for (SCROW i
= 0; i
<= 9; ++i
)
2114 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
2115 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
2116 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2120 void ScOpenCLTest1::testFinancialDBFormula()
2122 initTestEnv(u
"xls/opencl/financial/db.xls");
2123 ScDocument
* pDoc
= getScDoc();
2124 ScDocument
* pDocRes
= getScDoc2();
2127 for (SCROW i
= 0; i
<= 9; ++i
)
2129 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
2130 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
2131 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2135 void ScOpenCLTest1::testFinancialCouppcdFormula()
2137 initTestEnv(u
"xls/opencl/financial/Couppcd.xls");
2138 ScDocument
* pDoc
= getScDoc();
2139 ScDocument
* pDocRes
= getScDoc2();
2142 for (SCROW i
= 0; i
<= 9; ++i
)
2144 double fLibre
= pDoc
->GetValue(ScAddress(4, i
, 0));
2145 double fExcel
= pDocRes
->GetValue(ScAddress(4, i
, 0));
2146 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2150 void ScOpenCLTest1::testMathSumIfsFormula()
2152 initTestEnv(u
"xls/opencl/math/sumifs.xls");
2153 ScDocument
* pDoc
= getScDoc();
2154 ScDocument
* pDocRes
= getScDoc2();
2155 ScDocShell
* pDocSh
= getScDocShell();
2156 pDocSh
->DoHardRecalc();
2158 for (SCROW i
= 2; i
<= 11; ++i
)
2160 double fLibre
= pDoc
->GetValue(ScAddress(5,i
,0));
2161 double fExcel
= pDocRes
->GetValue(ScAddress(5,i
,0));
2162 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2164 for (SCROW i
= 2; i
<= 11; ++i
)
2166 double fLibre
= pDoc
->GetValue(ScAddress(6,i
,0));
2167 double fExcel
= pDocRes
->GetValue(ScAddress(6,i
,0));
2168 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2170 for (SCROW i
= 2; i
<= 11; ++i
)
2172 double fLibre
= pDoc
->GetValue(ScAddress(7,i
,0));
2173 double fExcel
= pDocRes
->GetValue(ScAddress(7,i
,0));
2174 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2176 for (SCROW i
= 2; i
<= 11; ++i
)
2178 double fLibre
= pDoc
->GetValue(ScAddress(8,i
,0));
2179 double fExcel
= pDocRes
->GetValue(ScAddress(8,i
,0));
2180 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2184 void ScOpenCLTest1::testMathFormulaArcCotHyp()
2186 initTestEnv(u
"ods/opencl/math/ArcCotHyp.ods");
2187 ScDocument
* pDoc
= getScDoc();
2188 ScDocument
* pDocRes
= getScDoc2();
2191 // Verify ACotH Function
2192 for (SCROW i
= 1; i
<= 1000; ++i
)
2194 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2195 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2196 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2200 void ScOpenCLTest1::testMathFormulaArcSin()
2202 initTestEnv(u
"ods/opencl/math/ArcSin.ods");
2203 ScDocument
* pDoc
= getScDoc();
2204 ScDocument
* pDocRes
= getScDoc2();
2207 // Verify ACotH Function
2208 for (SCROW i
= 1; i
<= 1000; ++i
)
2210 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2211 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2212 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2216 void ScOpenCLTest1:: testFinancialVDBFormula()
2218 initTestEnv(u
"xls/opencl/financial/VDB.xls");
2219 ScDocument
* pDoc
= getScDoc();
2220 ScDocument
* pDocRes
= getScDoc2();
2223 for (SCROW i
= 0; i
<= 10; ++i
)
2225 double fLibre
= pDoc
->GetValue(ScAddress(7, i
, 0));
2226 double fExcel
= pDocRes
->GetValue(ScAddress(7, i
, 0));
2227 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2229 for (SCROW i
= 15; i
<= 26; ++i
)
2231 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
2232 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
2233 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2235 for (SCROW i
= 30; i
<= 41; ++i
)
2237 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
2238 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
2239 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2243 void ScOpenCLTest1:: testFinancialIPMTFormula()
2245 initTestEnv(u
"xls/opencl/financial/IPMT.xls");
2246 ScDocument
* pDoc
= getScDoc();
2247 ScDocument
* pDocRes
= getScDoc2();
2250 for (SCROW i
= 0; i
<= 9; ++i
)
2252 double fLibre
= pDoc
->GetValue(ScAddress(6, i
, 0));
2253 double fExcel
= pDocRes
->GetValue(ScAddress(6, i
, 0));
2254 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2258 void ScOpenCLTest1::testStatisticalFormulaConfidence()
2260 initTestEnv(u
"xls/opencl/statistical/Confidence.xls");
2261 ScDocument
* pDoc
= getScDoc();
2262 ScDocument
* pDocRes
= getScDoc2();
2265 // Check the results of formula cells in the shared formula range.
2266 for (SCROW i
= 0; i
<= 9; ++i
)
2268 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,0));
2269 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,0));
2270 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2274 void ScOpenCLTest1::testFinancialCoupncdFormula()
2276 initTestEnv(u
"xls/opencl/financial/Coupncd.xls");
2277 ScDocument
* pDoc
= getScDoc();
2278 ScDocument
* pDocRes
= getScDoc2();
2281 for (SCROW i
= 0; i
<= 9; ++i
)
2283 double fLibre
= pDoc
->GetValue(ScAddress(4, i
, 0));
2284 double fExcel
= pDocRes
->GetValue(ScAddress(4, i
, 0));
2285 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2289 void ScOpenCLTest1::testFinancialAccrintFormula()
2291 initTestEnv(u
"xls/opencl/financial/Accrint.xls");
2292 ScDocument
* pDoc
= getScDoc();
2293 ScDocument
* pDocRes
= getScDoc2();
2296 for (SCROW i
= 0; i
<= 9; ++i
)
2298 double fLibre
= pDoc
->GetValue(ScAddress(7, i
, 0));
2299 double fExcel
= pDocRes
->GetValue(ScAddress(7, i
, 0));
2300 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2304 void ScOpenCLTest1::testStatisticalFormulaCritBinom()
2306 initTestEnv(u
"xls/opencl/statistical/CritBinom.xls");
2307 ScDocument
* pDoc
= getScDoc();
2308 ScDocument
* pDocRes
= getScDoc2();
2311 // Check the results of formula cells in the shared formula range.
2312 for (SCROW i
= 0; i
<= 9; ++i
)
2314 double fLibre
= pDoc
->GetValue(ScAddress(3,i
,0));
2315 double fExcel
= pDocRes
->GetValue(ScAddress(3,i
,0));
2316 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2320 void ScOpenCLTest1::testMathFormulaArcSinHyp()
2322 initTestEnv(u
"ods/opencl/math/ArcSinHyp.ods");
2323 ScDocument
* pDoc
= getScDoc();
2324 ScDocument
* pDocRes
= getScDoc2();
2327 // Verify ASinH Function
2328 for (SCROW i
= 1; i
<= 1000; ++i
)
2330 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2331 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2332 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2336 void ScOpenCLTest1::testMathFormulaArcTan()
2338 initTestEnv(u
"ods/opencl/math/ArcTan.ods");
2339 ScDocument
* pDoc
= getScDoc();
2340 ScDocument
* pDocRes
= getScDoc2();
2343 // Verify ATan Function
2344 for (SCROW i
= 1; i
<= 1000; ++i
)
2346 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2347 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2348 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2352 void ScOpenCLTest1::testMathFormulaArcTanHyp()
2354 initTestEnv(u
"ods/opencl/math/ArcTanHyp.ods");
2355 ScDocument
* pDoc
= getScDoc();
2356 ScDocument
* pDocRes
= getScDoc2();
2359 // Verify ATanH Function
2360 for (SCROW i
= 1; i
<= 1000; ++i
)
2362 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2363 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2364 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2368 void ScOpenCLTest1:: testFinacialNPER1Formula()
2370 initTestEnv(u
"xls/opencl/financial/NPER1.xls");
2371 ScDocument
* pDoc
= getScDoc();
2372 ScDocument
* pDocRes
= getScDoc2();
2375 for (SCROW i
= 0; i
<= 6; ++i
)
2377 double fLibre
= pDoc
->GetValue(ScAddress(5, i
, 0));
2378 double fExcel
= pDocRes
->GetValue(ScAddress(5, i
, 0));
2379 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2383 void ScOpenCLTest1::testMathFormulaBitAnd()
2385 initTestEnv(u
"ods/opencl/math/BitAnd.ods");
2386 ScDocument
* pDoc
= getScDoc();
2387 ScDocument
* pDocRes
= getScDoc2();
2390 // Verify BitAnd Function
2391 for (SCROW i
= 1; i
<= 1000; ++i
)
2393 double fLibre
= pDoc
->GetValue(ScAddress(2,i
,0));
2394 double fExcel
= pDocRes
->GetValue(ScAddress(2,i
,0));
2395 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2399 void ScOpenCLTest1::testMathFormulaLN()
2401 initTestEnv(u
"xls/opencl/math/LN.xls");
2402 ScDocument
* pDoc
= getScDoc();
2403 ScDocument
* pDocRes
= getScDoc2();
2406 // Check the results of formula cells in the shared formula range.
2407 for (SCROW i
= 1; i
<= 9; ++i
)
2409 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2410 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2411 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2415 void ScOpenCLTest1::testMathFormulaRound()
2417 initTestEnv(u
"xls/opencl/math/ROUND.xls");
2418 ScDocument
* pDoc
= getScDoc();
2419 ScDocument
* pDocRes
= getScDoc2();
2422 // Check the results of formula cells in the shared formula range.
2423 for (SCROW i
= 1; i
<= 9; ++i
)
2425 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2426 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2427 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2429 for (SCROW i
= 15; i
<= 25; ++i
)
2431 double fLibre
= pDoc
->GetValue(ScAddress(1,i
,0));
2432 double fExcel
= pDocRes
->GetValue(ScAddress(1,i
,0));
2433 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2437 void ScOpenCLTest1::testStatisticalFormulaGammaDist()
2439 initTestEnv(u
"xls/opencl/statistical/GammaDist.xls");
2440 ScDocument
* pDoc
= getScDoc();
2441 ScDocument
* pDocRes
= getScDoc2();
2444 // Check the results of formula cells in the shared formula range.
2445 for (SCROW i
= 1; i
<= 19; ++i
)
2447 double fLibre
= pDoc
->GetValue(ScAddress(4,i
,0));
2448 double fExcel
= pDocRes
->GetValue(ScAddress(4,i
,0));
2449 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel
, fLibre
, fabs(0.0001*fExcel
));
2453 ScOpenCLTest1::ScOpenCLTest1()
2454 : ScModelTestBase( "sc/qa/unit/data" )
2458 CPPUNIT_TEST_SUITE_REGISTRATION(ScOpenCLTest1
);
2460 CPPUNIT_PLUGIN_IMPLEMENT();
2462 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */