1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rtl_math.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sal.hxx"
35 // LLA: take a look into Microsofts math.h implementation, why this define is need
36 #define _USE_MATH_DEFINES
40 #include <cppunit/simpleheader.hxx>
42 #include <rtl/string.hxx>
44 #include "valueequal.hxx"
49 class test
: public CppUnit::TestFixture
52 // initialise your test code values here.
62 void equalCheck(double _nResult
, double _nExpect
) /* throws Exception */
64 bool bEqualResult
= is_double_equal(_nResult
, _nExpect
);
66 rtl::OString sError
= "rtl_math_round expected result is wrong should:(";
67 sError
+= rtl::OString::valueOf(_nExpect
);
68 sError
+= ") but is:(";
69 sError
+= rtl::OString::valueOf(_nResult
);
72 CPPUNIT_ASSERT_MESSAGE(sError
.getStr(), bEqualResult
== true);
75 // insert your test code here.
78 // this is demonstration code
79 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
84 nResult
= rtl_math_round(nValue
, 0, rtl_math_RoundingMode_Corrected
);
85 equalCheck(nResult
, double(3.0));
87 nResult
= rtl_math_round(nValue
, 2, rtl_math_RoundingMode_Corrected
);
88 equalCheck(nResult
, double(3.14));
90 nResult
= rtl_math_round(nValue
, 3, rtl_math_RoundingMode_Corrected
);
91 equalCheck(nResult
, double(3.142));
93 nResult
= rtl_math_round(nValue
, 10, rtl_math_RoundingMode_Corrected
);
94 equalCheck(nResult
, double(3.1415926536));
97 // insert your test code here.
98 void round_001_positiv()
100 // this is demonstration code
101 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
103 double nResult
= 0.0;
105 nResult
= rtl_math_round(0.1, 1, rtl_math_RoundingMode_Corrected
);
106 equalCheck(nResult
, double(0.1));
108 nResult
= rtl_math_round(0.11, 1, rtl_math_RoundingMode_Corrected
);
109 equalCheck(nResult
, double(0.1));
111 nResult
= rtl_math_round(0.13, 1, rtl_math_RoundingMode_Corrected
);
112 equalCheck(nResult
, double(0.1));
114 nResult
= rtl_math_round(0.14, 1, rtl_math_RoundingMode_Corrected
);
115 equalCheck(nResult
, double(0.1));
117 nResult
= rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Corrected
);
118 equalCheck(nResult
, double(0.1));
120 nResult
= rtl_math_round(0.15, 1, rtl_math_RoundingMode_Corrected
);
121 equalCheck(nResult
, double(0.2));
123 nResult
= rtl_math_round(0.151, 1, rtl_math_RoundingMode_Corrected
);
124 equalCheck(nResult
, double(0.2));
126 nResult
= rtl_math_round(0.16, 1, rtl_math_RoundingMode_Corrected
);
127 equalCheck(nResult
, double(0.2));
129 nResult
= rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Corrected
);
130 equalCheck(nResult
, double(0.2));
133 void round_001_negativ()
135 // this is demonstration code
136 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
138 double nResult
= 0.0;
140 nResult
= rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Corrected
);
141 equalCheck(nResult
, double(-0.1));
143 nResult
= rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Corrected
);
144 equalCheck(nResult
, double(-0.1));
146 nResult
= rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Corrected
);
147 equalCheck(nResult
, double(-0.1));
149 nResult
= rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Corrected
);
150 equalCheck(nResult
, double(-0.1));
152 nResult
= rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Corrected
);
153 equalCheck(nResult
, double(-0.1));
155 nResult
= rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Corrected
);
156 equalCheck(nResult
, double(-0.2));
158 nResult
= rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Corrected
);
159 equalCheck(nResult
, double(-0.2));
161 nResult
= rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Corrected
);
162 equalCheck(nResult
, double(-0.2));
164 nResult
= rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Corrected
);
165 equalCheck(nResult
, double(-0.2));
167 // -----------------------------------------------------------------------------
168 void round_002_positiv()
170 // this is demonstration code
171 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
173 double nResult
= 0.0;
175 nResult
= rtl_math_round(0.1, 1, rtl_math_RoundingMode_Down
);
176 equalCheck(nResult
, double(0.1));
178 nResult
= rtl_math_round(0.11, 1, rtl_math_RoundingMode_Down
);
179 equalCheck(nResult
, double(0.1));
181 nResult
= rtl_math_round(0.13, 1, rtl_math_RoundingMode_Down
);
182 equalCheck(nResult
, double(0.1));
184 nResult
= rtl_math_round(0.14, 1, rtl_math_RoundingMode_Down
);
185 equalCheck(nResult
, double(0.1));
187 nResult
= rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Down
);
188 equalCheck(nResult
, double(0.1));
190 nResult
= rtl_math_round(0.15, 1, rtl_math_RoundingMode_Down
);
191 equalCheck(nResult
, double(0.1));
193 nResult
= rtl_math_round(0.151, 1, rtl_math_RoundingMode_Down
);
194 equalCheck(nResult
, double(0.1));
196 nResult
= rtl_math_round(0.16, 1, rtl_math_RoundingMode_Down
);
197 equalCheck(nResult
, double(0.1));
199 nResult
= rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Down
);
200 equalCheck(nResult
, double(0.1));
203 void round_002_negativ()
205 // this is demonstration code
206 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
208 double nResult
= 0.0;
210 nResult
= rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Down
);
211 equalCheck(nResult
, double(-0.1));
213 nResult
= rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Down
);
214 equalCheck(nResult
, double(-0.1));
216 nResult
= rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Down
);
217 equalCheck(nResult
, double(-0.1));
219 nResult
= rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Down
);
220 equalCheck(nResult
, double(-0.1));
222 nResult
= rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Down
);
223 equalCheck(nResult
, double(-0.1));
225 nResult
= rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Down
);
226 equalCheck(nResult
, double(-0.1));
228 nResult
= rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Down
);
229 equalCheck(nResult
, double(-0.1));
231 nResult
= rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Down
);
232 equalCheck(nResult
, double(-0.1));
234 nResult
= rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Down
);
235 equalCheck(nResult
, double(-0.1));
237 // -----------------------------------------------------------------------------
238 void round_003_positiv()
240 // this is demonstration code
241 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
243 double nResult
= 0.0;
245 nResult
= rtl_math_round(0.1, 1, rtl_math_RoundingMode_Up
);
246 equalCheck(nResult
, double(0.1));
248 nResult
= rtl_math_round(0.11, 1, rtl_math_RoundingMode_Up
);
249 equalCheck(nResult
, double(0.2));
251 nResult
= rtl_math_round(0.13, 1, rtl_math_RoundingMode_Up
);
252 equalCheck(nResult
, double(0.2));
254 nResult
= rtl_math_round(0.14, 1, rtl_math_RoundingMode_Up
);
255 equalCheck(nResult
, double(0.2));
257 nResult
= rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Up
);
258 equalCheck(nResult
, double(0.2));
260 nResult
= rtl_math_round(0.15, 1, rtl_math_RoundingMode_Up
);
261 equalCheck(nResult
, double(0.2));
263 nResult
= rtl_math_round(0.151, 1, rtl_math_RoundingMode_Up
);
264 equalCheck(nResult
, double(0.2));
266 nResult
= rtl_math_round(0.16, 1, rtl_math_RoundingMode_Up
);
267 equalCheck(nResult
, double(0.2));
269 nResult
= rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Up
);
270 equalCheck(nResult
, double(0.2));
273 void round_003_negativ()
275 // this is demonstration code
276 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
278 double nResult
= 0.0;
280 nResult
= rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Up
);
281 equalCheck(nResult
, double(-0.1));
283 nResult
= rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Up
);
284 equalCheck(nResult
, double(-0.2));
286 nResult
= rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Up
);
287 equalCheck(nResult
, double(-0.2));
289 nResult
= rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Up
);
290 equalCheck(nResult
, double(-0.2));
292 nResult
= rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Up
);
293 equalCheck(nResult
, double(-0.2));
295 nResult
= rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Up
);
296 equalCheck(nResult
, double(-0.2));
298 nResult
= rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Up
);
299 equalCheck(nResult
, double(-0.2));
301 nResult
= rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Up
);
302 equalCheck(nResult
, double(-0.2));
304 nResult
= rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Up
);
305 equalCheck(nResult
, double(-0.2));
307 // -----------------------------------------------------------------------------
308 void round_004_positiv()
310 // this is demonstration code
311 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
313 double nResult
= 0.0;
315 nResult
= rtl_math_round(0.1, 1, rtl_math_RoundingMode_Floor
);
316 equalCheck(nResult
, double(0.1));
318 nResult
= rtl_math_round(0.11, 1, rtl_math_RoundingMode_Floor
);
319 equalCheck(nResult
, double(0.1));
321 nResult
= rtl_math_round(0.13, 1, rtl_math_RoundingMode_Floor
);
322 equalCheck(nResult
, double(0.1));
324 nResult
= rtl_math_round(0.14, 1, rtl_math_RoundingMode_Floor
);
325 equalCheck(nResult
, double(0.1));
327 nResult
= rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Floor
);
328 equalCheck(nResult
, double(0.1));
330 nResult
= rtl_math_round(0.15, 1, rtl_math_RoundingMode_Floor
);
331 equalCheck(nResult
, double(0.1));
333 nResult
= rtl_math_round(0.151, 1, rtl_math_RoundingMode_Floor
);
334 equalCheck(nResult
, double(0.1));
336 nResult
= rtl_math_round(0.16, 1, rtl_math_RoundingMode_Floor
);
337 equalCheck(nResult
, double(0.1));
339 nResult
= rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Floor
);
340 equalCheck(nResult
, double(0.1));
343 void round_004_negativ()
345 // this is demonstration code
346 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
348 double nResult
= 0.0;
350 nResult
= rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Floor
);
351 equalCheck(nResult
, double(-0.1));
353 nResult
= rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Floor
);
354 equalCheck(nResult
, double(-0.2));
356 nResult
= rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Floor
);
357 equalCheck(nResult
, double(-0.2));
359 nResult
= rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Floor
);
360 equalCheck(nResult
, double(-0.2));
362 nResult
= rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Floor
);
363 equalCheck(nResult
, double(-0.2));
365 nResult
= rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Floor
);
366 equalCheck(nResult
, double(-0.2));
368 nResult
= rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Floor
);
369 equalCheck(nResult
, double(-0.2));
371 nResult
= rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Floor
);
372 equalCheck(nResult
, double(-0.2));
374 nResult
= rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Floor
);
375 equalCheck(nResult
, double(-0.2));
377 // -----------------------------------------------------------------------------
378 void round_005_positiv()
380 // this is demonstration code
381 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
383 double nResult
= 0.0;
385 nResult
= rtl_math_round(0.1, 1, rtl_math_RoundingMode_Ceiling
);
386 equalCheck(nResult
, double(0.1));
388 nResult
= rtl_math_round(0.11, 1, rtl_math_RoundingMode_Ceiling
);
389 equalCheck(nResult
, double(0.2));
391 nResult
= rtl_math_round(0.13, 1, rtl_math_RoundingMode_Ceiling
);
392 equalCheck(nResult
, double(0.2));
394 nResult
= rtl_math_round(0.14, 1, rtl_math_RoundingMode_Ceiling
);
395 equalCheck(nResult
, double(0.2));
397 nResult
= rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Ceiling
);
398 equalCheck(nResult
, double(0.2));
400 nResult
= rtl_math_round(0.15, 1, rtl_math_RoundingMode_Ceiling
);
401 equalCheck(nResult
, double(0.2));
403 nResult
= rtl_math_round(0.151, 1, rtl_math_RoundingMode_Ceiling
);
404 equalCheck(nResult
, double(0.2));
406 nResult
= rtl_math_round(0.16, 1, rtl_math_RoundingMode_Ceiling
);
407 equalCheck(nResult
, double(0.2));
409 nResult
= rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Ceiling
);
410 equalCheck(nResult
, double(0.2));
413 void round_005_negativ()
415 // this is demonstration code
416 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
418 double nResult
= 0.0;
420 nResult
= rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Ceiling
);
421 equalCheck(nResult
, double(-0.1));
423 nResult
= rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Ceiling
);
424 equalCheck(nResult
, double(-0.1));
426 nResult
= rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Ceiling
);
427 equalCheck(nResult
, double(-0.1));
429 nResult
= rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Ceiling
);
430 equalCheck(nResult
, double(-0.1));
432 nResult
= rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Ceiling
);
433 equalCheck(nResult
, double(-0.1));
435 nResult
= rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Ceiling
);
436 equalCheck(nResult
, double(-0.1));
438 nResult
= rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Ceiling
);
439 equalCheck(nResult
, double(-0.1));
441 nResult
= rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Ceiling
);
442 equalCheck(nResult
, double(-0.1));
444 nResult
= rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Ceiling
);
445 equalCheck(nResult
, double(-0.1));
447 // -----------------------------------------------------------------------------
448 void round_006_positiv()
450 // this is demonstration code
451 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
453 double nResult
= 0.0;
455 nResult
= rtl_math_round(0.1, 1, rtl_math_RoundingMode_HalfDown
);
456 equalCheck(nResult
, double(0.1));
458 nResult
= rtl_math_round(0.11, 1, rtl_math_RoundingMode_HalfDown
);
459 equalCheck(nResult
, double(0.1));
461 nResult
= rtl_math_round(0.13, 1, rtl_math_RoundingMode_HalfDown
);
462 equalCheck(nResult
, double(0.1));
464 nResult
= rtl_math_round(0.14, 1, rtl_math_RoundingMode_HalfDown
);
465 equalCheck(nResult
, double(0.1));
467 nResult
= rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_HalfDown
);
468 equalCheck(nResult
, double(0.1));
470 nResult
= rtl_math_round(0.15, 1, rtl_math_RoundingMode_HalfDown
);
471 equalCheck(nResult
, double(0.1));
473 nResult
= rtl_math_round(0.151, 1, rtl_math_RoundingMode_HalfDown
);
474 equalCheck(nResult
, double(0.2));
476 nResult
= rtl_math_round(0.16, 1, rtl_math_RoundingMode_HalfDown
);
477 equalCheck(nResult
, double(0.2));
479 nResult
= rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_HalfDown
);
480 equalCheck(nResult
, double(0.2));
483 void round_006_negativ()
485 // this is demonstration code
486 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
488 double nResult
= 0.0;
490 nResult
= rtl_math_round(-0.1, 1, rtl_math_RoundingMode_HalfDown
);
491 equalCheck(nResult
, double(-0.1));
493 nResult
= rtl_math_round(-0.11, 1, rtl_math_RoundingMode_HalfDown
);
494 equalCheck(nResult
, double(-0.1));
496 nResult
= rtl_math_round(-0.13, 1, rtl_math_RoundingMode_HalfDown
);
497 equalCheck(nResult
, double(-0.1));
499 nResult
= rtl_math_round(-0.14, 1, rtl_math_RoundingMode_HalfDown
);
500 equalCheck(nResult
, double(-0.1));
502 nResult
= rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_HalfDown
);
503 equalCheck(nResult
, double(-0.1));
505 nResult
= rtl_math_round(-0.15, 1, rtl_math_RoundingMode_HalfDown
);
506 equalCheck(nResult
, double(-0.1));
508 nResult
= rtl_math_round(-0.151, 1, rtl_math_RoundingMode_HalfDown
);
509 equalCheck(nResult
, double(-0.2));
511 nResult
= rtl_math_round(-0.16, 1, rtl_math_RoundingMode_HalfDown
);
512 equalCheck(nResult
, double(-0.2));
514 nResult
= rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_HalfDown
);
515 equalCheck(nResult
, double(-0.2));
517 // -----------------------------------------------------------------------------
518 void round_007_positiv()
520 // this is demonstration code
521 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
523 double nResult
= 0.0;
525 nResult
= rtl_math_round(0.1, 1, rtl_math_RoundingMode_HalfUp
);
526 equalCheck(nResult
, double(0.1));
528 nResult
= rtl_math_round(0.11, 1, rtl_math_RoundingMode_HalfUp
);
529 equalCheck(nResult
, double(0.1));
531 nResult
= rtl_math_round(0.13, 1, rtl_math_RoundingMode_HalfUp
);
532 equalCheck(nResult
, double(0.1));
534 nResult
= rtl_math_round(0.14, 1, rtl_math_RoundingMode_HalfUp
);
535 equalCheck(nResult
, double(0.1));
537 nResult
= rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_HalfUp
);
538 equalCheck(nResult
, double(0.1));
540 nResult
= rtl_math_round(0.15, 1, rtl_math_RoundingMode_HalfUp
);
541 equalCheck(nResult
, double(0.2));
543 nResult
= rtl_math_round(0.151, 1, rtl_math_RoundingMode_HalfUp
);
544 equalCheck(nResult
, double(0.2));
546 nResult
= rtl_math_round(0.16, 1, rtl_math_RoundingMode_HalfUp
);
547 equalCheck(nResult
, double(0.2));
549 nResult
= rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_HalfUp
);
550 equalCheck(nResult
, double(0.2));
553 void round_007_negativ()
555 // this is demonstration code
556 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
558 double nResult
= 0.0;
560 nResult
= rtl_math_round(-0.1, 1, rtl_math_RoundingMode_HalfUp
);
561 equalCheck(nResult
, double(-0.1));
563 nResult
= rtl_math_round(-0.11, 1, rtl_math_RoundingMode_HalfUp
);
564 equalCheck(nResult
, double(-0.1));
566 nResult
= rtl_math_round(-0.13, 1, rtl_math_RoundingMode_HalfUp
);
567 equalCheck(nResult
, double(-0.1));
569 nResult
= rtl_math_round(-0.14, 1, rtl_math_RoundingMode_HalfUp
);
570 equalCheck(nResult
, double(-0.1));
572 nResult
= rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_HalfUp
);
573 equalCheck(nResult
, double(-0.1));
575 nResult
= rtl_math_round(-0.15, 1, rtl_math_RoundingMode_HalfUp
);
576 equalCheck(nResult
, double(-0.2));
578 nResult
= rtl_math_round(-0.151, 1, rtl_math_RoundingMode_HalfUp
);
579 equalCheck(nResult
, double(-0.2));
581 nResult
= rtl_math_round(-0.16, 1, rtl_math_RoundingMode_HalfUp
);
582 equalCheck(nResult
, double(-0.2));
584 nResult
= rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_HalfUp
);
585 equalCheck(nResult
, double(-0.2));
588 // Change the following lines only, if you add, remove or rename
589 // member functions of the current class,
590 // because these macros are need by auto register mechanism.
592 CPPUNIT_TEST_SUITE(test
);
593 CPPUNIT_TEST(round_000
);
595 CPPUNIT_TEST(round_001_positiv
);
596 CPPUNIT_TEST(round_001_negativ
);
598 CPPUNIT_TEST(round_002_positiv
);
599 CPPUNIT_TEST(round_002_negativ
);
601 CPPUNIT_TEST(round_003_positiv
);
602 CPPUNIT_TEST(round_003_negativ
);
604 CPPUNIT_TEST(round_004_positiv
);
605 CPPUNIT_TEST(round_004_negativ
);
607 CPPUNIT_TEST(round_005_positiv
);
608 CPPUNIT_TEST(round_005_negativ
);
610 CPPUNIT_TEST(round_006_positiv
);
611 CPPUNIT_TEST(round_006_negativ
);
613 CPPUNIT_TEST(round_007_positiv
);
614 CPPUNIT_TEST(round_007_negativ
);
616 CPPUNIT_TEST_SUITE_END();
619 // -----------------------------------------------------------------------------
620 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_math::test
, "rtl_math");
621 } // namespace rtl_math
624 // -----------------------------------------------------------------------------
626 // this macro creates an empty function, which will called by the RegisterAllFunctions()
627 // to let the user the possibility to also register some functions by hand.