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

Side by Side Diff: tests/language_strong/rewrite_swap_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 swap1(x,y,b) { 7 swap1(x, y, b) {
8 if (b) { 8 if (b) {
9 var t = x; 9 var t = x;
10 x = y; 10 x = y;
11 y = t; 11 y = t;
12 } 12 }
13 Expect.equals(2, x); 13 Expect.equals(2, x);
14 Expect.equals(1, y); 14 Expect.equals(1, y);
15 } 15 }
16 16
17 swap2(x,y,z,w,b) { 17 swap2(x, y, z, w, b) {
18 if (b) { 18 if (b) {
19 var t = x; 19 var t = x;
20 x = y; 20 x = y;
21 y = t; 21 y = t;
22 22
23 var q = z; 23 var q = z;
24 z = w; 24 z = w;
25 w = q; 25 w = q;
26 } 26 }
27 Expect.equals(2, x); 27 Expect.equals(2, x);
28 Expect.equals(1, y); 28 Expect.equals(1, y);
29 Expect.equals(4, z); 29 Expect.equals(4, z);
30 Expect.equals(3, w); 30 Expect.equals(3, w);
31 } 31 }
32 32
33 swap3(x,y,z,b) { 33 swap3(x, y, z, b) {
34 if (b) { 34 if (b) {
35 var t = x; 35 var t = x;
36 x = y; 36 x = y;
37 y = z; 37 y = z;
38 z = t; 38 z = t;
39 } 39 }
40 Expect.equals(2, x); 40 Expect.equals(2, x);
41 Expect.equals(3, y); 41 Expect.equals(3, y);
42 Expect.equals(1, z); 42 Expect.equals(1, z);
43 } 43 }
44 44
45 swap4(x,y,z,b) { 45 swap4(x, y, z, b) {
46 if (b) { 46 if (b) {
47 var t = x; 47 var t = x;
48 x = y; 48 x = y;
49 y = z; // swap cycle involves unused variable 'y' 49 y = z; // swap cycle involves unused variable 'y'
50 z = t; 50 z = t;
51 } 51 }
52 Expect.equals(2, x); 52 Expect.equals(2, x);
53 Expect.equals(1, z); 53 Expect.equals(1, z);
54 } 54 }
55 55
56 swap5(x,y,z,w,b,b2) { 56 swap5(x, y, z, w, b, b2) {
57 if (b) { 57 if (b) {
58 var t = x; 58 var t = x;
59 x = y; 59 x = y;
60 y = t; 60 y = t;
61 } 61 }
62 if (b2) { 62 if (b2) {
63 var q = z; 63 var q = z;
64 z = w; 64 z = w;
65 w = q; 65 w = q;
66 } 66 }
67 Expect.equals(2, x); 67 Expect.equals(2, x);
68 Expect.equals(1, y); 68 Expect.equals(1, y);
69 Expect.equals(4, z); 69 Expect.equals(4, z);
70 Expect.equals(3, w); 70 Expect.equals(3, w);
71 } 71 }
72 72
73 main() { 73 main() {
74 swap1(1,2,true); 74 swap1(1, 2, true);
75 swap1(2,1,false); 75 swap1(2, 1, false);
76 76
77 swap2(1,2,3,4,true); 77 swap2(1, 2, 3, 4, true);
78 swap2(2,1,4,3,false); 78 swap2(2, 1, 4, 3, false);
79 79
80 swap3(1,2,3,true); 80 swap3(1, 2, 3, true);
81 swap3(2,3,1,false); 81 swap3(2, 3, 1, false);
82 82
83 swap4(1,2,3,true); 83 swap4(1, 2, 3, true);
84 swap4(2,3,1,false); 84 swap4(2, 3, 1, false);
85 85
86 swap5(1,2,3,4,true, true); 86 swap5(1, 2, 3, 4, true, true);
87 swap5(1,2,4,3,true, false); 87 swap5(1, 2, 4, 3, true, false);
88 swap5(2,1,3,4,false, true); 88 swap5(2, 1, 3, 4, false, true);
89 swap5(2,1,4,3,false, false); 89 swap5(2, 1, 4, 3, false, false);
90 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698