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