| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, 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 |
| 5 import 'package:expect/expect.dart'; |
| 6 |
| 7 var global = 0; |
| 8 |
| 9 bar() { |
| 10 global += 1; |
| 11 } |
| 12 baz() { |
| 13 global += 100; |
| 14 } |
| 15 |
| 16 foo(x,y,z) { |
| 17 if ((x ? false : true) ? y : z) { |
| 18 bar(); |
| 19 bar(); |
| 20 } else { |
| 21 baz(); |
| 22 baz(); |
| 23 } |
| 24 } |
| 25 |
| 26 foo2(x,y,z) { |
| 27 return (x ? false : true) ? y : z; |
| 28 } |
| 29 |
| 30 foo3(x,y,z) { |
| 31 if (x ? (z ? false : true) : (y ? false : true)) { |
| 32 baz(); |
| 33 baz(); |
| 34 } else { |
| 35 bar(); |
| 36 bar(); |
| 37 } |
| 38 } |
| 39 |
| 40 |
| 41 main() { |
| 42 foo(true,true,true); |
| 43 Expect.equals(2, global); |
| 44 |
| 45 foo(true,true,false); |
| 46 Expect.equals(202, global); |
| 47 |
| 48 foo(true,false,true); |
| 49 Expect.equals(204, global); |
| 50 |
| 51 foo(true,false,false); |
| 52 Expect.equals(404, global); |
| 53 |
| 54 foo(false,true,true); |
| 55 Expect.equals(406, global); |
| 56 |
| 57 foo(false,true,false); |
| 58 Expect.equals(408, global); |
| 59 |
| 60 foo(false,false,true); |
| 61 Expect.equals(608, global); |
| 62 |
| 63 foo(false,false,false); |
| 64 Expect.equals(808, global); |
| 65 |
| 66 Expect.equals(true, foo2(true,true,true)); |
| 67 Expect.equals(false, foo2(true,true,false)); |
| 68 Expect.equals(true, foo2(true,false,true)); |
| 69 Expect.equals(false, foo2(true,false,false)); |
| 70 Expect.equals(true, foo2(false,true,true)); |
| 71 Expect.equals(true, foo2(false,true,false)); |
| 72 Expect.equals(false, foo2(false,false,true)); |
| 73 Expect.equals(false, foo2(false,false,false)); |
| 74 |
| 75 global = 0; |
| 76 foo3(true,true,true); |
| 77 Expect.equals(2, global); |
| 78 |
| 79 foo3(true,true,false); |
| 80 Expect.equals(202, global); |
| 81 |
| 82 foo3(true,false,true); |
| 83 Expect.equals(204, global); |
| 84 |
| 85 foo3(true,false,false); |
| 86 Expect.equals(404, global); |
| 87 |
| 88 foo3(false,true,true); |
| 89 Expect.equals(406, global); |
| 90 |
| 91 foo3(false,true,false); |
| 92 Expect.equals(408, global); |
| 93 |
| 94 foo3(false,false,true); |
| 95 Expect.equals(608, global); |
| 96 |
| 97 foo3(false,false,false); |
| 98 Expect.equals(808, global); |
| 99 } |
| OLD | NEW |