1 /* Copyright (C) 1999 Hewlett-Packard Company |
|
2 |
|
3 This file is part of Mauve. |
|
4 |
|
5 Mauve is free software; you can redistribute it and/or modify |
|
6 it under the terms of the GNU General Public License as published by |
|
7 the Free Software Foundation; either version 2, or (at your option) |
|
8 any later version. |
|
9 |
|
10 Mauve is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 GNU General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU General Public License |
|
16 along with Mauve; see the file COPYING. If not, write to |
|
17 the Free Software Foundation, 59 Temple Place - Suite 330, |
|
18 Boston, MA 02111-1307, USA. |
|
19 */ |
|
20 |
|
21 // Tags: JDK1.0 |
|
22 |
|
23 package gnu.testlet.java.lang.Math; |
|
24 import gnu.testlet.Testlet; |
|
25 import gnu.testlet.TestHarness; |
|
26 |
|
27 public class MathTest implements Testlet |
|
28 { |
|
29 |
|
30 protected static TestHarness harness; |
|
31 public void test_Basics() |
|
32 { |
|
33 harness.check(!( Math.E != 2.7182818284590452354 ), |
|
34 "test_Basics - 1"); |
|
35 |
|
36 harness.check(!( Math.PI != 3.14159265358979323846 ), |
|
37 "test_Basics - 2"); |
|
38 } |
|
39 |
|
40 public void test_sincostan() |
|
41 { |
|
42 harness.check(!( !(new Double(Math.sin( Double.NaN ))).isNaN() ), |
|
43 "test_sincostan - 1"); |
|
44 harness.check(!( !(new Double(Math.sin( Double.POSITIVE_INFINITY ))).isNaN() ), |
|
45 "test_sincostan - 2"); |
|
46 harness.check(!( !(new Double(Math.sin( Double.NEGATIVE_INFINITY ))).isNaN() ), |
|
47 "test_sincostan - 3"); |
|
48 harness.check(!( Math.sin( -0.0 ) != -0.0 ), |
|
49 "test_sincostan - 4"); |
|
50 harness.check(!( Math.sin( 0.0 ) != 0.0 ), |
|
51 "test_sincostan - 5"); |
|
52 |
|
53 harness.check(!( !(new Double(Math.cos( Double.NaN ))).isNaN() ), |
|
54 "test_sincostan - 6"); |
|
55 harness.check(!( !(new Double(Math.cos( Double.POSITIVE_INFINITY ))).isNaN() ), |
|
56 "test_sincostan - 7"); |
|
57 harness.check(!( !(new Double(Math.cos( Double.NEGATIVE_INFINITY ))).isNaN() ), |
|
58 "test_sincostan - 8"); |
|
59 |
|
60 harness.check(!( !(new Double(Math.tan( Double.NaN ))).isNaN() ), |
|
61 "test_sincostan - 9"); |
|
62 harness.check(!( !(new Double(Math.tan( Double.POSITIVE_INFINITY ))).isNaN() ), |
|
63 "test_sincostan - 10"); |
|
64 harness.check(!( !(new Double(Math.tan( Double.NEGATIVE_INFINITY ))).isNaN()), |
|
65 "test_sincostan - 11"); |
|
66 harness.check(!( Math.tan( -0.0 ) != -0.0 ), |
|
67 "test_sincostan - 12"); |
|
68 harness.check(!( Math.tan( 0.0 ) != 0.0 ), |
|
69 "test_sincostan - 13"); |
|
70 |
|
71 harness.check(!( Math.sin( Math.PI / 2.0 + Math.PI /6.0 ) <= 0.0 ), |
|
72 "test_sincostan - 14"); |
|
73 harness.check(!( Math.cos( Math.PI / 2.0 + Math.PI /6.0 ) >= 0.0 ), |
|
74 "test_sincostan - 14"); |
|
75 harness.check(!( Math.tan( Math.PI / 2.0 + Math.PI /6.0 ) >= 0.0 ), |
|
76 "test_sincostan - 14"); |
|
77 |
|
78 } |
|
79 |
|
80 public void test_asinacosatan() |
|
81 { |
|
82 harness.check(!( !(new Double(Math.asin( Double.NaN ))).isNaN() ), |
|
83 "test_asinacosatan - 1"); |
|
84 harness.check(!( Math.asin( -0.0 ) != -0.0 ), |
|
85 "test_asinacosatan - 2"); |
|
86 harness.check(!( Math.asin( 0.0 ) != 0.0 ), |
|
87 "test_asinacosatan - 3"); |
|
88 |
|
89 harness.check(!( !(new Double(Math.asin( 10.0 ))).isNaN() ), |
|
90 "test_asinacosatan - 4"); |
|
91 |
|
92 |
|
93 harness.check(!( !(new Double(Math.acos( Double.NaN ))).isNaN() ), |
|
94 "test_asinacosatan - 5"); |
|
95 harness.check(!( !(new Double(Math.acos( 10.0 ))).isNaN() ), |
|
96 "test_asinacosatan - 6"); |
|
97 |
|
98 |
|
99 harness.check(!( !(new Double(Math.atan( Double.NaN ))).isNaN() ), |
|
100 "test_asinacosatan - 7"); |
|
101 harness.check(!( Math.atan( -0.0 ) != -0.0 ), |
|
102 "test_asinacosatan - 8"); |
|
103 harness.check(!( Math.atan( 0.0 ) != 0.0 ), |
|
104 "test_asinacosatan - 9"); |
|
105 |
|
106 } |
|
107 |
|
108 public void test_atan2() |
|
109 { |
|
110 harness.check(!(!(new Double( Math.atan2 (1.0 , Double.NaN ))).isNaN()), |
|
111 "test_atan2 - 1"); |
|
112 harness.check(!(!(new Double( Math.atan2 (Double.NaN,1.0 ))).isNaN()), |
|
113 "test_atan2 - 2"); |
|
114 |
|
115 harness.check(!(( Math.atan2(0.0, 10.0 ) != -0.0 ) || |
|
116 ( Math.atan2(2.0 , Double.POSITIVE_INFINITY ) != -0.0 )), |
|
117 "test_atan2 - 3"); |
|
118 |
|
119 harness.check(!(( Math.atan2(-0.0, 10.0 ) != -0.0 ) || |
|
120 ( Math.atan2(-2.0 , Double.POSITIVE_INFINITY ) != -0.0 )), |
|
121 "test_atan2 - 4"); |
|
122 |
|
123 harness.check(!(( Math.atan2(0.0, -10.0 ) != Math.PI) || |
|
124 ( Math.atan2(2.0 , Double.NEGATIVE_INFINITY ) != Math.PI )), |
|
125 "test_atan2 - 4"); |
|
126 |
|
127 harness.check(!(( Math.atan2(-0.0, -10.0 ) != -Math.PI) || |
|
128 ( Math.atan2(-2.0 , Double.NEGATIVE_INFINITY ) != -Math.PI )), |
|
129 "test_atan2 - 5"); |
|
130 |
|
131 harness.check(!(( Math.atan2(10.0, 0.0 ) != Math.PI/2.0) || |
|
132 ( Math.atan2(Double.POSITIVE_INFINITY , 3.0) != Math.PI /2.0)), |
|
133 "test_atan2 - 6"); |
|
134 |
|
135 harness.check(!(( Math.atan2(-10.0, 0.0 ) != -Math.PI/2.0) || |
|
136 ( Math.atan2(Double.NEGATIVE_INFINITY , 3.0) != -Math.PI /2.0)), |
|
137 "test_atan2 - 7"); |
|
138 |
|
139 harness.check(!(( Math.atan2(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY ) != Math.PI/4.0)), |
|
140 "test_atan2 - 8"); |
|
141 |
|
142 harness.check(!(( Math.atan2(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY ) != Math.PI*3.0/4.0)), |
|
143 "test_atan2 - 9"); |
|
144 |
|
145 harness.check(!(( Math.atan2(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY ) != -Math.PI/4.0)), |
|
146 "test_atan2 - 10"); |
|
147 |
|
148 harness.check(!(( Math.atan2(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY ) != -Math.PI*3.0/4.0)), |
|
149 "test_atan2 - 11"); |
|
150 } |
|
151 |
|
152 public void test_exp() |
|
153 { |
|
154 harness.check(!( !(new Double(Math.exp( Double.NaN ))).isNaN() ), |
|
155 "test_exp - 1"); |
|
156 |
|
157 harness.check(!( !(new Double(Math.exp( Double.POSITIVE_INFINITY))).isInfinite() ), |
|
158 "test_exp - 2"); |
|
159 |
|
160 harness.check(!( Math.exp( Double.NEGATIVE_INFINITY) != 0.0 ), |
|
161 "test_exp - 3"); |
|
162 } |
|
163 |
|
164 public void test_log() |
|
165 { |
|
166 harness.check(!( !(new Double(Math.log( Double.NaN ))).isNaN() ), |
|
167 "test_log - 1"); |
|
168 harness.check(!( !(new Double(Math.log( -1.0 ))).isNaN() ), |
|
169 "test_log - 2"); |
|
170 |
|
171 harness.check(!( !(new Double(Math.log( Double.POSITIVE_INFINITY ))).isInfinite() ), |
|
172 "test_log - 3"); |
|
173 } |
|
174 |
|
175 public void test_sqrt() |
|
176 { |
|
177 harness.check(!( !(new Double(Math.sqrt( Double.NaN ))).isNaN() || |
|
178 !(new Double(Math.sqrt( -10.0 ))).isNaN()), |
|
179 "test_sqrt - 1"); |
|
180 |
|
181 harness.check(!( !(new Double(Math.sqrt( Double.NaN ))).isNaN() || |
|
182 !(new Double(Math.sqrt( -10.0 ))).isNaN()), |
|
183 "test_sqrt - 2"); |
|
184 |
|
185 harness.check(!( !(new Double(Math.sqrt( Double.POSITIVE_INFINITY))).isInfinite()), |
|
186 "test_sqrt - 3"); |
|
187 |
|
188 harness.check(!( Math.sqrt( -0.0) != -0.0 || Math.sqrt( 0.0) != 0.0 ), |
|
189 "test_sqrt - 4"); |
|
190 |
|
191 harness.check(!( Math.sqrt( -0.0) != -0.0 || Math.sqrt( 0.0) != 0.0 ), |
|
192 "test_sqrt - 5"); |
|
193 |
|
194 |
|
195 double sq = Math.sqrt(4.0); |
|
196 harness.check(!(!( sq >= 1.9999 && sq <= 2.111 )), |
|
197 "test_sqrt - 6"); |
|
198 } |
|
199 |
|
200 public void test_pow() |
|
201 { |
|
202 harness.check(!( Math.pow(1.0 , 0.0 ) != 1.0 ), |
|
203 "test_pow - 1"); |
|
204 |
|
205 harness.check(!( Math.pow(2.0 , -0.0 ) != 1.0 ), |
|
206 "test_pow - 2"); |
|
207 |
|
208 harness.check(!( Math.pow(123.0 , 1.0 ) != 123.0 ), |
|
209 "test_pow - 3"); |
|
210 |
|
211 harness.check(!( !(new Double(Math.pow( 10.0, Double.NaN ))).isNaN()), |
|
212 "test_pow - 4"); |
|
213 |
|
214 harness.check(!( !(new Double(Math.pow( Double.NaN, 1.0 ))).isNaN()), |
|
215 "test_pow - 5"); |
|
216 |
|
217 harness.check(!( !(new Double(Math.pow( 2.0, Double.POSITIVE_INFINITY ))).isInfinite()), |
|
218 "test_pow - 6"); |
|
219 |
|
220 harness.check(!( !(new Double(Math.pow( 0.5, Double.NEGATIVE_INFINITY ))).isInfinite()), |
|
221 "test_pow - 7"); |
|
222 |
|
223 harness.check(!( Math.pow( 1.5, Double.NEGATIVE_INFINITY ) != 0.0 || |
|
224 Math.pow( 0.5, Double.POSITIVE_INFINITY ) != 0.0), |
|
225 "test_pow - 8"); |
|
226 |
|
227 harness.check(!( !(new Double(Math.pow( 1.0, Double.POSITIVE_INFINITY ))).isNaN()), |
|
228 "test_pow - 9"); |
|
229 |
|
230 harness.check(!( Math.pow( 0.0, 1.0) != 0.0 || |
|
231 Math.pow( Double.POSITIVE_INFINITY , -1.0 ) != 0.0), |
|
232 "test_pow - 10"); |
|
233 |
|
234 harness.check(!( !(new Double(Math.pow( 0.0, -1.0 ))).isInfinite() || |
|
235 !(new Double(Math.pow( Double.POSITIVE_INFINITY, 1.0 ))).isInfinite() ), |
|
236 "test_pow - 11"); |
|
237 |
|
238 harness.check(!( Math.pow( -0.0, 5.0) != -0.0 || |
|
239 Math.pow( Double.NEGATIVE_INFINITY , -7.0 ) != -0.0), |
|
240 "test_pow - 12"); |
|
241 |
|
242 harness.check(!( Math.pow( -2.0, 6.0) != Math.pow(2.0,6.0)), |
|
243 "test_pow - 13"); |
|
244 |
|
245 harness.check(!( Math.pow( -2.0, 5.0) != -Math.pow(2.0,5.0)), |
|
246 "test_pow - 14"); |
|
247 |
|
248 } |
|
249 |
|
250 public void test_IEEEremainder() |
|
251 { |
|
252 harness.check(!( !(new Double(Math.IEEEremainder( Double.NaN, 1.0 ))).isNaN()), |
|
253 "test_IEEEremainder - 1"); |
|
254 harness.check(!( !(new Double(Math.IEEEremainder( 1.0,Double.NaN))).isNaN()), |
|
255 "test_IEEEremainder - 2"); |
|
256 harness.check(!( !(new Double(Math.IEEEremainder( Double.POSITIVE_INFINITY , 2.0))).isNaN()), |
|
257 "test_IEEEremainder - 3"); |
|
258 harness.check(!( !(new Double(Math.IEEEremainder( 2.0,0.0))).isNaN() ), |
|
259 "test_IEEEremainder - 4"); |
|
260 harness.check(!( Math.IEEEremainder( 3.0, Double.POSITIVE_INFINITY ) != 3.0 ), |
|
261 "test_IEEEremainder - 5"); |
|
262 } |
|
263 |
|
264 public void test_ceil() |
|
265 { |
|
266 harness.check(!( Math.ceil(5.0) != 5.0 ), |
|
267 "test_ceil - 1"); |
|
268 |
|
269 harness.check(!( Math.ceil(0.0) != 0.0 || Math.ceil(-0.0) != -0.0 ), |
|
270 "test_ceil - 2"); |
|
271 |
|
272 harness.check(!( !(new Double(Math.ceil(Double.POSITIVE_INFINITY))).isInfinite() || |
|
273 !(new Double(Math.ceil(Double.NaN))).isNaN()), |
|
274 "test_ceil - 3"); |
|
275 |
|
276 harness.check(!( Math.ceil(-0.5) != -0.0 ), |
|
277 "test_ceil - 4"); |
|
278 |
|
279 harness.check(!( Math.ceil( 2.5 ) != 3.0 ), |
|
280 "test_ceil - 5"); |
|
281 |
|
282 |
|
283 } |
|
284 |
|
285 public void test_floor() |
|
286 { |
|
287 harness.check(!( Math.floor(5.0) != 5.0 ), |
|
288 "test_floor - 1"); |
|
289 |
|
290 harness.check(!( Math.floor(2.5) != 2.0 ), |
|
291 "test_floor - 2"); |
|
292 |
|
293 harness.check(!( !(new Double(Math.floor(Double.POSITIVE_INFINITY))).isInfinite() || |
|
294 !(new Double(Math.floor(Double.NaN))).isNaN()), |
|
295 "test_floor - 3"); |
|
296 |
|
297 harness.check(!( Math.floor(0.0) != 0.0 || Math.floor(-0.0) != -0.0 ), |
|
298 "test_floor - 4"); |
|
299 |
|
300 } |
|
301 |
|
302 public void test_rint() |
|
303 { |
|
304 harness.check(!( Math.rint( 2.3 ) != 2.0 ), |
|
305 "test_rint - 1"); |
|
306 |
|
307 harness.check(!( Math.rint( 2.7 ) != 3.0 ), |
|
308 "test_rint - 2"); |
|
309 |
|
310 |
|
311 harness.check(!(Math.rint( 2.5) != 2.0 ), |
|
312 "test_rint - 3"); |
|
313 |
|
314 harness.check(!( Math.rint( 2.0) != 2.0 ), |
|
315 "test_rint - 4"); |
|
316 |
|
317 harness.check(!( Math.rint( 2.0) != 2.0 ), |
|
318 "test_rint - 5"); |
|
319 |
|
320 harness.check(!( !(new Double(Math.rint(Double.POSITIVE_INFINITY))).isInfinite() || |
|
321 !(new Double(Math.rint(Double.NaN))).isNaN()), |
|
322 "test_rint - 6"); |
|
323 |
|
324 harness.check(!( Math.rint(0.0) != 0.0 || Math.rint(-0.0) != -0.0 ), |
|
325 "test_rint - 7"); |
|
326 } |
|
327 |
|
328 public void test_round() |
|
329 { |
|
330 harness.check(!( Math.round( 3.4 ) != 3 ), |
|
331 "test_round - 1"); |
|
332 |
|
333 harness.check(!( Math.round( 9.55 ) != 10 ), |
|
334 "test_round - 2"); |
|
335 |
|
336 harness.check(!( Math.round(Double.NaN) != 0 ), |
|
337 "test_round - 3"); |
|
338 |
|
339 float f1 = Integer.MIN_VALUE; |
|
340 f1 -= 5; |
|
341 harness.check(!( Math.round(f1) != Integer.MIN_VALUE || |
|
342 Math.round(Float.NEGATIVE_INFINITY) != Integer.MIN_VALUE ), |
|
343 "test_round - 4"); |
|
344 |
|
345 f1 = Integer.MAX_VALUE; |
|
346 f1 += 5; |
|
347 harness.check(!( Math.round(f1) != Integer.MAX_VALUE || |
|
348 Math.round(Float.POSITIVE_INFINITY) != Integer.MAX_VALUE ), |
|
349 "test_round - 5"); |
|
350 |
|
351 double d1 = Long.MIN_VALUE; |
|
352 d1 -= 5; |
|
353 harness.check(!( Math.round(d1) != Long.MIN_VALUE || |
|
354 Math.round(Double.NEGATIVE_INFINITY) != Long.MIN_VALUE ), |
|
355 "test_round - 6"); |
|
356 |
|
357 d1 = Long.MAX_VALUE; |
|
358 d1 += 5; |
|
359 harness.check(!( Math.round(d1) != Long.MAX_VALUE || |
|
360 Math.round(Double.POSITIVE_INFINITY) != Long.MAX_VALUE ), |
|
361 "test_round - 7"); |
|
362 |
|
363 |
|
364 harness.check(!( Math.round( 3.4f ) != 3 ), |
|
365 "test_round - 8"); |
|
366 |
|
367 harness.check(!( Math.round( 9.55f ) != 10 ), |
|
368 "test_round - 9"); |
|
369 |
|
370 harness.check(!( Math.round(Float.NaN) != 0 ), |
|
371 "test_round - 10"); |
|
372 } |
|
373 |
|
374 public void test_random() |
|
375 { |
|
376 harness.check(!( Math.random() < 0.0 || Math.random() > 1.0 ), |
|
377 "test_random - 1"); |
|
378 } |
|
379 |
|
380 public void test_abs() |
|
381 { |
|
382 harness.check(!( Math.abs( 10 ) != 10 ), |
|
383 "test_abs - 1"); |
|
384 |
|
385 harness.check(!( Math.abs( -23 ) != 23 ), |
|
386 "test_abs - 2"); |
|
387 |
|
388 harness.check(!( Math.abs( Integer.MIN_VALUE ) != Integer.MIN_VALUE ), |
|
389 "test_abs - 3" ); |
|
390 |
|
391 harness.check(!( Math.abs(-0) != 0 ), |
|
392 "test_abs - 4" ); |
|
393 |
|
394 |
|
395 harness.check(!( Math.abs( 1000L ) != 1000 ), |
|
396 "test_abs - 5"); |
|
397 |
|
398 harness.check(!( Math.abs( -2334242L ) != 2334242 ), |
|
399 "test_abs - 6"); |
|
400 |
|
401 harness.check(!( Math.abs( Long.MIN_VALUE ) != Long.MIN_VALUE ), |
|
402 "test_abs - 7" ); |
|
403 |
|
404 harness.check(!( Math.abs( 0.0f ) != 0.0f || Math.abs(-0.0f) != 0.0f ), |
|
405 "test_abs - 8" ); |
|
406 |
|
407 harness.check(!( !(new Float(Math.abs( Float.POSITIVE_INFINITY ))).isInfinite() ), |
|
408 "test_abs - 9" ); |
|
409 |
|
410 harness.check(!( !(new Float(Math.abs( Float.NaN ))).isNaN() ), |
|
411 "test_abs - 10" ); |
|
412 |
|
413 harness.check(!( Math.abs( 23.34f ) != 23.34f ), |
|
414 "test_abs - 11" ); |
|
415 |
|
416 |
|
417 harness.check(!( Math.abs( 0.0 ) != 0.0 || Math.abs(-0.0) != 0.0 ), |
|
418 "test_abs - 12" ); |
|
419 |
|
420 harness.check(!( !(new Double(Math.abs( Double.POSITIVE_INFINITY ))).isInfinite() ), |
|
421 "test_abs - 13" ); |
|
422 |
|
423 harness.check(!( !(new Double(Math.abs( Double.NaN ))).isNaN() ), |
|
424 "test_abs - 14" ); |
|
425 |
|
426 harness.check(!( Math.abs( 23.34 ) != 23.34 ), |
|
427 "test_abs - 15" ); |
|
428 |
|
429 } |
|
430 |
|
431 public void test_min() |
|
432 { |
|
433 harness.check(!( Math.min( 100 , 12 ) != 12 ), |
|
434 "test_min - 1" ); |
|
435 |
|
436 harness.check(!( Math.min( Integer.MIN_VALUE , Integer.MIN_VALUE + 1 ) != Integer.MIN_VALUE ), |
|
437 "test_min - 2" ); |
|
438 |
|
439 harness.check(!( Math.min( Integer.MAX_VALUE , Integer.MAX_VALUE -1 ) != Integer.MAX_VALUE -1 ), |
|
440 "test_min - 3" ); |
|
441 |
|
442 harness.check(!( Math.min( 10 , 10 ) != 10 ), |
|
443 "test_min - 4" ); |
|
444 |
|
445 harness.check(!( Math.min( 0 , -0 ) != -0 ), |
|
446 "test_min - 5" ); |
|
447 |
|
448 |
|
449 harness.check(!( Math.min( 100L , 12L ) != 12L ), |
|
450 "test_min - 6" ); |
|
451 |
|
452 harness.check(!( Math.min( Long.MIN_VALUE , Long.MIN_VALUE + 1 ) != Long.MIN_VALUE ), |
|
453 "test_min - 7" ); |
|
454 |
|
455 harness.check(!( Math.min( Long.MAX_VALUE , Long.MAX_VALUE -1 ) != Long.MAX_VALUE -1 ), |
|
456 "test_min - 8" ); |
|
457 |
|
458 harness.check(!( Math.min( 10L , 10L ) != 10L ), |
|
459 "test_min - 9" ); |
|
460 |
|
461 harness.check(!( Math.min( 0L , -0L ) != -0L ), |
|
462 "test_min - 10" ); |
|
463 |
|
464 |
|
465 harness.check(!( Math.min( 23.4f , 12.3f ) != 12.3f ), |
|
466 "test_min - 11" ); |
|
467 |
|
468 harness.check(!( !(new Float(Math.min( Float.NaN , 1.0f ))).isNaN() ), |
|
469 "test_min - 12" ); |
|
470 |
|
471 harness.check(!( Math.min( 10.0f , 10.0f ) != 10.0f ), |
|
472 "test_min - 13" ); |
|
473 |
|
474 harness.check(!( Math.min( 0.0f , -0.0f ) != -0.0f ), |
|
475 "test_min - 14" ); |
|
476 |
|
477 |
|
478 harness.check(!( Math.min( 23.4 , 12.3 ) != 12.3 ), |
|
479 "test_min - 15" ); |
|
480 |
|
481 harness.check(!( !(new Double(Math.min( Double.NaN , 1.0 ))).isNaN() ), |
|
482 "test_min - 16" ); |
|
483 |
|
484 harness.check(!( Math.min( 10.0 , 10.0 ) != 10.0 ), |
|
485 "test_min - 17" ); |
|
486 |
|
487 harness.check(!( Math.min( 0.0 , -0.0 ) != -0.0 ), |
|
488 "test_min - 18" ); |
|
489 |
|
490 } |
|
491 |
|
492 public void test_max() |
|
493 { |
|
494 harness.check(!( Math.max( 100 , 12 ) != 100 ), |
|
495 "test_max - 1" ); |
|
496 |
|
497 harness.check(!( Math.max( Integer.MAX_VALUE , Integer.MAX_VALUE - 1 ) != Integer.MAX_VALUE ), |
|
498 "test_max - 2" ); |
|
499 |
|
500 harness.check(!( Math.max( Integer.MIN_VALUE , Integer.MIN_VALUE + 1 ) != Integer.MIN_VALUE +1 ), |
|
501 "test_max - 3" ); |
|
502 |
|
503 harness.check(!( Math.max( 10 , 10 ) != 10 ), |
|
504 "test_max - 4" ); |
|
505 |
|
506 harness.check(!( Math.max( 0 , -0 ) != 0 ), |
|
507 "test_max - 5" ); |
|
508 |
|
509 |
|
510 harness.check(!( Math.max( 100L , 12L ) != 100L ), |
|
511 "test_max - 6" ); |
|
512 |
|
513 harness.check(!( Math.max( Long.MAX_VALUE , Long.MAX_VALUE - 1 ) != Long.MAX_VALUE ), |
|
514 "test_max - 7" ); |
|
515 |
|
516 harness.check(!( Math.max( Long.MIN_VALUE , Long.MIN_VALUE +1 ) != Long.MIN_VALUE + 1 ), |
|
517 "test_max - 8" ); |
|
518 |
|
519 harness.check(!( Math.max( 10L , 10L ) != 10L ), |
|
520 "test_max - 9" ); |
|
521 |
|
522 harness.check(!( Math.max( 0L , -0L ) != 0L ), |
|
523 "test_max - 10" ); |
|
524 |
|
525 |
|
526 harness.check(!( Math.max( 23.4f , 12.3f ) != 23.4f ), |
|
527 "test_max - 11" ); |
|
528 |
|
529 harness.check(!( !(new Float(Math.max( Float.NaN , 1.0f ))).isNaN() ), |
|
530 "test_max - 12" ); |
|
531 |
|
532 harness.check(!( Math.max( 10.0f , 10.0f ) != 10.0f ), |
|
533 "test_max - 13" ); |
|
534 |
|
535 harness.check(!( Math.max( 0.0f , -0.0f ) != 0.0f ), |
|
536 "test_max - 14" ); |
|
537 |
|
538 |
|
539 harness.check(!( Math.max( 23.4 , 12.3 ) != 23.4 ), |
|
540 "test_max - 15" ); |
|
541 |
|
542 harness.check(!( !(new Double(Math.max( Double.NaN , 1.0 ))).isNaN() ), |
|
543 "test_max - 16" ); |
|
544 |
|
545 harness.check(!( Math.max( 10.0 , 10.0 ) != 10.0 ), |
|
546 "test_max - 17" ); |
|
547 |
|
548 harness.check(!( Math.max( 0.0 , -0.0 ) != 0.0 ), |
|
549 "test_max - 18" ); |
|
550 } |
|
551 |
|
552 |
|
553 public void testall() |
|
554 { |
|
555 test_Basics(); |
|
556 test_sincostan(); |
|
557 test_asinacosatan(); |
|
558 test_atan2(); |
|
559 test_log(); |
|
560 test_exp(); |
|
561 test_sqrt(); |
|
562 test_pow(); |
|
563 test_IEEEremainder(); |
|
564 test_ceil(); |
|
565 test_floor(); |
|
566 test_rint(); |
|
567 test_round(); |
|
568 test_random(); |
|
569 test_abs(); |
|
570 test_min(); |
|
571 test_max(); |
|
572 } |
|
573 |
|
574 public void test (TestHarness the_harness) |
|
575 { |
|
576 harness = the_harness; |
|
577 testall (); |
|
578 } |
|
579 |
|
580 } |
|