OLD | NEW |
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; | 7 var global; |
8 | 8 |
9 setGlobal(v) { | 9 setGlobal(v) { |
10 global = v; | 10 global = v; |
11 } | 11 } |
12 | 12 |
13 check_true_true(x, y, v) { | 13 check_true_true(x, y, v) { |
14 if (x) { | 14 if (x) { |
15 if (y) { | 15 if (y) { |
16 setGlobal(v); | 16 setGlobal(v); |
17 } | 17 } |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 check_false_true(x, y, v) { | 21 check_false_true(x, y, v) { |
22 if (x) { | 22 if (x) {} else { |
23 | |
24 } else { | |
25 if (y) { | 23 if (y) { |
26 setGlobal(v); | 24 setGlobal(v); |
27 } | 25 } |
28 } | 26 } |
29 } | 27 } |
30 | 28 |
31 check_true_false(x, y, v) { | 29 check_true_false(x, y, v) { |
32 if (x) { | 30 if (x) { |
33 if (y) { | 31 if (y) {} else { |
34 | |
35 } else { | |
36 setGlobal(v); | 32 setGlobal(v); |
37 } | 33 } |
38 } | 34 } |
39 } | 35 } |
40 | 36 |
41 check_false_false(x, y, v) { | 37 check_false_false(x, y, v) { |
42 if (x) { | 38 if (x) {} else { |
43 | 39 if (y) {} else { |
44 } else { | |
45 if (y) { | |
46 | |
47 } else { | |
48 setGlobal(v); | 40 setGlobal(v); |
49 } | 41 } |
50 } | 42 } |
51 } | 43 } |
52 | 44 |
53 | |
54 main() { | 45 main() { |
55 check_true_true(true, true, 4); | 46 check_true_true(true, true, 4); |
56 check_true_true(false, false, 1); | 47 check_true_true(false, false, 1); |
57 check_true_true(false, true, 2); | 48 check_true_true(false, true, 2); |
58 check_true_true(true, false, 3); | 49 check_true_true(true, false, 3); |
59 | 50 |
60 Expect.equals(4, global); | 51 Expect.equals(4, global); |
61 | 52 |
62 check_true_false(false, false, 1); | 53 check_true_false(false, false, 1); |
63 check_true_false(false, true, 2); | 54 check_true_false(false, true, 2); |
64 check_true_false(true, false, 3); | 55 check_true_false(true, false, 3); |
65 check_true_false(true, true, 4); | 56 check_true_false(true, true, 4); |
66 | 57 |
67 Expect.equals(3, global); | 58 Expect.equals(3, global); |
68 | 59 |
69 check_false_true(false, false, 1); | 60 check_false_true(false, false, 1); |
70 check_false_true(false, true, 2); | 61 check_false_true(false, true, 2); |
71 check_false_true(true, false, 3); | 62 check_false_true(true, false, 3); |
72 check_false_true(true, true, 4); | 63 check_false_true(true, true, 4); |
73 | 64 |
74 Expect.equals(2, global); | 65 Expect.equals(2, global); |
75 | 66 |
76 check_false_false(false, false, 1); | 67 check_false_false(false, false, 1); |
77 check_false_false(false, true, 2); | 68 check_false_false(false, true, 2); |
78 check_false_false(true, false, 3); | 69 check_false_false(true, false, 3); |
79 check_false_false(true, true, 4); | 70 check_false_false(true, true, 4); |
80 | 71 |
81 Expect.equals(1, global); | 72 Expect.equals(1, global); |
82 } | 73 } |
OLD | NEW |