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

Side by Side Diff: tests/language/src/IfTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/src/HelloScriptTest.dart ('k') | tests/language/src/ImplicitClosure1Test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class Helper {
7 static int f0(bool b) {
8 if (b);
9 if (b); else;
10 if (b) {}
11 if (b) {} else {}
12 return 0;
13 }
14
15 static int f1(bool b) {
16 if (b)
17 return 1;
18 else
19 return 2;
20 }
21
22 static int f2(bool b) {
23 if (b) {
24 return 1;
25 } else {
26 return 2;
27 }
28 }
29
30 static int f3(bool b) {
31 if (b) return 1;
32 return 2;
33 }
34
35 static int f4(bool b) {
36 if (b) {
37 return 1;
38 }
39 return 2;
40 }
41
42 static int f5(bool b) {
43 if (!b) {
44 return 1;
45 }
46 return 2;
47 }
48
49 static int f6(bool a, bool b) {
50 if (a || b) {
51 return 1;
52 }
53 return 2;
54 }
55
56 static int f7(bool a, bool b) {
57 if (a && b) {
58 return 1;
59 }
60 return 2;
61 }
62 }
63
64 class IfTest {
65 static testMain() {
66 Expect.equals(0, Helper.f0(true));
67 Expect.equals(1, Helper.f1(true));
68 Expect.equals(2, Helper.f1(false));
69 Expect.equals(1, Helper.f2(true));
70 Expect.equals(2, Helper.f2(false));
71 Expect.equals(1, Helper.f3(true));
72 Expect.equals(2, Helper.f3(false));
73 Expect.equals(1, Helper.f4(true));
74 Expect.equals(2, Helper.f4(false));
75 Expect.equals(2, Helper.f5(true));
76 Expect.equals(1, Helper.f5(false));
77 Expect.equals(1, Helper.f6(true, true));
78 Expect.equals(1, Helper.f6(true, false));
79 Expect.equals(1, Helper.f6(false, true));
80 Expect.equals(2, Helper.f6(false, false));
81 Expect.equals(1, Helper.f7(true, true));
82 Expect.equals(2, Helper.f7(true, false));
83 Expect.equals(2, Helper.f7(false, true));
84 Expect.equals(2, Helper.f7(false, false));
85 }
86 }
87
88
89 main() {
90 IfTest.testMain();
91 }
OLDNEW
« no previous file with comments | « tests/language/src/HelloScriptTest.dart ('k') | tests/language/src/ImplicitClosure1Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698