| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // Tests of loops. | 5 // Tests of loops. |
| 6 | 6 |
| 7 import 'expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 | 8 |
| 9 fact(n) { | 9 fact(n) { |
| 10 var f = 1; | 10 var f = 1; |
| 11 while (n > 0) { | 11 while (n > 0) { |
| 12 f *= n; | 12 f *= n; |
| 13 --n; | 13 --n; |
| 14 } | 14 } |
| 15 return f; | 15 return f; |
| 16 } | 16 } |
| 17 | 17 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 Expect.isTrue(fib(6) == 8); | 82 Expect.isTrue(fib(6) == 8); |
| 83 Expect.isTrue(fib(7) == 13); | 83 Expect.isTrue(fib(7) == 13); |
| 84 Expect.isTrue(fib(42) == 267914296); | 84 Expect.isTrue(fib(42) == 267914296); |
| 85 Expect.isTrue(fib(3.14159) == 3); | 85 Expect.isTrue(fib(3.14159) == 3); |
| 86 | 86 |
| 87 test0(); | 87 test0(); |
| 88 test1(); | 88 test1(); |
| 89 test2(); | 89 test2(); |
| 90 test3(); | 90 test3(); |
| 91 } | 91 } |
| OLD | NEW |