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

Unified Diff: tests/corelib/src/MathParseDoubleTest.dart

Issue 10244009: test rename overhaul: step 7 - corelib tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: tests/corelib/src/MathParseDoubleTest.dart
diff --git a/tests/corelib/src/MathParseDoubleTest.dart b/tests/corelib/src/MathParseDoubleTest.dart
deleted file mode 100644
index bbc2ca76a9c1a7e59532d4a69f294945905607ec..0000000000000000000000000000000000000000
--- a/tests/corelib/src/MathParseDoubleTest.dart
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-bool parseDoubleThrowsBadNumberFormatException(str) {
- try {
- Math.parseDouble(str);
- return false;
- } catch (BadNumberFormatException e) {
- return true;
- }
-}
-
-void main() {
- Expect.equals(499.0, Math.parseDouble("499"));
- Expect.equals(499.0, Math.parseDouble("499.0"));
- Expect.equals(499.0, Math.parseDouble("499.0"));
- Expect.equals(499.0, Math.parseDouble("+499"));
- Expect.equals(-499.0, Math.parseDouble("-499"));
- Expect.equals(499.0, Math.parseDouble(" 499 "));
- Expect.equals(499.0, Math.parseDouble(" +499 "));
- Expect.equals(-499.0, Math.parseDouble(" -499 "));
- Expect.equals(0.0, Math.parseDouble("0"));
- Expect.equals(0.0, Math.parseDouble("+0"));
- Expect.equals(-0.0, Math.parseDouble("-0"));
- Expect.equals(true, Math.parseDouble("-0").isNegative());
- Expect.equals(0.0, Math.parseDouble(" 0 "));
- Expect.equals(0.0, Math.parseDouble(" +0 "));
- Expect.equals(-0.0, Math.parseDouble(" -0 "));
- Expect.equals(true, Math.parseDouble(" -0 ").isNegative());
- Expect.equals(1.0 * 0x1234567890, Math.parseDouble("0x1234567890"));
- Expect.equals(1.0 * 0x1234567890, Math.parseDouble("+0x1234567890"));
- Expect.equals(1.0 * -0x1234567890, Math.parseDouble("-0x1234567890"));
- Expect.equals(1.0 * 0x1234567890, Math.parseDouble(" 0x1234567890 "));
- Expect.equals(1.0 * 0x1234567890, Math.parseDouble(" +0x1234567890 "));
- Expect.equals(1.0 * -0x1234567890, Math.parseDouble(" -0x1234567890 "));
- Expect.equals(256.0, Math.parseDouble("0x100"));
- Expect.equals(256.0, Math.parseDouble("+0x100"));
- Expect.equals(-256.0, Math.parseDouble("-0x100"));
- Expect.equals(256.0, Math.parseDouble(" 0x100 "));
- Expect.equals(256.0, Math.parseDouble(" +0x100 "));
- Expect.equals(-256.0, Math.parseDouble(" -0x100 "));
- Expect.equals(1.0 * 0xabcdef, Math.parseDouble("0xabcdef"));
- Expect.equals(1.0 * 0xABCDEF, Math.parseDouble("0xABCDEF"));
- Expect.equals(1.0 * 0xabcdef, Math.parseDouble("0xabCDEf"));
- Expect.equals(1.0 * -0xabcdef, Math.parseDouble("-0xabcdef"));
- Expect.equals(1.0 * -0xABCDEF, Math.parseDouble("-0xABCDEF"));
- Expect.equals(1.0 * 0xabcdef, Math.parseDouble(" 0xabcdef "));
- Expect.equals(1.0 * 0xABCDEF, Math.parseDouble(" 0xABCDEF "));
- Expect.equals(1.0 * -0xabcdef, Math.parseDouble(" -0xabcdef "));
- Expect.equals(1.0 * -0xABCDEF, Math.parseDouble(" -0xABCDEF "));
- Expect.equals(1.0 * 0xabcdef, Math.parseDouble("0x00000abcdef"));
- Expect.equals(1.0 * 0xABCDEF, Math.parseDouble("0x00000ABCDEF"));
- Expect.equals(1.0 * -0xabcdef, Math.parseDouble("-0x00000abcdef"));
- Expect.equals(1.0 * -0xABCDEF, Math.parseDouble("-0x00000ABCDEF"));
- Expect.equals(1.0 * 0xabcdef, Math.parseDouble(" 0x00000abcdef "));
- Expect.equals(1.0 * 0xABCDEF, Math.parseDouble(" 0x00000ABCDEF "));
- Expect.equals(1.0 * -0xabcdef, Math.parseDouble(" -0x00000abcdef "));
- Expect.equals(1.0 * -0xABCDEF, Math.parseDouble(" -0x00000ABCDEF "));
- Expect.equals(10.0, Math.parseDouble("010"));
- Expect.equals(-10.0, Math.parseDouble("-010"));
- Expect.equals(10.0, Math.parseDouble(" 010 "));
- Expect.equals(-10.0, Math.parseDouble(" -010 "));
- Expect.equals(0.1, Math.parseDouble("0.1"));
- Expect.equals(0.1, Math.parseDouble(" 0.1 "));
- Expect.equals(0.1, Math.parseDouble(" +0.1 "));
- Expect.equals(-0.1, Math.parseDouble(" -0.1 "));
- Expect.equals(0.1, Math.parseDouble(".1"));
- Expect.equals(0.1, Math.parseDouble(" .1 "));
- Expect.equals(0.1, Math.parseDouble(" +.1 "));
- Expect.equals(-0.1, Math.parseDouble(" -.1 "));
- Expect.equals(1234567.89, Math.parseDouble("1234567.89"));
- Expect.equals(1234567.89, Math.parseDouble(" 1234567.89 "));
- Expect.equals(1234567.89, Math.parseDouble(" +1234567.89 "));
- Expect.equals(-1234567.89, Math.parseDouble(" -1234567.89 "));
- Expect.equals(1234567e89, Math.parseDouble("1234567e89"));
- Expect.equals(1234567e89, Math.parseDouble(" 1234567e89 "));
- Expect.equals(1234567e89, Math.parseDouble(" +1234567e89 "));
- Expect.equals(-1234567e89, Math.parseDouble(" -1234567e89 "));
- Expect.equals(1234567.89e2, Math.parseDouble("1234567.89e2"));
- Expect.equals(1234567.89e2, Math.parseDouble(" 1234567.89e2 "));
- Expect.equals(1234567.89e2, Math.parseDouble(" +1234567.89e2 "));
- Expect.equals(-1234567.89e2, Math.parseDouble(" -1234567.89e2 "));
- Expect.equals(1234567.89e2, Math.parseDouble("1234567.89E2"));
- Expect.equals(1234567.89e2, Math.parseDouble(" 1234567.89E2 "));
- Expect.equals(1234567.89e2, Math.parseDouble(" +1234567.89E2 "));
- Expect.equals(-1234567.89e2, Math.parseDouble(" -1234567.89E2 "));
- Expect.equals(1234567.89e-2, Math.parseDouble("1234567.89e-2"));
- Expect.equals(1234567.89e-2, Math.parseDouble(" 1234567.89e-2 "));
- Expect.equals(1234567.89e-2, Math.parseDouble(" +1234567.89e-2 "));
- Expect.equals(-1234567.89e-2, Math.parseDouble(" -1234567.89e-2 "));
- // TODO(floitsch): add tests for NaN and Infinity.
- Expect.equals(false, parseDoubleThrowsBadNumberFormatException("1.5"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("1b"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" 1b "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" 1 b "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" e3 "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" .e3 "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("00x12"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" 00x12 "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("-1b"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" -1b "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" -1 b "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("-00x12"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" -00x12 "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" -00x12 "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("0x0x12"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("+ 1.5"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("- 1.5"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(""));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("5."));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" 5. "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" +5. "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" -5. "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException("1234567.e2"));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" 1234567.e2 "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" +1234567.e2 "));
- Expect.equals(true, parseDoubleThrowsBadNumberFormatException(" -1234567.e2 "));
-}

Powered by Google App Engine
This is Rietveld 408576698