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

Unified Diff: tests/lib/math/math_parse_double_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« no previous file with comments | « tests/lib/math/math2_test.dart ('k') | tests/lib/math/math_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/math/math_parse_double_test.dart
diff --git a/tests/lib/math/math_parse_double_test.dart b/tests/lib/math/math_parse_double_test.dart
index fe2393c7e16099658c80e720b24c7c4c73dac931..fb6b3fac663dbf6b68952bf43edf3e7de66e6d63 100644
--- a/tests/lib/math/math_parse_double_test.dart
+++ b/tests/lib/math/math_parse_double_test.dart
@@ -7,87 +7,85 @@
// class entirely.
library math_parse_double_test;
-import 'dart:math';
-
void parseDoubleThrowsFormatException(str) {
- Expect.throws(() => parseDouble(str), (e) => e is FormatException);
+ Expect.throws(() => double.parse(str), (e) => e is FormatException);
}
void main() {
- Expect.equals(499.0, parseDouble("499"));
- Expect.equals(499.0, parseDouble("499.0"));
- Expect.equals(499.0, parseDouble("499.0"));
- Expect.equals(499.0, parseDouble("+499"));
- Expect.equals(-499.0, parseDouble("-499"));
- Expect.equals(499.0, parseDouble(" 499 "));
- Expect.equals(499.0, parseDouble(" +499 "));
- Expect.equals(-499.0, parseDouble(" -499 "));
- Expect.equals(0.0, parseDouble("0"));
- Expect.equals(0.0, parseDouble("+0"));
- Expect.equals(-0.0, parseDouble("-0"));
- Expect.equals(true, parseDouble("-0").isNegative);
- Expect.equals(0.0, parseDouble(" 0 "));
- Expect.equals(0.0, parseDouble(" +0 "));
- Expect.equals(-0.0, parseDouble(" -0 "));
- Expect.equals(true, parseDouble(" -0 ").isNegative);
- Expect.equals(1.0 * 0x1234567890, parseDouble("0x1234567890"));
- Expect.equals(1.0 * -0x1234567890, parseDouble("-0x1234567890"));
- Expect.equals(1.0 * 0x1234567890, parseDouble(" 0x1234567890 "));
- Expect.equals(1.0 * -0x1234567890, parseDouble(" -0x1234567890 "));
- Expect.equals(256.0, parseDouble("0x100"));
- Expect.equals(-256.0, parseDouble("-0x100"));
- Expect.equals(256.0, parseDouble(" 0x100 "));
- Expect.equals(-256.0, parseDouble(" -0x100 "));
- Expect.equals(1.0 * 0xabcdef, parseDouble("0xabcdef"));
- Expect.equals(1.0 * 0xABCDEF, parseDouble("0xABCDEF"));
- Expect.equals(1.0 * 0xabcdef, parseDouble("0xabCDEf"));
- Expect.equals(1.0 * -0xabcdef, parseDouble("-0xabcdef"));
- Expect.equals(1.0 * -0xABCDEF, parseDouble("-0xABCDEF"));
- Expect.equals(1.0 * 0xabcdef, parseDouble(" 0xabcdef "));
- Expect.equals(1.0 * 0xABCDEF, parseDouble(" 0xABCDEF "));
- Expect.equals(1.0 * -0xabcdef, parseDouble(" -0xabcdef "));
- Expect.equals(1.0 * -0xABCDEF, parseDouble(" -0xABCDEF "));
- Expect.equals(1.0 * 0xabcdef, parseDouble("0x00000abcdef"));
- Expect.equals(1.0 * 0xABCDEF, parseDouble("0x00000ABCDEF"));
- Expect.equals(1.0 * -0xabcdef, parseDouble("-0x00000abcdef"));
- Expect.equals(1.0 * -0xABCDEF, parseDouble("-0x00000ABCDEF"));
- Expect.equals(1.0 * 0xabcdef, parseDouble(" 0x00000abcdef "));
- Expect.equals(1.0 * 0xABCDEF, parseDouble(" 0x00000ABCDEF "));
- Expect.equals(1.0 * -0xabcdef, parseDouble(" -0x00000abcdef "));
- Expect.equals(1.0 * -0xABCDEF, parseDouble(" -0x00000ABCDEF "));
- Expect.equals(10.0, parseDouble("010"));
- Expect.equals(-10.0, parseDouble("-010"));
- Expect.equals(10.0, parseDouble(" 010 "));
- Expect.equals(-10.0, parseDouble(" -010 "));
- Expect.equals(0.1, parseDouble("0.1"));
- Expect.equals(0.1, parseDouble(" 0.1 "));
- Expect.equals(0.1, parseDouble(" +0.1 "));
- Expect.equals(-0.1, parseDouble(" -0.1 "));
- Expect.equals(0.1, parseDouble(".1"));
- Expect.equals(0.1, parseDouble(" .1 "));
- Expect.equals(0.1, parseDouble(" +.1 "));
- Expect.equals(-0.1, parseDouble(" -.1 "));
- Expect.equals(1.5, parseDouble("1.5"));
- Expect.equals(1234567.89, parseDouble("1234567.89"));
- Expect.equals(1234567.89, parseDouble(" 1234567.89 "));
- Expect.equals(1234567.89, parseDouble(" +1234567.89 "));
- Expect.equals(-1234567.89, parseDouble(" -1234567.89 "));
- Expect.equals(1234567e89, parseDouble("1234567e89"));
- Expect.equals(1234567e89, parseDouble(" 1234567e89 "));
- Expect.equals(1234567e89, parseDouble(" +1234567e89 "));
- Expect.equals(-1234567e89, parseDouble(" -1234567e89 "));
- Expect.equals(1234567.89e2, parseDouble("1234567.89e2"));
- Expect.equals(1234567.89e2, parseDouble(" 1234567.89e2 "));
- Expect.equals(1234567.89e2, parseDouble(" +1234567.89e2 "));
- Expect.equals(-1234567.89e2, parseDouble(" -1234567.89e2 "));
- Expect.equals(1234567.89e2, parseDouble("1234567.89E2"));
- Expect.equals(1234567.89e2, parseDouble(" 1234567.89E2 "));
- Expect.equals(1234567.89e2, parseDouble(" +1234567.89E2 "));
- Expect.equals(-1234567.89e2, parseDouble(" -1234567.89E2 "));
- Expect.equals(1234567.89e-2, parseDouble("1234567.89e-2"));
- Expect.equals(1234567.89e-2, parseDouble(" 1234567.89e-2 "));
- Expect.equals(1234567.89e-2, parseDouble(" +1234567.89e-2 "));
- Expect.equals(-1234567.89e-2, parseDouble(" -1234567.89e-2 "));
+ Expect.equals(499.0, double.parse("499"));
+ Expect.equals(499.0, double.parse("499.0"));
+ Expect.equals(499.0, double.parse("499.0"));
+ Expect.equals(499.0, double.parse("+499"));
+ Expect.equals(-499.0, double.parse("-499"));
+ Expect.equals(499.0, double.parse(" 499 "));
+ Expect.equals(499.0, double.parse(" +499 "));
+ Expect.equals(-499.0, double.parse(" -499 "));
+ Expect.equals(0.0, double.parse("0"));
+ Expect.equals(0.0, double.parse("+0"));
+ Expect.equals(-0.0, double.parse("-0"));
+ Expect.equals(true, double.parse("-0").isNegative);
+ Expect.equals(0.0, double.parse(" 0 "));
+ Expect.equals(0.0, double.parse(" +0 "));
+ Expect.equals(-0.0, double.parse(" -0 "));
+ Expect.equals(true, double.parse(" -0 ").isNegative);
+ Expect.equals(1.0 * 0x1234567890, double.parse("0x1234567890"));
+ Expect.equals(1.0 * -0x1234567890, double.parse("-0x1234567890"));
+ Expect.equals(1.0 * 0x1234567890, double.parse(" 0x1234567890 "));
+ Expect.equals(1.0 * -0x1234567890, double.parse(" -0x1234567890 "));
+ Expect.equals(256.0, double.parse("0x100"));
+ Expect.equals(-256.0, double.parse("-0x100"));
+ Expect.equals(256.0, double.parse(" 0x100 "));
+ Expect.equals(-256.0, double.parse(" -0x100 "));
+ Expect.equals(1.0 * 0xabcdef, double.parse("0xabcdef"));
+ Expect.equals(1.0 * 0xABCDEF, double.parse("0xABCDEF"));
+ Expect.equals(1.0 * 0xabcdef, double.parse("0xabCDEf"));
+ Expect.equals(1.0 * -0xabcdef, double.parse("-0xabcdef"));
+ Expect.equals(1.0 * -0xABCDEF, double.parse("-0xABCDEF"));
+ Expect.equals(1.0 * 0xabcdef, double.parse(" 0xabcdef "));
+ Expect.equals(1.0 * 0xABCDEF, double.parse(" 0xABCDEF "));
+ Expect.equals(1.0 * -0xabcdef, double.parse(" -0xabcdef "));
+ Expect.equals(1.0 * -0xABCDEF, double.parse(" -0xABCDEF "));
+ Expect.equals(1.0 * 0xabcdef, double.parse("0x00000abcdef"));
+ Expect.equals(1.0 * 0xABCDEF, double.parse("0x00000ABCDEF"));
+ Expect.equals(1.0 * -0xabcdef, double.parse("-0x00000abcdef"));
+ Expect.equals(1.0 * -0xABCDEF, double.parse("-0x00000ABCDEF"));
+ Expect.equals(1.0 * 0xabcdef, double.parse(" 0x00000abcdef "));
+ Expect.equals(1.0 * 0xABCDEF, double.parse(" 0x00000ABCDEF "));
+ Expect.equals(1.0 * -0xabcdef, double.parse(" -0x00000abcdef "));
+ Expect.equals(1.0 * -0xABCDEF, double.parse(" -0x00000ABCDEF "));
+ Expect.equals(10.0, double.parse("010"));
+ Expect.equals(-10.0, double.parse("-010"));
+ Expect.equals(10.0, double.parse(" 010 "));
+ Expect.equals(-10.0, double.parse(" -010 "));
+ Expect.equals(0.1, double.parse("0.1"));
+ Expect.equals(0.1, double.parse(" 0.1 "));
+ Expect.equals(0.1, double.parse(" +0.1 "));
+ Expect.equals(-0.1, double.parse(" -0.1 "));
+ Expect.equals(0.1, double.parse(".1"));
+ Expect.equals(0.1, double.parse(" .1 "));
+ Expect.equals(0.1, double.parse(" +.1 "));
+ Expect.equals(-0.1, double.parse(" -.1 "));
+ Expect.equals(1.5, double.parse("1.5"));
+ Expect.equals(1234567.89, double.parse("1234567.89"));
+ Expect.equals(1234567.89, double.parse(" 1234567.89 "));
+ Expect.equals(1234567.89, double.parse(" +1234567.89 "));
+ Expect.equals(-1234567.89, double.parse(" -1234567.89 "));
+ Expect.equals(1234567e89, double.parse("1234567e89"));
+ Expect.equals(1234567e89, double.parse(" 1234567e89 "));
+ Expect.equals(1234567e89, double.parse(" +1234567e89 "));
+ Expect.equals(-1234567e89, double.parse(" -1234567e89 "));
+ Expect.equals(1234567.89e2, double.parse("1234567.89e2"));
+ Expect.equals(1234567.89e2, double.parse(" 1234567.89e2 "));
+ Expect.equals(1234567.89e2, double.parse(" +1234567.89e2 "));
+ Expect.equals(-1234567.89e2, double.parse(" -1234567.89e2 "));
+ Expect.equals(1234567.89e2, double.parse("1234567.89E2"));
+ Expect.equals(1234567.89e2, double.parse(" 1234567.89E2 "));
+ Expect.equals(1234567.89e2, double.parse(" +1234567.89E2 "));
+ Expect.equals(-1234567.89e2, double.parse(" -1234567.89E2 "));
+ Expect.equals(1234567.89e-2, double.parse("1234567.89e-2"));
+ Expect.equals(1234567.89e-2, double.parse(" 1234567.89e-2 "));
+ Expect.equals(1234567.89e-2, double.parse(" +1234567.89e-2 "));
+ Expect.equals(-1234567.89e-2, double.parse(" -1234567.89e-2 "));
// TODO(floitsch): add tests for NaN and Infinity.
parseDoubleThrowsFormatException("1b");
parseDoubleThrowsFormatException(" 1b ");
« no previous file with comments | « tests/lib/math/math2_test.dart ('k') | tests/lib/math/math_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698