Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: tests/lib/math/min_max_test.dart

Issue 10829459: Deprecate Math object in corelib in favor of dart:math library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/lib/math/math_parse_double_test.dart ('k') | tests/standalone/io/http_date_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test for testing Math.min and Math.max.
5
6 #library('min_max_test');
7 #import('dart:math');
8
9 testMin() {
10 Expect.equals(0, min(0, 2));
11 Expect.equals(0, min(2, 0));
12
13 Expect.equals(-10, min(-10, -9));
14 Expect.equals(-10, min(-10, 9));
15 Expect.equals(-10, min(-10, 0));
16 Expect.equals(-10, min(-9, -10));
17 Expect.equals(-10, min(9, -10));
18 Expect.equals(-10, min(0, -10));
19
20 Expect.equals(0.5, min(0.5, 2.5));
21 Expect.equals(0.5, min(2.5, 0.5));
22
23 Expect.equals(-10.5, min(-10.5, -9.5));
24 Expect.equals(-10.5, min(-10.5, 9.5));
25 Expect.equals(-10.5, min(-10.5, 0.5));
26 Expect.equals(-10.5, min(-9.5, -10.5));
27 Expect.equals(-10.5, min(9.5, -10.5));
28 Expect.equals(-10.5, min(0.5, -10.5));
29
30 // Test matrix:
31 // NaN, -infinity, -499.0, -499, -0.0, 0.0, 0, 499.0, 499, +infinity.
32 var inf = double.INFINITY;
33 var nan = double.NAN;
34
35 Expect.isTrue(min(nan, nan).isNaN());
36 Expect.isTrue(min(nan, -inf).isNaN());
37 Expect.isTrue(min(nan, -499.0).isNaN());
38 Expect.isTrue(min(nan, -499).isNaN());
39 Expect.isTrue(min(nan, -0.0).isNaN());
40 Expect.isTrue(min(nan, 0.0).isNaN());
41 Expect.isTrue(min(nan, 499.0).isNaN());
42 Expect.isTrue(min(nan, 499).isNaN());
43 Expect.isTrue(min(nan, inf).isNaN());
44
45 Expect.equals(-inf, min(-inf, -inf));
46 Expect.equals(-inf, min(-inf, -499.0));
47 Expect.equals(-inf, min(-inf, -499));
48 Expect.equals(-inf, min(-inf, -0.0));
49 Expect.equals(-inf, min(-inf, 0.0));
50 Expect.equals(-inf, min(-inf, 0));
51 Expect.equals(-inf, min(-inf, 499));
52 Expect.equals(-inf, min(-inf, 499.0));
53 Expect.equals(-inf, min(-inf, inf));
54 Expect.isTrue(min(-inf, nan).isNaN());
55
56 Expect.equals(-inf, min(-499.0, -inf));
57 Expect.equals(-499.0, min(-499.0, -499.0));
58 Expect.equals(-499.0, min(-499.0, -499));
59 Expect.equals(-499.0, min(-499.0, -0.0));
60 Expect.equals(-499.0, min(-499.0, 0.0));
61 Expect.equals(-499.0, min(-499.0, 0));
62 Expect.equals(-499.0, min(-499.0, 499.0));
63 Expect.equals(-499.0, min(-499.0, 499));
64 Expect.equals(-499.0, min(-499.0, inf));
65 Expect.isTrue(min(-499.0, nan).isNaN());
66
67 Expect.isTrue(min(-499.0, -499.0) is double);
68 Expect.isTrue(min(-499.0, -499) is double);
69 Expect.isTrue(min(-499.0, -0.0) is double);
70 Expect.isTrue(min(-499.0, 0.0) is double);
71 Expect.isTrue(min(-499.0, 0) is double);
72 Expect.isTrue(min(-499.0, 499.0) is double);
73 Expect.isTrue(min(-499.0, 499) is double);
74 Expect.isTrue(min(-499.0, inf) is double);
75
76 Expect.equals(-inf, min(-499, -inf));
77 Expect.equals(-499, min(-499, -499.0));
78 Expect.equals(-499, min(-499, -499));
79 Expect.equals(-499, min(-499, -0.0));
80 Expect.equals(-499, min(-499, 0.0));
81 Expect.equals(-499, min(-499, 0));
82 Expect.equals(-499, min(-499, 499.0));
83 Expect.equals(-499, min(-499, 499));
84 Expect.equals(-499, min(-499, inf));
85 Expect.isTrue(min(-499, nan).isNaN());
86
87 Expect.isTrue(min(-499, -499.0) is int);
88 Expect.isTrue(min(-499, -499) is int);
89 Expect.isTrue(min(-499, -0.0) is int);
90 Expect.isTrue(min(-499, 0.0) is int);
91 Expect.isTrue(min(-499, 0) is int);
92 Expect.isTrue(min(-499, 499.0) is int);
93 Expect.isTrue(min(-499, 499) is int);
94 Expect.isTrue(min(-499, inf) is int);
95
96 Expect.equals(-inf, min(-0.0, -inf));
97 Expect.equals(-499.0, min(-0.0, -499.0));
98 Expect.equals(-499, min(-0.0, -499));
99 Expect.equals(-0.0, min(-0.0, -0.0));
100 Expect.equals(-0.0, min(-0.0, 0.0));
101 Expect.equals(-0.0, min(-0.0, 0));
102 Expect.equals(-0.0, min(-0.0, 499.0));
103 Expect.equals(-0.0, min(-0.0, 499));
104 Expect.equals(-0.0, min(-0.0, inf));
105 Expect.isTrue(min(-0.0, nan).isNaN());
106
107 Expect.isTrue(min(-0.0, -499.0) is double);
108 Expect.isTrue(min(-0.0, -499) is int);
109 Expect.isTrue(min(-0.0, -0.0) is double);
110 Expect.isTrue(min(-0.0, 0.0) is double);
111 Expect.isTrue(min(-0.0, 0) is double);
112 Expect.isTrue(min(-0.0, 499.0) is double);
113 Expect.isTrue(min(-0.0, 499) is double);
114 Expect.isTrue(min(-0.0, inf) is double);
115
116 Expect.isTrue(min(-0.0, -499.0).isNegative());
117 Expect.isTrue(min(-0.0, -499).isNegative());
118 Expect.isTrue(min(-0.0, -0.0).isNegative());
119 Expect.isTrue(min(-0.0, 0.0).isNegative());
120 Expect.isTrue(min(-0.0, 0).isNegative());
121 Expect.isTrue(min(-0.0, 499.0).isNegative());
122 Expect.isTrue(min(-0.0, 499).isNegative());
123 Expect.isTrue(min(-0.0, inf).isNegative());
124
125 Expect.equals(-inf, min(0.0, -inf));
126 Expect.equals(-499.0, min(0.0, -499.0));
127 Expect.equals(-499, min(0.0, -499));
128 Expect.equals(-0.0, min(0.0, -0.0));
129 Expect.equals(0.0, min(0.0, 0.0));
130 Expect.equals(0.0, min(0.0, 0));
131 Expect.equals(0.0, min(0.0, 499.0));
132 Expect.equals(0.0, min(0.0, 499));
133 Expect.equals(0.0, min(0.0, inf));
134 Expect.isTrue(min(0.0, nan).isNaN());
135
136 Expect.isTrue(min(0.0, -499.0) is double);
137 Expect.isTrue(min(0.0, -499) is int);
138 Expect.isTrue(min(0.0, -0.0) is double);
139 Expect.isTrue(min(0.0, 0.0) is double);
140 Expect.isTrue(min(0.0, 0) is double);
141 Expect.isTrue(min(0.0, 499.0) is double);
142 Expect.isTrue(min(0.0, 499) is double);
143 Expect.isTrue(min(0.0, inf) is double);
144
145 Expect.isTrue(min(0.0, -499.0).isNegative());
146 Expect.isTrue(min(0.0, -499).isNegative());
147 Expect.isTrue(min(0.0, -0.0).isNegative());
148 Expect.isFalse(min(0.0, 0.0).isNegative());
149 Expect.isFalse(min(0.0, 0).isNegative());
150 Expect.isFalse(min(0.0, 499.0).isNegative());
151 Expect.isFalse(min(0.0, 499).isNegative());
152 Expect.isFalse(min(0.0, inf).isNegative());
153
154 Expect.equals(-inf, min(0, -inf));
155 Expect.equals(-499.0, min(0, -499.0));
156 Expect.equals(-499, min(0, -499));
157 Expect.equals(-0.0, min(0, -0.0));
158 Expect.equals(0, min(0, 0.0));
159 Expect.equals(0, min(0, 0));
160 Expect.equals(0, min(0, 499.0));
161 Expect.equals(0, min(0, 499));
162 Expect.equals(0, min(0, inf));
163 Expect.isTrue(min(0, nan).isNaN());
164
165 Expect.isTrue(min(0, -499.0) is double);
166 Expect.isTrue(min(0, -499) is int);
167 Expect.isTrue(min(0, -0.0) is double);
168 Expect.isTrue(min(0, 0.0) is int);
169 Expect.isTrue(min(0, 0) is int);
170 Expect.isTrue(min(0, 499.0) is int);
171 Expect.isTrue(min(0, 499) is int);
172 Expect.isTrue(min(0, inf) is int);
173
174 Expect.isTrue(min(0, -499.0).isNegative());
175 Expect.isTrue(min(0, -499).isNegative());
176 Expect.isTrue(min(0, -0.0).isNegative());
177 Expect.isFalse(min(0, 0.0).isNegative());
178 Expect.isFalse(min(0, 0).isNegative());
179 Expect.isFalse(min(0, 499.0).isNegative());
180 Expect.isFalse(min(0, 499).isNegative());
181 Expect.isFalse(min(0, inf).isNegative());
182
183 Expect.equals(-inf, min(499.0, -inf));
184 Expect.equals(-499.0, min(499.0, -499.0));
185 Expect.equals(-499, min(499.0, -499));
186 Expect.equals(-0.0, min(499.0, -0.0));
187 Expect.equals(0.0, min(499.0, 0.0));
188 Expect.equals(0, min(499.0, 0));
189 Expect.equals(499.0, min(499.0, 499.0));
190 Expect.equals(499.0, min(499.0, 499));
191 Expect.equals(499.0, min(499.0, inf));
192 Expect.isTrue(min(499.0, nan).isNaN());
193
194 Expect.isTrue(min(499.0, -499.0) is double);
195 Expect.isTrue(min(499.0, -499) is int);
196 Expect.isTrue(min(499.0, -0.0) is double);
197 Expect.isTrue(min(499.0, 0.0) is double);
198 Expect.isTrue(min(499.0, 0) is int);
199 Expect.isTrue(min(499.0, 499) is double);
200 Expect.isTrue(min(499.0, 499.0) is double);
201 Expect.isTrue(min(499.0, inf) is double);
202
203 Expect.isTrue(min(499.0, -499.0).isNegative());
204 Expect.isTrue(min(499.0, -499).isNegative());
205 Expect.isTrue(min(499.0, -0.0).isNegative());
206 Expect.isFalse(min(499.0, 0.0).isNegative());
207 Expect.isFalse(min(499.0, 0).isNegative());
208 Expect.isFalse(min(499.0, 499).isNegative());
209 Expect.isFalse(min(499.0, 499.0).isNegative());
210 Expect.isFalse(min(499.0, inf).isNegative());
211
212 Expect.equals(-inf, min(499, -inf));
213 Expect.equals(-499.0, min(499, -499.0));
214 Expect.equals(-499, min(499, -499));
215 Expect.equals(-0.0, min(499, -0.0));
216 Expect.equals(0.0, min(499, 0.0));
217 Expect.equals(0, min(499, 0));
218 Expect.equals(499, min(499, 499.0));
219 Expect.equals(499, min(499, 499));
220 Expect.equals(499, min(499, inf));
221 Expect.isTrue(min(499, nan).isNaN());
222
223 Expect.isTrue(min(499, -499.0) is double);
224 Expect.isTrue(min(499, -499) is int);
225 Expect.isTrue(min(499, -0.0) is double);
226 Expect.isTrue(min(499, 0.0) is double);
227 Expect.isTrue(min(499, 0) is int);
228 Expect.isTrue(min(499, 499.0) is int);
229 Expect.isTrue(min(499, 499) is int);
230 Expect.isTrue(min(499, inf) is int);
231
232 Expect.isTrue(min(499, -499.0).isNegative());
233 Expect.isTrue(min(499, -499).isNegative());
234 Expect.isTrue(min(499, -0.0).isNegative());
235 Expect.isFalse(min(499, 0.0).isNegative());
236 Expect.isFalse(min(499, 0).isNegative());
237 Expect.isFalse(min(499, 499.0).isNegative());
238 Expect.isFalse(min(499, 499).isNegative());
239 Expect.isFalse(min(499, inf).isNegative());
240
241 Expect.equals(-inf, min(inf, -inf));
242 Expect.equals(-499.0, min(inf, -499.0));
243 Expect.equals(-499, min(inf, -499));
244 Expect.equals(-0.0, min(inf, -0.0));
245 Expect.equals(0.0, min(inf, 0.0));
246 Expect.equals(0, min(inf, 0));
247 Expect.equals(499.0, min(inf, 499.0));
248 Expect.equals(499, min(inf, 499));
249 Expect.equals(inf, min(inf, inf));
250 Expect.isTrue(min(inf, nan).isNaN());
251
252 Expect.isTrue(min(inf, -499.0) is double);
253 Expect.isTrue(min(inf, -499) is int);
254 Expect.isTrue(min(inf, -0.0) is double);
255 Expect.isTrue(min(inf, 0.0) is double);
256 Expect.isTrue(min(inf, 0) is int);
257 Expect.isTrue(min(inf, 499) is int);
258 Expect.isTrue(min(inf, 499.0) is double);
259 Expect.isTrue(min(inf, inf) is double);
260
261 Expect.isTrue(min(inf, -499.0).isNegative());
262 Expect.isTrue(min(inf, -499).isNegative());
263 Expect.isTrue(min(inf, -0.0).isNegative());
264 Expect.isFalse(min(inf, 0.0).isNegative());
265 Expect.isFalse(min(inf, 0).isNegative());
266 Expect.isFalse(min(inf, 499).isNegative());
267 Expect.isFalse(min(inf, 499.0).isNegative());
268 Expect.isFalse(min(inf, inf).isNegative());
269 }
270
271 testMax() {
272 Expect.equals(2, max(0, 2));
273 Expect.equals(2, max(2, 0));
274
275 Expect.equals(-9, max(-10, -9));
276 Expect.equals(9, max(-10, 9));
277 Expect.equals(0, max(-10, 0));
278 Expect.equals(-9, max(-9, -10));
279 Expect.equals(9, max(9, -10));
280 Expect.equals(0, max(0, -10));
281
282 Expect.equals(2.5, max(0.5, 2.5));
283 Expect.equals(2.5, max(2.5, 0.5));
284
285 Expect.equals(-9.5, max(-10.5, -9.5));
286 Expect.equals(9.5, max(-10.5, 9.5));
287 Expect.equals(0.5, max(-10.5, 0.5));
288 Expect.equals(-9.5, max(-9.5, -10.5));
289 Expect.equals(9.5, max(9.5, -10.5));
290 Expect.equals(0.5, max(0.5, -10.5));
291
292 // Test matrix:
293 // NaN, infinity, 499.0, 499, 0.0, 0, -0.0, -499.0, -499, -infinity.
294 var inf = double.INFINITY;
295 var nan = double.NAN;
296
297 Expect.isTrue(max(nan, nan).isNaN());
298 Expect.isTrue(max(nan, -inf).isNaN());
299 Expect.isTrue(max(nan, -499.0).isNaN());
300 Expect.isTrue(max(nan, -499).isNaN());
301 Expect.isTrue(max(nan, -0.0).isNaN());
302 Expect.isTrue(max(nan, 0.0).isNaN());
303 Expect.isTrue(max(nan, 499.0).isNaN());
304 Expect.isTrue(max(nan, 499).isNaN());
305 Expect.isTrue(max(nan, inf).isNaN());
306
307 Expect.equals(inf, max(inf, inf));
308 Expect.equals(inf, max(inf, 499.0));
309 Expect.equals(inf, max(inf, 499));
310 Expect.equals(inf, max(inf, 0.0));
311 Expect.equals(inf, max(inf, 0));
312 Expect.equals(inf, max(inf, -0.0));
313 Expect.equals(inf, max(inf, -499));
314 Expect.equals(inf, max(inf, -499.0));
315 Expect.equals(inf, max(inf, -inf));
316 Expect.isTrue(max(inf, nan).isNaN());
317
318 Expect.equals(inf, max(499.0, inf));
319 Expect.equals(499.0, max(499.0, 499.0));
320 Expect.equals(499.0, max(499.0, 499));
321 Expect.equals(499.0, max(499.0, 0.0));
322 Expect.equals(499.0, max(499.0, 0));
323 Expect.equals(499.0, max(499.0, -0.0));
324 Expect.equals(499.0, max(499.0, -499));
325 Expect.equals(499.0, max(499.0, -499.0));
326 Expect.equals(499.0, max(499.0, -inf));
327 Expect.isTrue(max(499.0, nan).isNaN());
328
329 Expect.isTrue(max(499.0, 499.0) is double);
330 Expect.isTrue(max(499.0, 499) is double);
331 Expect.isTrue(max(499.0, 0.0) is double);
332 Expect.isTrue(max(499.0, 0) is double);
333 Expect.isTrue(max(499.0, -0.0) is double);
334 Expect.isTrue(max(499.0, -499) is double);
335 Expect.isTrue(max(499.0, -499.0) is double);
336 Expect.isTrue(max(499.0, -inf) is double);
337
338 Expect.equals(inf, max(499, inf));
339 Expect.equals(499, max(499, 499.0));
340 Expect.equals(499, max(499, 499));
341 Expect.equals(499, max(499, 0.0));
342 Expect.equals(499, max(499, 0));
343 Expect.equals(499, max(499, -0.0));
344 Expect.equals(499, max(499, -499));
345 Expect.equals(499, max(499, -499.0));
346 Expect.equals(499, max(499, -inf));
347 Expect.isTrue(max(499, nan).isNaN());
348
349 Expect.isTrue(max(499, 499.0) is int);
350 Expect.isTrue(max(499, 499) is int);
351 Expect.isTrue(max(499, 0.0) is int);
352 Expect.isTrue(max(499, 0) is int);
353 Expect.isTrue(max(499, -0.0) is int);
354 Expect.isTrue(max(499, -499) is int);
355 Expect.isTrue(max(499, -499.0) is int);
356 Expect.isTrue(max(499, -inf) is int);
357
358 Expect.equals(inf, max(0.0, inf));
359 Expect.equals(499.0, max(0.0, 499.0));
360 Expect.equals(499, max(0.0, 499));
361 Expect.equals(0.0, max(0.0, 0.0));
362 Expect.equals(0.0, max(0.0, 0));
363 Expect.equals(0.0, max(0.0, -0.0));
364 Expect.equals(0.0, max(0.0, -499));
365 Expect.equals(0.0, max(0.0, -499.0));
366 Expect.equals(0.0, max(0.0, -inf));
367 Expect.isTrue(max(0.0, nan).isNaN());
368
369 Expect.isTrue(max(0.0, 499.0) is double);
370 Expect.isTrue(max(0.0, 499) is int);
371 Expect.isTrue(max(0.0, 0.0) is double);
372 Expect.isTrue(max(0.0, 0) is double);
373 Expect.isTrue(max(0.0, -0.0) is double);
374 Expect.isTrue(max(0.0, -499) is double);
375 Expect.isTrue(max(0.0, -499.0) is double);
376 Expect.isTrue(max(0.0, -inf) is double);
377
378 Expect.isFalse(max(0.0, 0.0).isNegative());
379 Expect.isFalse(max(0.0, 0).isNegative());
380 Expect.isFalse(max(0.0, -0.0).isNegative());
381 Expect.isFalse(max(0.0, -499).isNegative());
382 Expect.isFalse(max(0.0, -499.0).isNegative());
383 Expect.isFalse(max(0.0, -inf).isNegative());
384
385 Expect.equals(inf, max(0, inf));
386 Expect.equals(499.0, max(0, 499.0));
387 Expect.equals(499, max(0, 499));
388 Expect.equals(0, max(0, 0.0));
389 Expect.equals(0, max(0, 0));
390 Expect.equals(0, max(0, -0.0));
391 Expect.equals(0, max(0, -499));
392 Expect.equals(0, max(0, -499.0));
393 Expect.equals(0, max(0, -inf));
394 Expect.isTrue(max(0, nan).isNaN());
395
396 Expect.isTrue(max(0, 499.0) is double);
397 Expect.isTrue(max(0, 499) is int);
398 Expect.isTrue(max(0, 0.0) is int);
399 Expect.isTrue(max(0, 0) is int);
400 Expect.isTrue(max(0, -0.0) is int);
401 Expect.isTrue(max(0, -499) is int);
402 Expect.isTrue(max(0, -499.0) is int);
403 Expect.isTrue(max(0, -inf) is int);
404
405 Expect.isFalse(max(0, 0.0).isNegative());
406 Expect.isFalse(max(0, 0).isNegative());
407 Expect.isFalse(max(0, -0.0).isNegative());
408 Expect.isFalse(max(0, -499).isNegative());
409 Expect.isFalse(max(0, -499.0).isNegative());
410 Expect.isFalse(max(0, -inf).isNegative());
411
412 Expect.equals(inf, max(-0.0, inf));
413 Expect.equals(499.0, max(-0.0, 499.0));
414 Expect.equals(499, max(-0.0, 499));
415 Expect.equals(0.0, max(-0.0, 0.0));
416 Expect.equals(0.0, max(-0.0, 0));
417 Expect.equals(-0.0, max(-0.0, -0.0));
418 Expect.equals(-0.0, max(-0.0, -499));
419 Expect.equals(-0.0, max(-0.0, -499.0));
420 Expect.equals(-0.0, max(-0.0, -inf));
421 Expect.isTrue(max(-0.0, nan).isNaN());
422
423 Expect.isTrue(max(-0.0, 499.0) is double);
424 Expect.isTrue(max(-0.0, 499) is int);
425 Expect.isTrue(max(-0.0, 0.0) is double);
426 Expect.isTrue(max(-0.0, 0) is int);
427 Expect.isTrue(max(-0.0, -0.0) is double);
428 Expect.isTrue(max(-0.0, -499) is double);
429 Expect.isTrue(max(-0.0, -499.0) is double);
430 Expect.isTrue(max(-0.0, -inf) is double);
431
432 Expect.isFalse(max(-0.0, 0.0).isNegative());
433 Expect.isFalse(max(-0.0, 0).isNegative());
434 Expect.isTrue(max(-0.0, -0.0).isNegative());
435 Expect.isTrue(max(-0.0, -499).isNegative());
436 Expect.isTrue(max(-0.0, -499.0).isNegative());
437 Expect.isTrue(max(-0.0, -inf).isNegative());
438
439 Expect.equals(inf, max(-499, inf));
440 Expect.equals(499.0, max(-499, 499.0));
441 Expect.equals(499, max(-499, 499));
442 Expect.equals(0.0, max(-499, 0.0));
443 Expect.equals(0.0, max(-499, 0));
444 Expect.equals(-0.0, max(-499, -0.0));
445 Expect.equals(-499, max(-499, -499));
446 Expect.equals(-499, max(-499, -499.0));
447 Expect.equals(-499, max(-499, -inf));
448 Expect.isTrue(max(-499, nan).isNaN());
449
450 Expect.isTrue(max(-499, 499.0) is double);
451 Expect.isTrue(max(-499, 499) is int);
452 Expect.isTrue(max(-499, 0.0) is double);
453 Expect.isTrue(max(-499, 0) is int);
454 Expect.isTrue(max(-499, -0.0) is double);
455 Expect.isTrue(max(-499, -499) is int);
456 Expect.isTrue(max(-499, -499.0) is int);
457 Expect.isTrue(max(-499, -inf) is int);
458
459 Expect.isFalse(max(-499, 0.0).isNegative());
460 Expect.isFalse(max(-499, 0).isNegative());
461 Expect.isTrue(max(-499, -0.0).isNegative());
462 Expect.isTrue(max(-499, -499).isNegative());
463 Expect.isTrue(max(-499, -499.0).isNegative());
464 Expect.isTrue(max(-499, -inf).isNegative());
465
466 Expect.equals(inf, max(-499.0, inf));
467 Expect.equals(499.0, max(-499.0, 499.0));
468 Expect.equals(499, max(-499.0, 499));
469 Expect.equals(0.0, max(-499.0, 0.0));
470 Expect.equals(0.0, max(-499.0, 0));
471 Expect.equals(-0.0, max(-499.0, -0.0));
472 Expect.equals(-499.0, max(-499.0, -499));
473 Expect.equals(-499.0, max(-499.0, -499.0));
474 Expect.equals(-499.0, max(-499.0, -inf));
475 Expect.isTrue(max(-499.0, nan).isNaN());
476
477 Expect.isTrue(max(-499.0, 499.0) is double);
478 Expect.isTrue(max(-499.0, 499) is int);
479 Expect.isTrue(max(-499.0, 0.0) is double);
480 Expect.isTrue(max(-499.0, 0) is int);
481 Expect.isTrue(max(-499.0, -0.0) is double);
482 Expect.isTrue(max(-499.0, -499) is double);
483 Expect.isTrue(max(-499.0, -499.0) is double);
484 Expect.isTrue(max(-499.0, -inf) is double);
485
486 Expect.isFalse(max(-499.0, 0.0).isNegative());
487 Expect.isFalse(max(-499.0, 0).isNegative());
488 Expect.isTrue(max(-499.0, -0.0).isNegative());
489 Expect.isTrue(max(-499.0, -499).isNegative());
490 Expect.isTrue(max(-499.0, -499.0).isNegative());
491 Expect.isTrue(max(-499.0, -inf).isNegative());
492
493 Expect.equals(inf, max(-inf, inf));
494 Expect.equals(499.0, max(-inf, 499.0));
495 Expect.equals(499, max(-inf, 499));
496 Expect.equals(0.0, max(-inf, 0.0));
497 Expect.equals(0.0, max(-inf, 0));
498 Expect.equals(-0.0, max(-inf, -0.0));
499 Expect.equals(-499, max(-inf, -499));
500 Expect.equals(-499.0, max(-inf, -499.0));
501 Expect.equals(-inf, max(-inf, -inf));
502 Expect.isTrue(max(-inf, nan).isNaN());
503
504 Expect.isTrue(max(-inf, 499.0) is double);
505 Expect.isTrue(max(-inf, 499) is int);
506 Expect.isTrue(max(-inf, 0.0) is double);
507 Expect.isTrue(max(-inf, 0) is int);
508 Expect.isTrue(max(-inf, -0.0) is double);
509 Expect.isTrue(max(-inf, -499) is int);
510 Expect.isTrue(max(-inf, -499.0) is double);
511 Expect.isTrue(max(-inf, -inf) is double);
512
513 Expect.isFalse(max(-inf, 0.0).isNegative());
514 Expect.isFalse(max(-inf, 0).isNegative());
515 Expect.isTrue(max(-inf, -0.0).isNegative());
516 Expect.isTrue(max(-inf, -499).isNegative());
517 Expect.isTrue(max(-inf, -499.0).isNegative());
518 Expect.isTrue(max(-inf, -inf).isNegative());
519 }
520
521 main() {
522 testMin();
523 testMax();
524 }
OLDNEW
« no previous file with comments | « tests/lib/math/math_parse_double_test.dart ('k') | tests/standalone/io/http_date_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698