OLD | NEW |
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 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation | 4 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 main() { | 8 main() { |
9 for (int i = 0; i < 20; i++) { | 9 for (int i = 0; i < 20; i++) { |
10 Expect.isFalse(test1(5)); | 10 Expect.isFalse(test1(5)); |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 Expect.isFalse(test10(0)); | 37 Expect.isFalse(test10(0)); |
38 Expect.isFalse(test10r(0)); | 38 Expect.isFalse(test10r(0)); |
39 Expect.isTrue(test10(2)); | 39 Expect.isTrue(test10(2)); |
40 Expect.isTrue(test10r(2)); | 40 Expect.isTrue(test10r(2)); |
41 | 41 |
42 test11(i); | 42 test11(i); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 | |
47 test1(a) { | 46 test1(a) { |
48 return identical(a, 3); | 47 return identical(a, 3); |
49 } | 48 } |
50 | 49 |
51 test2(a) { | 50 test2(a) { |
52 return !identical(a, 3); | 51 return !identical(a, 3); |
53 } | 52 } |
54 | 53 |
55 | |
56 test2r(a) { | 54 test2r(a) { |
57 return !identical(3, a); | 55 return !identical(3, a); |
58 } | 56 } |
59 | 57 |
60 | |
61 test3() { | 58 test3() { |
62 return identical(get5(), 5); | 59 return identical(get5(), 5); |
63 } | 60 } |
64 | 61 |
65 | |
66 test4(a) { | 62 test4(a) { |
67 if (identical(a, 3)) { | 63 if (identical(a, 3)) { |
68 return 1; | 64 return 1; |
69 } else { | 65 } else { |
70 return 2; | 66 return 2; |
71 } | 67 } |
72 } | 68 } |
73 | 69 |
74 | |
75 test5(a) { | 70 test5(a) { |
76 if (!identical(a, 3)) { | 71 if (!identical(a, 3)) { |
77 return 1; | 72 return 1; |
78 } else { | 73 } else { |
79 return 2; | 74 return 2; |
80 } | 75 } |
81 } | 76 } |
82 | 77 |
83 | |
84 test6() { | 78 test6() { |
85 if (identical(get5(), 5)) { | 79 if (identical(get5(), 5)) { |
86 return 1; | 80 return 1; |
87 } else { | 81 } else { |
88 return 2; | 82 return 2; |
89 } | 83 } |
90 } | 84 } |
91 | 85 |
92 get5() { | 86 get5() { |
93 return 5; | 87 return 5; |
94 } | 88 } |
95 | 89 |
96 test7() { | 90 test7() { |
97 return null != null; | 91 return null != null; |
98 } | 92 } |
99 | 93 |
100 | |
101 test8() { | 94 test8() { |
102 if (null != null) { | 95 if (null != null) { |
103 return 1; | 96 return 1; |
104 } else { | 97 } else { |
105 return 2; | 98 return 2; |
106 } | 99 } |
107 } | 100 } |
108 | 101 |
109 | |
110 test9(a) { | 102 test9(a) { |
111 return identical(a, 0); | 103 return identical(a, 0); |
112 } | 104 } |
113 | 105 |
114 | |
115 test9r(a) { | 106 test9r(a) { |
116 return identical(0, a); | 107 return identical(0, a); |
117 } | 108 } |
118 | 109 |
119 | |
120 test10(a) { | 110 test10(a) { |
121 return !identical(a, 0); | 111 return !identical(a, 0); |
122 } | 112 } |
123 | 113 |
124 test10r(a) { | 114 test10r(a) { |
125 return !identical(0, a); | 115 return !identical(0, a); |
126 } | 116 } |
127 | 117 |
128 test11(a) { | 118 test11(a) { |
129 if (identical(a, 0)) { | 119 if (identical(a, 0)) { |
130 Expect.isTrue(identical(0, a)); | 120 Expect.isTrue(identical(0, a)); |
131 Expect.isFalse(!identical(a, 0)); | 121 Expect.isFalse(!identical(a, 0)); |
132 Expect.isFalse(!identical(0, a)); | 122 Expect.isFalse(!identical(0, a)); |
133 } else { | 123 } else { |
134 Expect.isFalse(identical(0, a)); | 124 Expect.isFalse(identical(0, a)); |
135 Expect.isTrue(!identical(a, 0)); | 125 Expect.isTrue(!identical(a, 0)); |
136 Expect.isTrue(!identical(0, a)); | 126 Expect.isTrue(!identical(0, a)); |
137 } | 127 } |
138 } | 128 } |
OLD | NEW |