OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // This program has many similar constants that should all have distinct | 5 // This program has many similar constants that should all have distinct |
6 // identities. They are sufficiently similar to have name collisions and need | 6 // identities. They are sufficiently similar to have name collisions and need |
7 // ordering by constant value. | 7 // ordering by constant value. |
8 | 8 |
9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 const ll4 = const [1, 2, 3, 4, 8, 6, 7]; | 30 const ll4 = const [1, 2, 3, 4, 8, 6, 7]; |
31 | 31 |
32 const m1 = const {1: 1, 2: 2}; | 32 const m1 = const {1: 1, 2: 2}; |
33 const m2 = const {1: 2, 2: 1}; | 33 const m2 = const {1: 2, 2: 1}; |
34 const m3 = const {1: 1, 2: 1}; | 34 const m3 = const {1: 1, 2: 1}; |
35 const m4 = const {1: 2, 2: 2}; | 35 const m4 = const {1: 2, 2: 2}; |
36 const m5 = const {2: 1, 1: 2}; | 36 const m5 = const {2: 1, 1: 2}; |
37 const m6 = const {2: 2, 1: 1}; | 37 const m6 = const {2: 2, 1: 1}; |
38 const m7 = const {2: 1, 1: 1}; | 38 const m7 = const {2: 1, 1: 1}; |
39 const m8 = const {2: 2, 1: 2}; | 39 const m8 = const {2: 2, 1: 2}; |
40 const m9 = const <int,int>{1: 1, 2: 2}; | 40 const m9 = const <int, int>{1: 1, 2: 2}; |
41 const mA = const <int,int>{1: 2, 2: 1}; | 41 const mA = const <int, int>{1: 2, 2: 1}; |
42 const mB = const <int,int>{1: 1, 2: 1}; | 42 const mB = const <int, int>{1: 1, 2: 1}; |
43 const mC = const <int,int>{1: 2, 2: 2}; | 43 const mC = const <int, int>{1: 2, 2: 2}; |
44 | 44 |
45 const mE1 = const {E.A: E.B}; | 45 const mE1 = const {E.A: E.B}; |
46 const mE2 = const {E.A: E.C}; | 46 const mE2 = const {E.A: E.C}; |
47 const mE3 = const {E.A: 0, E.B: 0}; | 47 const mE3 = const {E.A: 0, E.B: 0}; |
48 const mE4 = const {E.A: 0, E.C: 0}; | 48 const mE4 = const {E.A: 0, E.C: 0}; |
49 const mE5 = const {E.A: 0, E.B: 0, E.C: 4}; | 49 const mE5 = const {E.A: 0, E.B: 0, E.C: 4}; |
50 const mE6 = const {E.A: 0, E.B: 0, E.C: 2}; | 50 const mE6 = const {E.A: 0, E.B: 0, E.C: 2}; |
51 const mE7 = const {E.A: 0, E.B: 0, E.C: 3}; | 51 const mE7 = const {E.A: 0, E.B: 0, E.C: 3}; |
52 const mE8 = const {E.A: 0, E.B: 0, E.C: 1}; | 52 const mE8 = const {E.A: 0, E.B: 0, E.C: 1}; |
53 | 53 |
54 const z1 = const Z(f: 3); | 54 const z1 = const Z(f: 3); |
55 const z2 = const Z(f: 2); | 55 const z2 = const Z(f: 2); |
56 const z3 = const Z(f: 1); | 56 const z3 = const Z(f: 1); |
57 const z4 = const Z(e: 2); | 57 const z4 = const Z(e: 2); |
58 const z5 = const Z(d: 3); | 58 const z5 = const Z(d: 3); |
59 const z6 = const Z(d: 2); | 59 const z6 = const Z(d: 2); |
60 | 60 |
61 makeAll() => { | 61 makeAll() => { |
62 'E.A': E.A, 'E.B': E.B, 'E.C': E.C, 'E.D': E.D, | 62 'E.A': E.A, |
63 'c1': c1, 'c2': c2, 'c3': c3, 'c4': c4, | 63 'E.B': E.B, |
64 'l1': l1, 'l2': l2, 'l3': l3, 'l4': l4, | 64 'E.C': E.C, |
65 'll1': ll1, 'll2': ll2, 'll3': ll3, 'l4': ll4, | 65 'E.D': E.D, |
66 'm1': m1, 'm2': m2, 'm3': m3, 'm4': m4, | 66 'c1': c1, |
67 'm5': m5, 'm6': m6, 'm7': m7, 'm8': m8, | 67 'c2': c2, |
68 'm9': m9, 'mA': mA, 'mB': mB, 'mC': mC, | 68 'c3': c3, |
69 'mE1': mE1, 'mE2': mE2, 'mE3': mE3, 'mE4': mE4, | 69 'c4': c4, |
70 'mE5': mE5, 'mE6': mE6, 'mE7': mE7, 'mE8': mE8, | 70 'l1': l1, |
71 'z1': z1, 'z2': z2, 'z3': z3, 'z4': z4, 'z5': z5, 'z6': z6, | 71 'l2': l2, |
72 }; | 72 'l3': l3, |
| 73 'l4': l4, |
| 74 'll1': ll1, |
| 75 'll2': ll2, |
| 76 'll3': ll3, |
| 77 'l4': ll4, |
| 78 'm1': m1, |
| 79 'm2': m2, |
| 80 'm3': m3, |
| 81 'm4': m4, |
| 82 'm5': m5, |
| 83 'm6': m6, |
| 84 'm7': m7, |
| 85 'm8': m8, |
| 86 'm9': m9, |
| 87 'mA': mA, |
| 88 'mB': mB, |
| 89 'mC': mC, |
| 90 'mE1': mE1, |
| 91 'mE2': mE2, |
| 92 'mE3': mE3, |
| 93 'mE4': mE4, |
| 94 'mE5': mE5, |
| 95 'mE6': mE6, |
| 96 'mE7': mE7, |
| 97 'mE8': mE8, |
| 98 'z1': z1, |
| 99 'z2': z2, |
| 100 'z3': z3, |
| 101 'z4': z4, |
| 102 'z5': z5, |
| 103 'z6': z6, |
| 104 }; |
73 | 105 |
74 main() { | 106 main() { |
75 var all1 = makeAll(); | 107 var all1 = makeAll(); |
76 var all2 = makeAll(); | 108 var all2 = makeAll(); |
77 | 109 |
78 for (var name1 in all1.keys) { | 110 for (var name1 in all1.keys) { |
79 var e1 = all1[name1]; | 111 var e1 = all1[name1]; |
80 for (var name2 in all2.keys) { | 112 for (var name2 in all2.keys) { |
81 if (name1 == name2) continue; | 113 if (name1 == name2) continue; |
82 var e2 = all2[name2]; | 114 var e2 = all2[name2]; |
83 Expect.isFalse(identical(e1, e2), | 115 Expect.isFalse( |
84 'Different instances $name1: $e1 $name2: $e2'); | 116 identical(e1, e2), 'Different instances $name1: $e1 $name2: $e2'); |
85 } | 117 } |
86 } | 118 } |
87 } | 119 } |
OLD | NEW |