OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Dart test program for testing while statement. | 4 // Dart test program for testing while statement. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 class Helper { | 8 class Helper { |
9 static int f1(bool b) { | 9 static int f1(bool b) { |
10 while (b) | 10 while (b) return 1; |
11 return 1; | |
12 | 11 |
13 return 2; | 12 return 2; |
14 } | 13 } |
15 | 14 |
16 static int f2(bool b) { | 15 static int f2(bool b) { |
17 while (b) { | 16 while (b) { |
18 return 1; | 17 return 1; |
19 } | 18 } |
20 return 2; | 19 return 2; |
21 } | 20 } |
(...skipping 25 matching lines...) Expand all Loading... |
47 Expect.equals(0, Helper.f3(0)); | 46 Expect.equals(0, Helper.f3(0)); |
48 Expect.equals(1, Helper.f3(1)); | 47 Expect.equals(1, Helper.f3(1)); |
49 Expect.equals(2, Helper.f3(2)); | 48 Expect.equals(2, Helper.f3(2)); |
50 Expect.equals(3, Helper.f4()); | 49 Expect.equals(3, Helper.f4()); |
51 } | 50 } |
52 } | 51 } |
53 | 52 |
54 main() { | 53 main() { |
55 WhileTest.testMain(); | 54 WhileTest.testMain(); |
56 } | 55 } |
OLD | NEW |