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

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

Issue 11367087: Added nextIntRange to dartvm and dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // We temporarily test both the new math library and the old Math 5 // We temporarily test both the new math library and the old Math
6 // class. This can easily be simplified once we get rid of the Math 6 // class. This can easily be simplified once we get rid of the Math
7 // class entirely. 7 // class entirely.
8 #library('math_test'); 8 #library('math_test');
9 #import('dart:math', prefix: 'math'); 9 #import('dart:math', prefix: 'math');
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 Expect.equals(true, parseIntThrowsFormatException("+ 5")); 234 Expect.equals(true, parseIntThrowsFormatException("+ 5"));
235 Expect.equals(true, parseIntThrowsFormatException("- 5")); 235 Expect.equals(true, parseIntThrowsFormatException("- 5"));
236 Expect.equals(true, parseIntThrowsFormatException("")); 236 Expect.equals(true, parseIntThrowsFormatException(""));
237 Expect.equals(true, parseIntThrowsFormatException(" ")); 237 Expect.equals(true, parseIntThrowsFormatException(" "));
238 Expect.equals(true, parseIntThrowsFormatException("+0x1234567890")); 238 Expect.equals(true, parseIntThrowsFormatException("+0x1234567890"));
239 Expect.equals(true, parseIntThrowsFormatException(" +0x1234567890 ")); 239 Expect.equals(true, parseIntThrowsFormatException(" +0x1234567890 "));
240 Expect.equals(true, parseIntThrowsFormatException("+0x100")); 240 Expect.equals(true, parseIntThrowsFormatException("+0x100"));
241 Expect.equals(true, parseIntThrowsFormatException(" +0x100 ")); 241 Expect.equals(true, parseIntThrowsFormatException(" +0x100 "));
242 } 242 }
243 243
244 static void testRandom() {
245 math.Random r = new math.Random();
246 checkClose(5, r.nextIntRange(1, 10), 10);
floitsch 2013/11/18 13:36:03 checkClose is typed for doubles. This will throw i
247 checkClose(5, r.nextInt(10), 10);
248 }
249
244 static testMain() { 250 static testMain() {
245 testConstants(); 251 testConstants();
246 testSin(); 252 testSin();
247 testCos(); 253 testCos();
248 testTan(); 254 testTan();
249 testAsin(); 255 testAsin();
250 testAcos(); 256 testAcos();
251 testAtan(); 257 testAtan();
252 testAtan2(); 258 testAtan2();
253 testSqrt(); 259 testSqrt();
254 testLog(); 260 testLog();
255 testExp(); 261 testExp();
256 testPow(); 262 testPow();
257 testParseInt(); 263 testParseInt();
264 testRandom();
258 } 265 }
259 } 266 }
260 267
261 main() { 268 main() {
262 MathLibraryTest.testMain(); 269 MathLibraryTest.testMain();
263 } 270 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698