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

Side by Side Diff: tests/corelib/math_test.dart

Issue 10456060: Eliminate unary plus with hex literals (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « tests/corelib/math_parse_double_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 Expect.equals(499, Math.parseInt(" 499 ")); 164 Expect.equals(499, Math.parseInt(" 499 "));
165 Expect.equals(499, Math.parseInt(" +499 ")); 165 Expect.equals(499, Math.parseInt(" +499 "));
166 Expect.equals(-499, Math.parseInt(" -499 ")); 166 Expect.equals(-499, Math.parseInt(" -499 "));
167 Expect.equals(0, Math.parseInt("0")); 167 Expect.equals(0, Math.parseInt("0"));
168 Expect.equals(0, Math.parseInt("+0")); 168 Expect.equals(0, Math.parseInt("+0"));
169 Expect.equals(0, Math.parseInt("-0")); 169 Expect.equals(0, Math.parseInt("-0"));
170 Expect.equals(0, Math.parseInt(" 0 ")); 170 Expect.equals(0, Math.parseInt(" 0 "));
171 Expect.equals(0, Math.parseInt(" +0 ")); 171 Expect.equals(0, Math.parseInt(" +0 "));
172 Expect.equals(0, Math.parseInt(" -0 ")); 172 Expect.equals(0, Math.parseInt(" -0 "));
173 Expect.equals(0x1234567890, Math.parseInt("0x1234567890")); 173 Expect.equals(0x1234567890, Math.parseInt("0x1234567890"));
174 Expect.equals(0x1234567890, Math.parseInt("+0x1234567890"));
175 Expect.equals(-0x1234567890, Math.parseInt("-0x1234567890")); 174 Expect.equals(-0x1234567890, Math.parseInt("-0x1234567890"));
176 Expect.equals(0x1234567890, Math.parseInt(" 0x1234567890 ")); 175 Expect.equals(0x1234567890, Math.parseInt(" 0x1234567890 "));
177 Expect.equals(0x1234567890, Math.parseInt(" +0x1234567890 "));
178 Expect.equals(-0x1234567890, Math.parseInt(" -0x1234567890 ")); 176 Expect.equals(-0x1234567890, Math.parseInt(" -0x1234567890 "));
179 Expect.equals(256, Math.parseInt("0x100")); 177 Expect.equals(256, Math.parseInt("0x100"));
180 Expect.equals(256, Math.parseInt("+0x100"));
181 Expect.equals(-256, Math.parseInt("-0x100")); 178 Expect.equals(-256, Math.parseInt("-0x100"));
182 Expect.equals(256, Math.parseInt(" 0x100 ")); 179 Expect.equals(256, Math.parseInt(" 0x100 "));
183 Expect.equals(256, Math.parseInt(" +0x100 "));
184 Expect.equals(-256, Math.parseInt(" -0x100 ")); 180 Expect.equals(-256, Math.parseInt(" -0x100 "));
185 Expect.equals(0xabcdef, Math.parseInt("0xabcdef")); 181 Expect.equals(0xabcdef, Math.parseInt("0xabcdef"));
186 Expect.equals(0xABCDEF, Math.parseInt("0xABCDEF")); 182 Expect.equals(0xABCDEF, Math.parseInt("0xABCDEF"));
187 Expect.equals(0xabcdef, Math.parseInt("0xabCDEf")); 183 Expect.equals(0xabcdef, Math.parseInt("0xabCDEf"));
188 Expect.equals(-0xabcdef, Math.parseInt("-0xabcdef")); 184 Expect.equals(-0xabcdef, Math.parseInt("-0xabcdef"));
189 Expect.equals(-0xABCDEF, Math.parseInt("-0xABCDEF")); 185 Expect.equals(-0xABCDEF, Math.parseInt("-0xABCDEF"));
190 Expect.equals(0xabcdef, Math.parseInt(" 0xabcdef ")); 186 Expect.equals(0xabcdef, Math.parseInt(" 0xabcdef "));
191 Expect.equals(0xABCDEF, Math.parseInt(" 0xABCDEF ")); 187 Expect.equals(0xABCDEF, Math.parseInt(" 0xABCDEF "));
192 Expect.equals(-0xabcdef, Math.parseInt(" -0xabcdef ")); 188 Expect.equals(-0xabcdef, Math.parseInt(" -0xabcdef "));
193 Expect.equals(-0xABCDEF, Math.parseInt(" -0xABCDEF ")); 189 Expect.equals(-0xABCDEF, Math.parseInt(" -0xABCDEF "));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 Expect.equals(true, parseIntThrowsBadNumberFormatException("0x3.1")); 222 Expect.equals(true, parseIntThrowsBadNumberFormatException("0x3.1"));
227 Expect.equals(true, parseIntThrowsBadNumberFormatException("5.")); 223 Expect.equals(true, parseIntThrowsBadNumberFormatException("5."));
228 Expect.equals(true, parseIntThrowsBadNumberFormatException("+-5")); 224 Expect.equals(true, parseIntThrowsBadNumberFormatException("+-5"));
229 Expect.equals(true, parseIntThrowsBadNumberFormatException("-+5")); 225 Expect.equals(true, parseIntThrowsBadNumberFormatException("-+5"));
230 Expect.equals(true, parseIntThrowsBadNumberFormatException("--5")); 226 Expect.equals(true, parseIntThrowsBadNumberFormatException("--5"));
231 Expect.equals(true, parseIntThrowsBadNumberFormatException("++5")); 227 Expect.equals(true, parseIntThrowsBadNumberFormatException("++5"));
232 Expect.equals(true, parseIntThrowsBadNumberFormatException("+ 5")); 228 Expect.equals(true, parseIntThrowsBadNumberFormatException("+ 5"));
233 Expect.equals(true, parseIntThrowsBadNumberFormatException("- 5")); 229 Expect.equals(true, parseIntThrowsBadNumberFormatException("- 5"));
234 Expect.equals(true, parseIntThrowsBadNumberFormatException("")); 230 Expect.equals(true, parseIntThrowsBadNumberFormatException(""));
235 Expect.equals(true, parseIntThrowsBadNumberFormatException(" ")); 231 Expect.equals(true, parseIntThrowsBadNumberFormatException(" "));
232 Expect.equals(true, parseIntThrowsBadNumberFormatException("+0x1234567890")) ;
233 Expect.equals(true, parseIntThrowsBadNumberFormatException(" +0x1234567890 "));
234 Expect.equals(true, parseIntThrowsBadNumberFormatException("+0x100"));
235 Expect.equals(true, parseIntThrowsBadNumberFormatException(" +0x100 "));
236 } 236 }
237 237
238 static testMain() { 238 static testMain() {
239 testConstants(); 239 testConstants();
240 testSin(); 240 testSin();
241 testCos(); 241 testCos();
242 testTan(); 242 testTan();
243 testAsin(); 243 testAsin();
244 testAcos(); 244 testAcos();
245 testAtan(); 245 testAtan();
246 testAtan2(); 246 testAtan2();
247 testSqrt(); 247 testSqrt();
248 testLog(); 248 testLog();
249 testExp(); 249 testExp();
250 testPow(); 250 testPow();
251 testParseInt(); 251 testParseInt();
252 } 252 }
253 } 253 }
254 254
255 main() { 255 main() {
256 MathTest.testMain(); 256 MathTest.testMain();
257 } 257 }
OLDNEW
« no previous file with comments | « tests/corelib/math_parse_double_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698