| 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 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 void do1() { | 7 void do1() { |
| 8 bool cond = true; | 8 bool cond = true; |
| 9 var result = 0; | 9 var result = 0; |
| 10 var x = 0; | 10 var x = 0; |
| 11 do { | 11 do { |
| 12 if (x == 10) cond = false; | 12 if (x == 10) cond = false; |
| 13 result += x; | 13 result += x; |
| 14 x = x + 1; | 14 x = x + 1; |
| 15 } while(cond); | 15 } while (cond); |
| 16 Expect.equals(55, result); | 16 Expect.equals(55, result); |
| 17 } | 17 } |
| 18 | 18 |
| 19 void do2() { | 19 void do2() { |
| 20 var t = 0; | 20 var t = 0; |
| 21 var i = 0; | 21 var i = 0; |
| 22 do { | 22 do { |
| 23 t = t + 10; | 23 t = t + 10; |
| 24 i++; | 24 i++; |
| 25 } while (i == 0); | 25 } while (i == 0); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 var result = 0; | 39 var result = 0; |
| 40 var i = 0; | 40 var i = 0; |
| 41 do { | 41 do { |
| 42 if (i == 9) cond1 = false; | 42 if (i == 9) cond1 = false; |
| 43 var cond2 = true; | 43 var cond2 = true; |
| 44 var j = 0; | 44 var j = 0; |
| 45 do { | 45 do { |
| 46 if (j == 9) cond2 = false; | 46 if (j == 9) cond2 = false; |
| 47 result = result + 1; | 47 result = result + 1; |
| 48 j = j + 1; | 48 j = j + 1; |
| 49 } while(cond2); | 49 } while (cond2); |
| 50 i = i + 1; | 50 i = i + 1; |
| 51 } while(cond1); | 51 } while (cond1); |
| 52 Expect.equals(100, result); | 52 Expect.equals(100, result); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void main() { | 55 void main() { |
| 56 do1(); | 56 do1(); |
| 57 do2(); | 57 do2(); |
| 58 do3(); | 58 do3(); |
| 59 do4(); | 59 do4(); |
| 60 } | 60 } |
| OLD | NEW |