OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "platform.h" | 7 #include "platform.h" |
8 #include "cctest.h" | 8 #include "cctest.h" |
9 | 9 |
10 using namespace v8::internal; | 10 using namespace v8::internal; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 CHECK_EQ(0.0, StringToDouble(" ", NO_FLAGS)); | 97 CHECK_EQ(0.0, StringToDouble(" ", NO_FLAGS)); |
98 } | 98 } |
99 | 99 |
100 TEST(IntegerStrLiteral) { | 100 TEST(IntegerStrLiteral) { |
101 CHECK_EQ(0.0, StringToDouble("0.0", NO_FLAGS)); | 101 CHECK_EQ(0.0, StringToDouble("0.0", NO_FLAGS)); |
102 CHECK_EQ(0.0, StringToDouble("0", NO_FLAGS)); | 102 CHECK_EQ(0.0, StringToDouble("0", NO_FLAGS)); |
103 CHECK_EQ(0.0, StringToDouble("00", NO_FLAGS)); | 103 CHECK_EQ(0.0, StringToDouble("00", NO_FLAGS)); |
104 CHECK_EQ(0.0, StringToDouble("000", NO_FLAGS)); | 104 CHECK_EQ(0.0, StringToDouble("000", NO_FLAGS)); |
105 CHECK_EQ(1.0, StringToDouble("1", NO_FLAGS)); | 105 CHECK_EQ(1.0, StringToDouble("1", NO_FLAGS)); |
106 CHECK_EQ(-1.0, StringToDouble("-1", NO_FLAGS)); | 106 CHECK_EQ(-1.0, StringToDouble("-1", NO_FLAGS)); |
107 CHECK_EQ(-1.0, StringToDouble(" - 1 ", NO_FLAGS)); | 107 CHECK_EQ(-1.0, StringToDouble(" -1 ", NO_FLAGS)); |
108 CHECK_EQ(1.0, StringToDouble(" + 1 ", NO_FLAGS)); | 108 CHECK_EQ(1.0, StringToDouble(" +1 ", NO_FLAGS)); |
| 109 CHECK(isnan(StringToDouble(" - 1 ", NO_FLAGS))); |
| 110 CHECK(isnan(StringToDouble(" + 1 ", NO_FLAGS))); |
109 | 111 |
110 CHECK_EQ(0.0, StringToDouble("0e0", ALLOW_HEX | ALLOW_OCTALS)); | 112 CHECK_EQ(0.0, StringToDouble("0e0", ALLOW_HEX | ALLOW_OCTALS)); |
111 CHECK_EQ(0.0, StringToDouble("0e1", ALLOW_HEX | ALLOW_OCTALS)); | 113 CHECK_EQ(0.0, StringToDouble("0e1", ALLOW_HEX | ALLOW_OCTALS)); |
112 CHECK_EQ(0.0, StringToDouble("0e-1", ALLOW_HEX | ALLOW_OCTALS)); | 114 CHECK_EQ(0.0, StringToDouble("0e-1", ALLOW_HEX | ALLOW_OCTALS)); |
113 CHECK_EQ(0.0, StringToDouble("0e-100000", ALLOW_HEX | ALLOW_OCTALS)); | 115 CHECK_EQ(0.0, StringToDouble("0e-100000", ALLOW_HEX | ALLOW_OCTALS)); |
114 CHECK_EQ(0.0, StringToDouble("0e+100000", ALLOW_HEX | ALLOW_OCTALS)); | 116 CHECK_EQ(0.0, StringToDouble("0e+100000", ALLOW_HEX | ALLOW_OCTALS)); |
115 CHECK_EQ(0.0, StringToDouble("0.", ALLOW_HEX | ALLOW_OCTALS)); | 117 CHECK_EQ(0.0, StringToDouble("0.", ALLOW_HEX | ALLOW_OCTALS)); |
116 } | 118 } |
117 | 119 |
118 TEST(LongNumberStr) { | 120 TEST(LongNumberStr) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 CHECK(EightBit1::is_valid(i)); | 239 CHECK(EightBit1::is_valid(i)); |
238 x = EightBit1::encode(i); | 240 x = EightBit1::encode(i); |
239 CHECK_EQ(i, EightBit1::decode(x)); | 241 CHECK_EQ(i, EightBit1::decode(x)); |
240 CHECK(EightBit2::is_valid(i)); | 242 CHECK(EightBit2::is_valid(i)); |
241 x = EightBit2::encode(i); | 243 x = EightBit2::encode(i); |
242 CHECK_EQ(i, EightBit2::decode(x)); | 244 CHECK_EQ(i, EightBit2::decode(x)); |
243 } | 245 } |
244 CHECK(!EightBit1::is_valid(256)); | 246 CHECK(!EightBit1::is_valid(256)); |
245 CHECK(!EightBit2::is_valid(256)); | 247 CHECK(!EightBit2::is_valid(256)); |
246 } | 248 } |
OLD | NEW |