| 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"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 // dart2js specific test to make sure hashCode on intercepted types behaves as | 7 // dart2js specific test to make sure hashCode on intercepted types behaves as |
| 8 // intended. | 8 // intended. |
| 9 | 9 |
| 10 @NoInline() | 10 @NoInline() |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // We expect that the hash function is reasonable quality - there | 36 // We expect that the hash function is reasonable quality - there |
| 37 // are some difference in the low bits. | 37 // are some difference in the low bits. |
| 38 Expect.isFalse(h1 == h2); | 38 Expect.isFalse(h1 == h2); |
| 39 Expect.isFalse((h1 & 0xf) == (h2 & 0xf)); | 39 Expect.isFalse((h1 & 0xf) == (h2 & 0xf)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 bools() { | 42 bools() { |
| 43 check(true, false, identityHashCode: false); | 43 check(true, false, identityHashCode: false); |
| 44 | 44 |
| 45 Expect.equals(true.hashCode, hash(true)); // First can be optimized. | 45 Expect.equals(true.hashCode, hash(true)); // First can be optimized. |
| 46 Expect.equals(false.hashCode, hash(false)); | 46 Expect.equals(false.hashCode, hash(false)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 ints() { | 49 ints() { |
| 50 var i1 = 100; | 50 var i1 = 100; |
| 51 var i2 = 101; | 51 var i2 = 101; |
| 52 check(i1, i2, identityHashCode: false); | 52 check(i1, i2, identityHashCode: false); |
| 53 Expect.equals(i1.hashCode, hash(i1)); | 53 Expect.equals(i1.hashCode, hash(i1)); |
| 54 Expect.equals(i2.hashCode, hash(i2)); | 54 Expect.equals(i2.hashCode, hash(i2)); |
| 55 } | 55 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 79 Expect.equals(0x0DB819B, 'b'.hashCode); | 79 Expect.equals(0x0DB819B, 'b'.hashCode); |
| 80 Expect.equals(0xEBA5D59, 'c'.hashCode); | 80 Expect.equals(0xEBA5D59, 'c'.hashCode); |
| 81 } | 81 } |
| 82 | 82 |
| 83 main() { | 83 main() { |
| 84 bools(); | 84 bools(); |
| 85 ints(); | 85 ints(); |
| 86 lists(); | 86 lists(); |
| 87 strings(); | 87 strings(); |
| 88 } | 88 } |
| OLD | NEW |