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

Side by Side Diff: tests/language/src/DoWhileTest.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, 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/src/DivByZeroTest.dart ('k') | tests/language/src/DoubleComparisonTest.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 do while statement.
5
6 class Helper {
7 static int f1(bool b) {
8 do return 1;
9 while (b);
10 return 2;
11 }
12
13 static int f2(bool b) {
14 do {
15 return 1;
16 } while (b);
17 return 2;
18 }
19
20 static int f3(bool b) {
21 do
22 ;
23 while (b);
24 return 2;
25 }
26
27 static int f4(bool b) {
28 do {
29 } while (b);
30 return 2;
31 }
32
33 static int f5(int n) {
34 int i = 0;
35 do {
36 i++;
37 } while (i < n);
38 return i;
39 }
40 }
41
42 class DoWhileTest {
43 static testMain() {
44 Expect.equals(1, Helper.f1(true));
45 Expect.equals(1, Helper.f1(false));
46 Expect.equals(1, Helper.f2(true));
47 Expect.equals(1, Helper.f2(false));
48 Expect.equals(2, Helper.f3(false));
49 Expect.equals(2, Helper.f4(false));
50 Expect.equals(1, Helper.f5(-2));
51 Expect.equals(1, Helper.f5(-1));
52 Expect.equals(1, Helper.f5(0));
53 Expect.equals(1, Helper.f5(1));
54 Expect.equals(2, Helper.f5(2));
55 Expect.equals(3, Helper.f5(3));
56 }
57 }
58
59 main() {
60 DoWhileTest.testMain();
61 }
OLDNEW
« no previous file with comments | « tests/language/src/DivByZeroTest.dart ('k') | tests/language/src/DoubleComparisonTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698