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

Side by Side Diff: tests/corelib/src/MathTest.dart

Issue 9264051: Fix for bug 1229: Unary operator plus is not allowed ... except for literals. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class MathTest { 5 class MathTest {
6 static void testConstants() { 6 static void testConstants() {
7 // Source for mathematical constants is Wolfram Alpha. 7 // Source for mathematical constants is Wolfram Alpha.
8 Expect.equals(2.7182818284590452353602874713526624977572470936999595749669, 8 Expect.equals(2.7182818284590452353602874713526624977572470936999595749669,
9 Math.E); 9 Math.E);
10 Expect.equals(2.3025850929940456840179914546843642076011014886287729760333, 10 Expect.equals(2.3025850929940456840179914546843642076011014886287729760333,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 Expect.equals(true, parseIntThrowsBadNumberFormatException("0x3.1")); 223 Expect.equals(true, parseIntThrowsBadNumberFormatException("0x3.1"));
224 Expect.equals(true, parseIntThrowsBadNumberFormatException("5.")); 224 Expect.equals(true, parseIntThrowsBadNumberFormatException("5."));
225 Expect.equals(true, parseIntThrowsBadNumberFormatException("+-5")); 225 Expect.equals(true, parseIntThrowsBadNumberFormatException("+-5"));
226 Expect.equals(true, parseIntThrowsBadNumberFormatException("-+5")); 226 Expect.equals(true, parseIntThrowsBadNumberFormatException("-+5"));
227 Expect.equals(true, parseIntThrowsBadNumberFormatException("--5")); 227 Expect.equals(true, parseIntThrowsBadNumberFormatException("--5"));
228 Expect.equals(true, parseIntThrowsBadNumberFormatException("++5")); 228 Expect.equals(true, parseIntThrowsBadNumberFormatException("++5"));
229 Expect.equals(true, parseIntThrowsBadNumberFormatException("+ 5")); 229 Expect.equals(true, parseIntThrowsBadNumberFormatException("+ 5"));
230 Expect.equals(true, parseIntThrowsBadNumberFormatException("- 5")); 230 Expect.equals(true, parseIntThrowsBadNumberFormatException("- 5"));
231 Expect.equals(true, parseIntThrowsBadNumberFormatException("")); 231 Expect.equals(true, parseIntThrowsBadNumberFormatException(""));
232 Expect.equals(true, parseIntThrowsBadNumberFormatException(" ")); 232 Expect.equals(true, parseIntThrowsBadNumberFormatException(" "));
233 Expect.equals(true, parseIntThrowsBadNumberFormatException("+ 1"));
hausner 2012/01/31 18:09:46 Already covered in line 229, but no harm.
233 } 234 }
234 235
235 static bool parseDoubleThrowsBadNumberFormatException(str) { 236 static bool parseDoubleThrowsBadNumberFormatException(str) {
236 try { 237 try {
237 Math.parseDouble(str); 238 Math.parseDouble(str);
238 return false; 239 return false;
239 } catch (BadNumberFormatException e) { 240 } catch (BadNumberFormatException e) {
240 return true; 241 return true;
241 } 242 }
242 } 243 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 testExp(); 364 testExp();
364 testPow(); 365 testPow();
365 testParseInt(); 366 testParseInt();
366 testParseDouble(); 367 testParseDouble();
367 } 368 }
368 } 369 }
369 370
370 main() { 371 main() {
371 MathTest.testMain(); 372 MathTest.testMain();
372 } 373 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698