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

Side by Side Diff: tests/language/rewrite_conditional_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 var global = 0; 7 var global = 0;
8 8
9 bar() { 9 bar() {
10 global += 1; 10 global += 1;
11 }
12 baz() {
13 global += 100;
14 } 11 }
15 12
16 foo(x,y,z) { 13 baz() {
17 if ((x ? false : true) ? y : z) { 14 global += 100;
18 bar();
19 bar();
20 } else {
21 baz();
22 baz();
23 }
24 } 15 }
25 16
26 foo2(x,y,z) { 17 foo(x, y, z) {
27 return (x ? false : true) ? y : z; 18 if ((x ? false : true) ? y : z) {
19 bar();
20 bar();
21 } else {
22 baz();
23 baz();
24 }
28 } 25 }
29 26
30 foo3(x,y,z) { 27 foo2(x, y, z) {
31 if (x ? (z ? false : true) : (y ? false : true)) { 28 return (x ? false : true) ? y : z;
32 baz();
33 baz();
34 } else {
35 bar();
36 bar();
37 }
38 } 29 }
39 30
31 foo3(x, y, z) {
32 if (x ? (z ? false : true) : (y ? false : true)) {
33 baz();
34 baz();
35 } else {
36 bar();
37 bar();
38 }
39 }
40 40
41 main() { 41 main() {
42 foo(true,true,true); 42 foo(true, true, true);
43 Expect.equals(2, global); 43 Expect.equals(2, global);
44 44
45 foo(true,true,false); 45 foo(true, true, false);
46 Expect.equals(202, global); 46 Expect.equals(202, global);
47 47
48 foo(true,false,true); 48 foo(true, false, true);
49 Expect.equals(204, global); 49 Expect.equals(204, global);
50 50
51 foo(true,false,false); 51 foo(true, false, false);
52 Expect.equals(404, global); 52 Expect.equals(404, global);
53 53
54 foo(false,true,true); 54 foo(false, true, true);
55 Expect.equals(406, global); 55 Expect.equals(406, global);
56 56
57 foo(false,true,false); 57 foo(false, true, false);
58 Expect.equals(408, global); 58 Expect.equals(408, global);
59 59
60 foo(false,false,true); 60 foo(false, false, true);
61 Expect.equals(608, global); 61 Expect.equals(608, global);
62 62
63 foo(false,false,false); 63 foo(false, false, false);
64 Expect.equals(808, global); 64 Expect.equals(808, global);
65 65
66 Expect.equals(true, foo2(true,true,true)); 66 Expect.equals(true, foo2(true, true, true));
67 Expect.equals(false, foo2(true,true,false)); 67 Expect.equals(false, foo2(true, true, false));
68 Expect.equals(true, foo2(true,false,true)); 68 Expect.equals(true, foo2(true, false, true));
69 Expect.equals(false, foo2(true,false,false)); 69 Expect.equals(false, foo2(true, false, false));
70 Expect.equals(true, foo2(false,true,true)); 70 Expect.equals(true, foo2(false, true, true));
71 Expect.equals(true, foo2(false,true,false)); 71 Expect.equals(true, foo2(false, true, false));
72 Expect.equals(false, foo2(false,false,true)); 72 Expect.equals(false, foo2(false, false, true));
73 Expect.equals(false, foo2(false,false,false)); 73 Expect.equals(false, foo2(false, false, false));
74 74
75 global = 0; 75 global = 0;
76 foo3(true,true,true); 76 foo3(true, true, true);
77 Expect.equals(2, global); 77 Expect.equals(2, global);
78 78
79 foo3(true,true,false); 79 foo3(true, true, false);
80 Expect.equals(202, global); 80 Expect.equals(202, global);
81 81
82 foo3(true,false,true); 82 foo3(true, false, true);
83 Expect.equals(204, global); 83 Expect.equals(204, global);
84 84
85 foo3(true,false,false); 85 foo3(true, false, false);
86 Expect.equals(404, global); 86 Expect.equals(404, global);
87 87
88 foo3(false,true,true); 88 foo3(false, true, true);
89 Expect.equals(406, global); 89 Expect.equals(406, global);
90 90
91 foo3(false,true,false); 91 foo3(false, true, false);
92 Expect.equals(408, global); 92 Expect.equals(408, global);
93 93
94 foo3(false,false,true); 94 foo3(false, false, true);
95 Expect.equals(608, global); 95 Expect.equals(608, global);
96 96
97 foo3(false,false,false); 97 foo3(false, false, false);
98 Expect.equals(808, global); 98 Expect.equals(808, global);
99 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698