OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; |
| 6 |
5 // Make sure we use JavaScript semantics when compiling compile-time constants. | 7 // Make sure we use JavaScript semantics when compiling compile-time constants. |
6 | 8 |
7 const x = 12345678901234567891; | 9 const x = 12345678901234567891; |
8 const y = 12345678901234567890; | 10 const y = 12345678901234567890; |
9 const z = x - y; | 11 const z = x - y; |
10 | 12 |
11 const a = 1.0; | 13 const a = 1.0; |
12 const b = a << 3; // This would not be valid with Dart semantics. | 14 const b = a << 3; // This would not be valid with Dart semantics. |
13 | 15 |
14 const c = -0.0; | 16 const c = -0.0; |
(...skipping 10 matching lines...) Expand all Loading... |
25 Expect.equals(8, b); | 27 Expect.equals(8, b); |
26 Expect.equals(8, 1.0 << 3); // This would not be valid with Dart semantics. | 28 Expect.equals(8, 1.0 << 3); // This would not be valid with Dart semantics. |
27 Expect.isTrue(1 == 1.0); | 29 Expect.isTrue(1 == 1.0); |
28 Expect.equals(0, d); | 30 Expect.equals(0, d); |
29 Expect.equals(0, -0.0 << 1); // This would not be valid with Dart semantics. | 31 Expect.equals(0, -0.0 << 1); // This would not be valid with Dart semantics. |
30 // Make sure the 1 is not shifted into the 32 bit range. | 32 // Make sure the 1 is not shifted into the 32 bit range. |
31 Expect.equals(0, 0x100000000 >> 3); | 33 Expect.equals(0, 0x100000000 >> 3); |
32 // The dynamic int-check also allows -0.0. | 34 // The dynamic int-check also allows -0.0. |
33 Expect.isTrue((-0.0) is int); | 35 Expect.isTrue((-0.0) is int); |
34 } | 36 } |
OLD | NEW |