| 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 // Dart test program for testing comparison operators. | 4 // Dart test program for testing comparison operators. |
| 5 | 5 |
| 6 class Helper { | 6 class Helper { |
| 7 static bool STRICT_EQ(a, b) { | 7 static bool STRICT_EQ(a, b) { |
| 8 return a === b; | 8 return a === b; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 Expect.equals(true, Helper.GE(-1, -1)); | 148 Expect.equals(true, Helper.GE(-1, -1)); |
| 149 Expect.equals(true, Helper.GE(0, 0)); | 149 Expect.equals(true, Helper.GE(0, 0)); |
| 150 Expect.equals(true, Helper.GE(1, 1)); | 150 Expect.equals(true, Helper.GE(1, 1)); |
| 151 Expect.equals(false, Helper.GE(-1, 0)); | 151 Expect.equals(false, Helper.GE(-1, 0)); |
| 152 Expect.equals(false, Helper.GE(-1, 1)); | 152 Expect.equals(false, Helper.GE(-1, 1)); |
| 153 Expect.equals(false, Helper.GE(0, 1)); | 153 Expect.equals(false, Helper.GE(0, 1)); |
| 154 Expect.equals(true, Helper.GE(0, -1)); | 154 Expect.equals(true, Helper.GE(0, -1)); |
| 155 Expect.equals(true, Helper.GE(1, -1)); | 155 Expect.equals(true, Helper.GE(1, -1)); |
| 156 Expect.equals(true, Helper.GE(1, 0)); | 156 Expect.equals(true, Helper.GE(1, 0)); |
| 157 | 157 |
| 158 // TODO(regis): Double literals are not yet canonicalized. | 158 Expect.equals(true, Helper.STRICT_EQ(-1.0, -1.0)); |
| 159 // Expect.equals(true, Helper.STRICT_EQ(-1.0, -1.0)); | 159 Expect.equals(true, Helper.STRICT_EQ(0.0, 0.0)); |
| 160 // Expect.equals(true, Helper.STRICT_EQ(0.0, 0.0)); | 160 Expect.equals(true, Helper.STRICT_EQ(1.0, 1.0)); |
| 161 // Expect.equals(true, Helper.STRICT_EQ(1.0, 1.0)); | 161 Expect.equals(false, Helper.STRICT_EQ(-1.0, 0.0)); |
| 162 // Expect.equals(false, Helper.STRICT_EQ(-1.0, 0.0)); | 162 Expect.equals(false, Helper.STRICT_EQ(-1.0, 1.0)); |
| 163 // Expect.equals(false, Helper.STRICT_EQ(-1.0, 1.0)); | 163 Expect.equals(false, Helper.STRICT_EQ(0.0, 1.0)); |
| 164 // Expect.equals(false, Helper.STRICT_EQ(0.0, 1.0)); | |
| 165 | 164 |
| 166 // Expect.equals(false, Helper.STRICT_NE(-1.0, -1.0)); | 165 Expect.equals(false, Helper.STRICT_NE(-1.0, -1.0)); |
| 167 // Expect.equals(false, Helper.STRICT_NE(0.0, 0.0)); | 166 Expect.equals(false, Helper.STRICT_NE(0.0, 0.0)); |
| 168 // Expect.equals(false, Helper.STRICT_NE(1.0, 1.0)); | 167 Expect.equals(false, Helper.STRICT_NE(1.0, 1.0)); |
| 169 // Expect.equals(true, Helper.STRICT_NE(-1.0, 0.0)); | 168 Expect.equals(true, Helper.STRICT_NE(-1.0, 0.0)); |
| 170 // Expect.equals(true, Helper.STRICT_NE(-1.0, 1.0)); | 169 Expect.equals(true, Helper.STRICT_NE(-1.0, 1.0)); |
| 171 // Expect.equals(true, Helper.STRICT_NE(0.0, 1.0)); | 170 Expect.equals(true, Helper.STRICT_NE(0.0, 1.0)); |
| 172 | 171 |
| 173 Expect.equals(true, Helper.EQ(-1.0, -1.0)); | 172 Expect.equals(true, Helper.EQ(-1.0, -1.0)); |
| 174 Expect.equals(true, Helper.EQ(0.0, 0.0)); | 173 Expect.equals(true, Helper.EQ(0.0, 0.0)); |
| 175 Expect.equals(true, Helper.EQ(1.0, 1.0)); | 174 Expect.equals(true, Helper.EQ(1.0, 1.0)); |
| 176 Expect.equals(false, Helper.EQ(-1.0, 0.0)); | 175 Expect.equals(false, Helper.EQ(-1.0, 0.0)); |
| 177 Expect.equals(false, Helper.EQ(-1.0, 1.0)); | 176 Expect.equals(false, Helper.EQ(-1.0, 1.0)); |
| 178 Expect.equals(false, Helper.EQ(0.0, 1.0)); | 177 Expect.equals(false, Helper.EQ(0.0, 1.0)); |
| 179 | 178 |
| 180 Expect.equals(false, Helper.NE(-1.0, -1.0)); | 179 Expect.equals(false, Helper.NE(-1.0, -1.0)); |
| 181 Expect.equals(false, Helper.NE(0.0, 0.0)); | 180 Expect.equals(false, Helper.NE(0.0, 0.0)); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 Expect.equals(false, Helper.EQ(null, 1.1)); | 314 Expect.equals(false, Helper.EQ(null, 1.1)); |
| 316 | 315 |
| 317 // TODO(srdjan): Clarify behaviour of greater/less comparisons | 316 // TODO(srdjan): Clarify behaviour of greater/less comparisons |
| 318 // between numbers and non-numbers. | 317 // between numbers and non-numbers. |
| 319 } | 318 } |
| 320 } | 319 } |
| 321 | 320 |
| 322 main() { | 321 main() { |
| 323 ComparisonTest.testMain(); | 322 ComparisonTest.testMain(); |
| 324 } | 323 } |
| OLD | NEW |