OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Dart test program for testing math's pow. | 5 // Dart test program for testing math's pow. |
6 | 6 |
7 library pow_test; | 7 library pow_test; |
8 | 8 |
9 import "package:expect/expect.dart"; | |
10 import 'dart:math'; | 9 import 'dart:math'; |
11 | 10 |
12 var expectedResults = | 11 var expectedResults = |
13 [ | 12 [ |
14 1, | 13 1, |
15 2, | 14 2, |
16 4, | 15 4, |
17 8, | 16 8, |
18 16, | 17 16, |
19 32, | 18 32, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 88 } |
90 // Optimize it. | 89 // Optimize it. |
91 for (int i = 0; i < 8888; i++) { | 90 for (int i = 0; i < 8888; i++) { |
92 pow(2, 3); | 91 pow(2, 3); |
93 } | 92 } |
94 exp = 0; | 93 exp = 0; |
95 for (int val in expectedResults) { | 94 for (int val in expectedResults) { |
96 Expect.equals(val, pow(2, exp++)); | 95 Expect.equals(val, pow(2, exp++)); |
97 } | 96 } |
98 } | 97 } |
OLD | NEW |