Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: tests/corelib_2/compare_to2_test.dart

Issue 2977403002: Migrate test block 3 to Dart 2.0. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698