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 // Dart test for testing Math.min and Math.max. | 4 // Dart test for testing Math.min and Math.max. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 negate(x) => -x; | 8 negate(x) => -x; |
9 | 9 |
10 main() { | 10 main() { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 check(left, right, expectedResult) { | 67 check(left, right, expectedResult) { |
68 if (left is List) { | 68 if (left is List) { |
69 for (var x in left) check(x, right, expectedResult); | 69 for (var x in left) check(x, right, expectedResult); |
70 return; | 70 return; |
71 } | 71 } |
72 if (right is List) { | 72 if (right is List) { |
73 for (var x in right) check(left, x, expectedResult); | 73 for (var x in right) check(left, x, expectedResult); |
74 return; | 74 return; |
75 } | 75 } |
76 int actual = left.compareTo(right); | 76 int actual = left.compareTo(right); |
77 print("left: ${left} right: ${right}"); | |
Bob Nystrom
2017/07/18 23:43:44
Remove this.
bkonyi
2017/07/19 15:06:21
Whoops, forgot about this... Done.
| |
77 Expect.equals( | 78 Expect.equals( |
78 expectedResult, | 79 expectedResult, |
79 actual, | 80 actual, |
80 "($left).compareTo($right) failed " | 81 "($left).compareTo($right) failed " |
81 "(should have been $expectedResult, was $actual"); | 82 "(should have been $expectedResult, was $actual"); |
82 } | 83 } |
83 | 84 |
84 for (int i = 0; i < matrix.length; i++) { | 85 for (int i = 0; i < matrix.length; i++) { |
85 for (int j = 0; j < matrix.length; j++) { | 86 for (int j = 0; j < matrix.length; j++) { |
86 var left = matrix[i]; | 87 var left = matrix[i]; |
87 var right = matrix[j]; | 88 var right = matrix[j]; |
88 if (left is List) { | 89 if (left is List) { |
89 check(left, left, 0); | 90 check(left, left, 0); |
90 } | 91 } |
91 check(left, right, i == j ? 0 : (i < j ? -1 : 1)); | 92 check(left, right, i == j ? 0 : (i < j ? -1 : 1)); |
92 } | 93 } |
93 } | 94 } |
94 } | 95 } |
OLD | NEW |