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 // Test division by power of two. | 4 // Test division by power of two. |
5 // Test that results before and after optimization are the same. | 5 // Test that results before and after optimization are the same. |
6 | 6 |
| 7 import "package:expect/expect.dart"; |
| 8 |
7 // [function, [list of tuples argument/result]]. | 9 // [function, [list of tuples argument/result]]. |
8 var expectedResults = | 10 var expectedResults = |
9 [ [divBy1, | 11 [ [divBy1, |
10 [[134217730, 134217730], | 12 [[134217730, 134217730], |
11 [-134217730, -134217730], | 13 [-134217730, -134217730], |
12 [10, 10], | 14 [10, 10], |
13 [-10, -10]]], | 15 [-10, -10]]], |
14 [divByNeg1, | 16 [divByNeg1, |
15 [[134217730, -134217730], | 17 [[134217730, -134217730], |
16 [-134217730, 134217730], | 18 [-134217730, 134217730], |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 int res = v[1]; | 96 int res = v[1]; |
95 Expect.equals(res, f(arg)); | 97 Expect.equals(res, f(arg)); |
96 } | 98 } |
97 } | 99 } |
98 try { | 100 try { |
99 divBy0(4); | 101 divBy0(4); |
100 Expect.fail("Should have thrown exception."); | 102 Expect.fail("Should have thrown exception."); |
101 } on IntegerDivisionByZeroException catch (e) {} | 103 } on IntegerDivisionByZeroException catch (e) {} |
102 } | 104 } |
103 } | 105 } |
OLD | NEW |