OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Testing Bigints with and without intrinsics. | 5 // Testing Bigints with and without intrinsics. |
6 // VMOptions= | 6 // VMOptions= |
7 // VMOptions=--no_intrinsify | 7 // VMOptions=--no_intrinsify |
8 | 8 |
9 library big_integer_test; | 9 library big_integer_test; |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
(...skipping 10 matching lines...) Expand all Loading... |
21 "-0x${(-computed_quotient).toRadixString(16)}"; | 21 "-0x${(-computed_quotient).toRadixString(16)}"; |
22 Expect.equals(quotient.toLowerCase(), str_quotient); | 22 Expect.equals(quotient.toLowerCase(), str_quotient); |
23 int computed_remainder = int_a.remainder(int_b); | 23 int computed_remainder = int_a.remainder(int_b); |
24 Expect.equals(int_remainder, computed_remainder); | 24 Expect.equals(int_remainder, computed_remainder); |
25 String str_remainder = computed_remainder >= 0 ? | 25 String str_remainder = computed_remainder >= 0 ? |
26 "0x${computed_remainder.toRadixString(16)}" : | 26 "0x${computed_remainder.toRadixString(16)}" : |
27 "-0x${(-computed_remainder).toRadixString(16)}"; | 27 "-0x${(-computed_remainder).toRadixString(16)}"; |
28 Expect.equals(remainder.toLowerCase(), str_remainder); | 28 Expect.equals(remainder.toLowerCase(), str_remainder); |
29 } | 29 } |
30 | 30 |
31 | |
32 testBigintDivideRemainder() { | 31 testBigintDivideRemainder() { |
33 String zero = "0x0"; | 32 String zero = "0x0"; |
34 String one = "0x1"; | 33 String one = "0x1"; |
35 String minus_one = "-0x1"; | 34 String minus_one = "-0x1"; |
36 | 35 |
37 divRemParsed(one, one, one, zero); | 36 divRemParsed(one, one, one, zero); |
38 divRemParsed(zero, one, zero, zero); | 37 divRemParsed(zero, one, zero, zero); |
39 divRemParsed(minus_one, one, minus_one, zero); | 38 divRemParsed(minus_one, one, minus_one, zero); |
40 divRemParsed(one, "0x2", zero, one); | 39 divRemParsed(one, "0x2", zero, one); |
41 divRemParsed(minus_one, "0x7", zero, minus_one); | 40 divRemParsed(minus_one, "0x7", zero, minus_one); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 "567890123456789012345678901234567890123456789012345678901234567890123456" | 101 "567890123456789012345678901234567890123456789012345678901234567890123456" |
103 "789012345678901234567890123456789012345678901234567890123456789012345678" | 102 "789012345678901234567890123456789012345678901234567890123456789012345678" |
104 "90123456789012345678901234567890", | 103 "90123456789012345678901234567890", |
105 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" | 104 "0x1234567890ABCDEF01234567890ABCDEF01234567890ABCDEF01234567890ABCDEF" |
106 "01234567890ABCDEE"); | 105 "01234567890ABCDEE"); |
107 } | 106 } |
108 | 107 |
109 main() { | 108 main() { |
110 testBigintDivideRemainder(); | 109 testBigintDivideRemainder(); |
111 } | 110 } |
OLD | NEW |