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

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

Issue 3003933002: Migrate block 116. (Closed)
Patch Set: Created 3 years, 3 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
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4 // Dart test program for testing if statement.
5
6 import "package:expect/expect.dart";
7
8 class Helper {
9 static int f0(bool b) {
10 if (b) ;
11 if (b)
12 ;
13 else
14 ;
15 if (b) {}
16 if (b) {} else {}
17 return 0;
18 }
19
20 static int f1(bool b) {
21 if (b)
22 return 1;
23 else
24 return 2;
25 }
26
27 static int f2(bool b) {
28 if (b) {
29 return 1;
30 } else {
31 return 2;
32 }
33 }
34
35 static int f3(bool b) {
36 if (b) return 1;
37 return 2;
38 }
39
40 static int f4(bool b) {
41 if (b) {
42 return 1;
43 }
44 return 2;
45 }
46
47 static int f5(bool b) {
48 if (!b) {
49 return 1;
50 }
51 return 2;
52 }
53
54 static int f6(bool a, bool b) {
55 if (a || b) {
56 return 1;
57 }
58 return 2;
59 }
60
61 static int f7(bool a, bool b) {
62 if (a && b) {
63 return 1;
64 }
65 return 2;
66 }
67 }
68
69 class IfTest {
70 static testMain() {
71 Expect.equals(0, Helper.f0(true));
72 Expect.equals(1, Helper.f1(true));
73 Expect.equals(2, Helper.f1(false));
74 Expect.equals(1, Helper.f2(true));
75 Expect.equals(2, Helper.f2(false));
76 Expect.equals(1, Helper.f3(true));
77 Expect.equals(2, Helper.f3(false));
78 Expect.equals(1, Helper.f4(true));
79 Expect.equals(2, Helper.f4(false));
80 Expect.equals(2, Helper.f5(true));
81 Expect.equals(1, Helper.f5(false));
82 Expect.equals(1, Helper.f6(true, true));
83 Expect.equals(1, Helper.f6(true, false));
84 Expect.equals(1, Helper.f6(false, true));
85 Expect.equals(2, Helper.f6(false, false));
86 Expect.equals(1, Helper.f7(true, true));
87 Expect.equals(2, Helper.f7(true, false));
88 Expect.equals(2, Helper.f7(false, true));
89 Expect.equals(2, Helper.f7(false, false));
90 }
91 }
92
93 main() {
94 IfTest.testMain();
95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698