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

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

Issue 11227042: isEven, isOdd, isNegative, isMaxValue, isMinValue, isInfinite, isPositive, isSingleValue. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 8 years, 2 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 /** 5 /**
6 * A test of simple runtime behavior on numbers, strings and lists with 6 * A test of simple runtime behavior on numbers, strings and lists with
7 * a focus on both correct behavior and runtime errors. 7 * a focus on both correct behavior and runtime errors.
8 * 8 *
9 * This file is written to use minimal type declarations to match a 9 * This file is written to use minimal type declarations to match a
10 * typical dynamic language coding style. 10 * typical dynamic language coding style.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 assertEquals(x.abs(), 10.6); 134 assertEquals(x.abs(), 10.6);
135 assertEquals((-x).abs(), 10.6); 135 assertEquals((-x).abs(), 10.6);
136 assertEquals(x.round(), 11); 136 assertEquals(x.round(), 11);
137 assertEquals(x.floor(), 10); 137 assertEquals(x.floor(), 10);
138 assertEquals(x.ceil(), 11); 138 assertEquals(x.ceil(), 11);
139 } 139 }
140 140
141 // TODO(jimhug): Determine correct behavior for mixing ints and floats. 141 // TODO(jimhug): Determine correct behavior for mixing ints and floats.
142 static testIntegerMethods() { 142 static testIntegerMethods() {
143 var y = 9; 143 var y = 9;
144 assertEquals(y.isEven(), false); 144 assertEquals(y.isEven, false);
145 assertEquals(y.isOdd(), true); 145 assertEquals(y.isOdd, true);
146 assertEquals(y.toRadixString(2), '1001'); 146 assertEquals(y.toRadixString(2), '1001');
147 assertEquals(y.toRadixString(3), '100'); 147 assertEquals(y.toRadixString(3), '100');
148 assertEquals(y.toRadixString(16), '9'); 148 assertEquals(y.toRadixString(16), '9');
149 assertEquals((0).toRadixString(16), '0'); 149 assertEquals((0).toRadixString(16), '0');
150 try { 150 try {
151 y.toRadixString(0); 151 y.toRadixString(0);
152 Expect.fail("Illegal radix 0 accepted."); 152 Expect.fail("Illegal radix 0 accepted.");
153 } catch (e) { } 153 } catch (e) { }
154 try { 154 try {
155 y.toRadixString(-1); 155 y.toRadixString(-1);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 '${true}'.toString(); 281 '${true}'.toString();
282 '${false}'.toString(); 282 '${false}'.toString();
283 ''.toString(); 283 ''.toString();
284 ''.endsWith(''); 284 ''.endsWith('');
285 } 285 }
286 } 286 }
287 287
288 main() { 288 main() {
289 CoreRuntimeTypesTest.testMain(); 289 CoreRuntimeTypesTest.testMain();
290 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698