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

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

Issue 1842853002: VM: Fix --no-use-field-guards. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « tests/corelib/double_parse_test.dart ('k') | tests/language/cha_deopt2_test.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Test num.clamp. 4 // Test num.clamp.
5 // VMOptions=--no-use-field-guards
6 // VMOptions=
5 7
6 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
7 9
8 // Pedestrian implementation of sign, following its specification directly. 10 // Pedestrian implementation of sign, following its specification directly.
9 num sign(num value) { 11 num sign(num value) {
10 if (value is int) { 12 if (value is int) {
11 if (value < 0) return -1; 13 if (value < 0) return -1;
12 if (value > 0) return 1; 14 if (value > 0) return 1;
13 return 0; 15 return 0;
14 } 16 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 Expect.equals(number.isNegative, actualSign.isNegative, "$number:negative"); 100 Expect.equals(number.isNegative, actualSign.isNegative, "$number:negative");
99 var renumber = actualSign * number.abs(); 101 var renumber = actualSign * number.abs();
100 Expect.equals(number, renumber, "$number (sign*abs)"); 102 Expect.equals(number, renumber, "$number (sign*abs)");
101 if (number is int) { 103 if (number is int) {
102 Expect.isTrue(renumber is int, "$number (sign*abs) is int"); 104 Expect.isTrue(renumber is int, "$number (sign*abs) is int");
103 } else { 105 } else {
104 Expect.isTrue(renumber is double, "$number (sign*abs) is double"); 106 Expect.isTrue(renumber is double, "$number (sign*abs) is double");
105 } 107 }
106 } 108 }
107 } 109 }
OLDNEW
« no previous file with comments | « tests/corelib/double_parse_test.dart ('k') | tests/language/cha_deopt2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698