Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: tests/corelib_strong/big_integer_parsed_arith_vm_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/corelib_strong/big_integer_parsed_arith_vm_test.dart
diff --git a/tests/corelib_strong/big_integer_parsed_arith_vm_test.dart b/tests/corelib_strong/big_integer_parsed_arith_vm_test.dart
index 79dfe1c40eee7de960b7ea80b987823d8e778b3d..88b4fd030e2e2b26587e1654e9d9c26b68e13b68 100644
--- a/tests/corelib_strong/big_integer_parsed_arith_vm_test.dart
+++ b/tests/corelib_strong/big_integer_parsed_arith_vm_test.dart
@@ -7,6 +7,7 @@
// VMOptions=--no_intrinsify
library big_integer_test;
+
import "package:expect/expect.dart";
addSubParsed(String a, String b, String sum) {
@@ -15,21 +16,21 @@ addSubParsed(String a, String b, String sum) {
int int_sum = int.parse(sum);
int computed_sum = int_a + int_b;
Expect.equals(int_sum, computed_sum);
- String str_sum = computed_sum >= 0 ?
- "0x${computed_sum.toRadixString(16)}" :
- "-0x${(-computed_sum).toRadixString(16)}";
+ String str_sum = computed_sum >= 0
+ ? "0x${computed_sum.toRadixString(16)}"
+ : "-0x${(-computed_sum).toRadixString(16)}";
Expect.equals(sum.toLowerCase(), str_sum);
int computed_difference1 = int_sum - int_a;
Expect.equals(int_b, computed_difference1);
- String str_difference1 = computed_difference1 >= 0 ?
- "0x${computed_difference1.toRadixString(16)}" :
- "-0x${(-computed_difference1).toRadixString(16)}";
+ String str_difference1 = computed_difference1 >= 0
+ ? "0x${computed_difference1.toRadixString(16)}"
+ : "-0x${(-computed_difference1).toRadixString(16)}";
Expect.equals(b.toLowerCase(), str_difference1);
int computed_difference2 = int_sum - int_b;
Expect.equals(int_a, computed_difference2);
- String str_difference2 = computed_difference2 >= 0 ?
- "0x${computed_difference2.toRadixString(16)}" :
- "-0x${(-computed_difference2).toRadixString(16)}";
+ String str_difference2 = computed_difference2 >= 0
+ ? "0x${computed_difference2.toRadixString(16)}"
+ : "-0x${(-computed_difference2).toRadixString(16)}";
Expect.equals(a.toLowerCase(), str_difference2);
}
@@ -47,38 +48,52 @@ testBigintAddSub() {
addSubParsed(zero, "0x123", "0x123");
addSubParsed("0x123", one, "0x124");
addSubParsed(one, "0x123", "0x124");
- addSubParsed("0xFFFFFFF", one, // 28 bit overflow.
- "0x10000000");
- addSubParsed("0xFFFFFFFF", one, // 32 bit overflow.
- "0x100000000");
- addSubParsed("0xFFFFFFFFFFFFFF", one, // 56 bit overflow.
- "0x100000000000000");
- addSubParsed("0xFFFFFFFFFFFFFFFF", one, // 64 bit overflow.
- "0x10000000000000000");
- addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", // 128 bit.
- one,
- "0x100000000000000000000000000000000");
- addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
- one,
- "0x10000000000000000000000000000000000000000000");
- addSubParsed("0x8000000", // 28 bit overflow.
- "0x8000000",
- "0x10000000");
- addSubParsed("0x80000000", // 32 bit overflow.
- "0x80000000",
- "0x100000000");
- addSubParsed("0x80000000000000", // 56 bit overflow.
- "0x80000000000000",
- "0x100000000000000");
- addSubParsed("0x8000000000000000", // 64 bit overflow.
- "0x8000000000000000",
- "0x10000000000000000");
- addSubParsed("0x80000000000000000000000000000000", // 128 bit.
- "0x80000000000000000000000000000000",
- "0x100000000000000000000000000000000");
- addSubParsed("0x8000000000000000000000000000000000000000000",
- "0x8000000000000000000000000000000000000000000",
- "0x10000000000000000000000000000000000000000000");
+ addSubParsed(
+ "0xFFFFFFF",
+ one, // 28 bit overflow.
+ "0x10000000");
+ addSubParsed(
+ "0xFFFFFFFF",
+ one, // 32 bit overflow.
+ "0x100000000");
+ addSubParsed(
+ "0xFFFFFFFFFFFFFF",
+ one, // 56 bit overflow.
+ "0x100000000000000");
+ addSubParsed(
+ "0xFFFFFFFFFFFFFFFF",
+ one, // 64 bit overflow.
+ "0x10000000000000000");
+ addSubParsed(
+ "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", // 128 bit.
+ one,
+ "0x100000000000000000000000000000000");
+ addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", one,
+ "0x10000000000000000000000000000000000000000000");
+ addSubParsed(
+ "0x8000000", // 28 bit overflow.
+ "0x8000000",
+ "0x10000000");
+ addSubParsed(
+ "0x80000000", // 32 bit overflow.
+ "0x80000000",
+ "0x100000000");
+ addSubParsed(
+ "0x80000000000000", // 56 bit overflow.
+ "0x80000000000000",
+ "0x100000000000000");
+ addSubParsed(
+ "0x8000000000000000", // 64 bit overflow.
+ "0x8000000000000000",
+ "0x10000000000000000");
+ addSubParsed(
+ "0x80000000000000000000000000000000", // 128 bit.
+ "0x80000000000000000000000000000000",
+ "0x100000000000000000000000000000000");
+ addSubParsed(
+ "0x8000000000000000000000000000000000000000000",
+ "0x8000000000000000000000000000000000000000000",
+ "0x10000000000000000000000000000000000000000000");
{
String a = "0x123456789ABCDEF01234567890ABCDEF0123456789ABCDEF0";
@@ -91,38 +106,52 @@ testBigintAddSub() {
addSubParsed("-0x123", minus_one, "-0x124");
addSubParsed(minus_one, "-0x123", "-0x124");
- addSubParsed("-0xFFFFFFF", minus_one, // 28 bit overflow.
- "-0x10000000");
- addSubParsed("-0xFFFFFFFF", minus_one, // 32 bit overflow.
- "-0x100000000");
- addSubParsed("-0xFFFFFFFFFFFFFF", minus_one, // 56 bit overflow.
- "-0x100000000000000");
- addSubParsed("-0xFFFFFFFFFFFFFFFF", minus_one, // 64 bit overflow.
- "-0x10000000000000000");
- addSubParsed("-0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", // 128 bit.
- minus_one,
- "-0x100000000000000000000000000000000");
- addSubParsed("-0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
- minus_one,
- "-0x10000000000000000000000000000000000000000000");
- addSubParsed("-0x8000000", // 28 bit overflow.
- "-0x8000000",
- "-0x10000000");
- addSubParsed("-0x80000000", // 32 bit overflow.
- "-0x80000000",
- "-0x100000000");
- addSubParsed("-0x80000000000000", // 56 bit overflow.
- "-0x80000000000000",
- "-0x100000000000000");
- addSubParsed("-0x8000000000000000", // 64 bit overflow.
- "-0x8000000000000000",
- "-0x10000000000000000");
- addSubParsed("-0x80000000000000000000000000000000", // 128 bit.
- "-0x80000000000000000000000000000000",
- "-0x100000000000000000000000000000000");
- addSubParsed("-0x8000000000000000000000000000000000000000000",
- "-0x8000000000000000000000000000000000000000000",
- "-0x10000000000000000000000000000000000000000000");
+ addSubParsed(
+ "-0xFFFFFFF",
+ minus_one, // 28 bit overflow.
+ "-0x10000000");
+ addSubParsed(
+ "-0xFFFFFFFF",
+ minus_one, // 32 bit overflow.
+ "-0x100000000");
+ addSubParsed(
+ "-0xFFFFFFFFFFFFFF",
+ minus_one, // 56 bit overflow.
+ "-0x100000000000000");
+ addSubParsed(
+ "-0xFFFFFFFFFFFFFFFF",
+ minus_one, // 64 bit overflow.
+ "-0x10000000000000000");
+ addSubParsed(
+ "-0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", // 128 bit.
+ minus_one,
+ "-0x100000000000000000000000000000000");
+ addSubParsed("-0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", minus_one,
+ "-0x10000000000000000000000000000000000000000000");
+ addSubParsed(
+ "-0x8000000", // 28 bit overflow.
+ "-0x8000000",
+ "-0x10000000");
+ addSubParsed(
+ "-0x80000000", // 32 bit overflow.
+ "-0x80000000",
+ "-0x100000000");
+ addSubParsed(
+ "-0x80000000000000", // 56 bit overflow.
+ "-0x80000000000000",
+ "-0x100000000000000");
+ addSubParsed(
+ "-0x8000000000000000", // 64 bit overflow.
+ "-0x8000000000000000",
+ "-0x10000000000000000");
+ addSubParsed(
+ "-0x80000000000000000000000000000000", // 128 bit.
+ "-0x80000000000000000000000000000000",
+ "-0x100000000000000000000000000000000");
+ addSubParsed(
+ "-0x8000000000000000000000000000000000000000000",
+ "-0x8000000000000000000000000000000000000000000",
+ "-0x10000000000000000000000000000000000000000000");
{
String a = "-0x123456789ABCDEF01234567890ABCDEF0123456789ABCDEF0";
@@ -133,18 +162,16 @@ testBigintAddSub() {
addSubParsed(a, a, times2);
}
+ addSubParsed("0x10000000000000000000000000000000000000000000", "0xFFFF",
+ "0x1000000000000000000000000000000000000000FFFF");
addSubParsed("0x10000000000000000000000000000000000000000000",
- "0xFFFF",
- "0x1000000000000000000000000000000000000000FFFF");
- addSubParsed("0x10000000000000000000000000000000000000000000",
- "0xFFFF00000000",
- "0x10000000000000000000000000000000FFFF00000000");
- addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
- "0x100000000",
- "0x1000000000000000000000000000000000000FFFFFFFF");
- addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
- "0x10000000000000000000",
- "0x10000000000000000000000000FFFFFFFFFFFFFFFFFFF");
+ "0xFFFF00000000", "0x10000000000000000000000000000000FFFF00000000");
+ addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "0x100000000",
+ "0x1000000000000000000000000000000000000FFFFFFFF");
+ addSubParsed(
+ "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
+ "0x10000000000000000000",
+ "0x10000000000000000000000000FFFFFFFFFFFFFFFFFFF");
addSubParsed("0xB", "-0x7", "0x4");
addSubParsed("-0xB", "-0x7", "-0x12");
@@ -161,15 +188,15 @@ shiftLeftParsed(String a, int amount, String result) {
int int_result = int.parse(result);
int shifted = int_a << amount;
Expect.equals(int_result, shifted);
- String str_shifted = shifted >= 0 ?
- "0x${shifted.toRadixString(16)}" :
- "-0x${(-shifted).toRadixString(16)}";
+ String str_shifted = shifted >= 0
+ ? "0x${shifted.toRadixString(16)}"
+ : "-0x${(-shifted).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_shifted);
int back_shifted = shifted >> amount;
Expect.equals(int_a, back_shifted);
- String str_back_shifted = back_shifted >= 0 ?
- "0x${back_shifted.toRadixString(16)}" :
- "-0x${(-back_shifted).toRadixString(16)}";
+ String str_back_shifted = back_shifted >= 0
+ ? "0x${back_shifted.toRadixString(16)}"
+ : "-0x${(-back_shifted).toRadixString(16)}";
Expect.equals(a.toLowerCase(), str_back_shifted);
}
@@ -201,8 +228,8 @@ testBigintLeftShift() {
shiftLeftParsed("0x8000000000000001", 1, "0x10000000000000002");
shiftLeftParsed("0x8000001", 29, "0x100000020000000");
shiftLeftParsed("0x80000001", 33, "0x10000000200000000");
- shiftLeftParsed("0x8000000000000001", 65,
- "0x100000000000000020000000000000000");
+ shiftLeftParsed(
+ "0x8000000000000001", 65, "0x100000000000000020000000000000000");
shiftLeftParsed(minus_one, 0, minus_one);
shiftLeftParsed("-0x1234", 0, "-0x1234");
shiftLeftParsed(minus_one, 1, "-0x2");
@@ -220,8 +247,8 @@ testBigintLeftShift() {
shiftLeftParsed("-0x8000000000000001", 1, "-0x10000000000000002");
shiftLeftParsed("-0x8000001", 29, "-0x100000020000000");
shiftLeftParsed("-0x80000001", 33, "-0x10000000200000000");
- shiftLeftParsed("-0x8000000000000001", 65,
- "-0x100000000000000020000000000000000");
+ shiftLeftParsed(
+ "-0x8000000000000001", 65, "-0x100000000000000020000000000000000");
}
shiftRightParsed(String a, int amount, String result) {
@@ -229,9 +256,9 @@ shiftRightParsed(String a, int amount, String result) {
int int_result = int.parse(result);
int shifted = int_a >> amount;
Expect.equals(int_result, shifted);
- String str_shifted = shifted >= 0 ?
- "0x${shifted.toRadixString(16)}" :
- "-0x${(-shifted).toRadixString(16)}";
+ String str_shifted = shifted >= 0
+ ? "0x${shifted.toRadixString(16)}"
+ : "-0x${(-shifted).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_shifted);
}
@@ -270,15 +297,15 @@ bitAndParsed(String a, String b, String result) {
int int_result = int.parse(result);
int anded = int_a & int_b;
Expect.equals(int_result, anded);
- String str_anded = anded >= 0 ?
- "0x${anded.toRadixString(16)}" :
- "-0x${(-anded).toRadixString(16)}";
+ String str_anded = anded >= 0
+ ? "0x${anded.toRadixString(16)}"
+ : "-0x${(-anded).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_anded);
int anded2 = int_b & int_a;
Expect.equals(int_result, anded2);
- String str_anded2 = anded2 >= 0 ?
- "0x${anded2.toRadixString(16)}" :
- "-0x${(-anded2).toRadixString(16)}";
+ String str_anded2 = anded2 >= 0
+ ? "0x${anded2.toRadixString(16)}"
+ : "-0x${(-anded2).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_anded2);
}
@@ -302,21 +329,18 @@ testBigintBitAnd() {
bitAndParsed("0x50000000000000000", minus_one, "0x50000000000000000");
bitAndParsed("-0x50000000", "-0x50000000", "-0x50000000");
bitAndParsed("-0x500000000", "-0x500000000", "-0x500000000");
- bitAndParsed("-0x50000000000000000",
- "-0x50000000000000000",
- "-0x50000000000000000");
- bitAndParsed("0x1234567890ABCDEF012345678",
- "0x876543210FEDCBA0987654321",
- "0x224422000A9C9A0002244220");
- bitAndParsed("-0x1234567890ABCDEF012345678",
- "-0x876543210FEDCBA0987654321",
- "-0x977557799FEFCFEF997755778");
- bitAndParsed("0x1234567890ABCDEF012345678",
- "-0x876543210FEDCBA0987654321",
- "0x101014589002044F010101458");
- bitAndParsed("0x1234567890ABCDEF012345678FFFFFFFFFFFFFFFFFFFFFFFFF",
- "-0x876543210FEDCBA0987654321",
- "0x1234567890ABCDEF012345678789ABCDEF012345F6789ABCDF");
+ bitAndParsed(
+ "-0x50000000000000000", "-0x50000000000000000", "-0x50000000000000000");
+ bitAndParsed("0x1234567890ABCDEF012345678", "0x876543210FEDCBA0987654321",
+ "0x224422000A9C9A0002244220");
+ bitAndParsed("-0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321",
+ "-0x977557799FEFCFEF997755778");
+ bitAndParsed("0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321",
+ "0x101014589002044F010101458");
+ bitAndParsed(
+ "0x1234567890ABCDEF012345678FFFFFFFFFFFFFFFFFFFFFFFFF",
+ "-0x876543210FEDCBA0987654321",
+ "0x1234567890ABCDEF012345678789ABCDEF012345F6789ABCDF");
bitAndParsed("0x12345678", "0xFFFFFFF", "0x2345678");
bitAndParsed("0x123456789", "0xFFFFFFFF", "0x23456789");
bitAndParsed("-0x10000000", "0xFFFFFFF", "0x0");
@@ -325,55 +349,54 @@ testBigintBitAnd() {
bitAndParsed("-0x100000001", "0xFFFFFFFF", "0xFFFFFFFF");
bitAndParsed("-0x10000001", "0x3FFFFFFF", "0x2FFFFFFF");
bitAndParsed("-0x100000001", "0x3FFFFFFFF", "0x2FFFFFFFF");
- bitAndParsed("-0x10000000000000001",
- "0x3FFFFFFFFFFFFFFFF",
- "0x2FFFFFFFFFFFFFFFF");
+ bitAndParsed(
+ "-0x10000000000000001", "0x3FFFFFFFFFFFFFFFF", "0x2FFFFFFFFFFFFFFFF");
bitAndParsed("-0x100000000000000", "0xFFFFFFFFFFFFFF", "0x0");
bitAndParsed("-0x10000000000000000", "0xFFFFFFFFFFFFFFFF", "0x0");
- bitAndParsed("-0x300000000000000",
- "0xFFFFFFFFFFFFFFF",
- "0xD00000000000000");
- bitAndParsed("-0x30000000000000000",
- "0xFFFFFFFFFFFFFFFFF",
- "0xD0000000000000000");
+ bitAndParsed("-0x300000000000000", "0xFFFFFFFFFFFFFFF", "0xD00000000000000");
+ bitAndParsed(
+ "-0x30000000000000000", "0xFFFFFFFFFFFFFFFFF", "0xD0000000000000000");
bitAndParsed("-0x10000000", "-0x10000000", "-0x10000000");
bitAndParsed("-0x100000000", "-0x100000000", "-0x100000000");
- bitAndParsed("-0x100000000000000",
- "-0x100000000000000",
- "-0x100000000000000");
- bitAndParsed("-0x10000000000000000",
- "-0x10000000000000000",
- "-0x10000000000000000");
+ bitAndParsed(
+ "-0x100000000000000", "-0x100000000000000", "-0x100000000000000");
+ bitAndParsed(
+ "-0x10000000000000000", "-0x10000000000000000", "-0x10000000000000000");
bitAndParsed("-0x3", "-0x2", "-0x4");
bitAndParsed("-0x10000000", "-0x10000001", "-0x20000000");
bitAndParsed("-0x100000000", "-0x100000001", "-0x200000000");
- bitAndParsed("-0x100000000000000",
- "-0x100000000000001",
- "-0x200000000000000");
- bitAndParsed("-0x10000000000000000",
- "-0x10000000000000001",
- "-0x20000000000000000");
- bitAndParsed("0x123456789ABCDEF01234567890",
- "0x3FFFFFFF", // Max Smi for 32 bits.
- "0x34567890");
- bitAndParsed("0x123456789ABCDEF01274567890",
- "0x3FFFFFFF", // Max Smi for 32 bits.
- "0x34567890");
- bitAndParsed("0x123456789ABCDEF01234567890",
- "0x40000000", // Max Smi for 32 bits + 1.
- "0x0");
- bitAndParsed("0x123456789ABCDEF01274567890",
- "0x40000000", // Max Smi for 32 bits + 1.
- "0x40000000");
- bitAndParsed("0x123456789ABCDEF01234567890",
- "0x3FFFFFFFFFFFFFFF", // Max Smi for 64 bits.
- "0x3CDEF01234567890");
- bitAndParsed("0x123456789ACCDEF01234567890",
- "0x4000000000000000", // Max Smi for 64 bits + 1.
- "0x4000000000000000");
- bitAndParsed("0x123456789ABCDEF01234567890",
- "0x4000000000000000", // Max Smi for 64 bits + 1.
- "0x0");
+ bitAndParsed(
+ "-0x100000000000000", "-0x100000000000001", "-0x200000000000000");
+ bitAndParsed(
+ "-0x10000000000000000", "-0x10000000000000001", "-0x20000000000000000");
+ bitAndParsed(
+ "0x123456789ABCDEF01234567890",
+ "0x3FFFFFFF", // Max Smi for 32 bits.
+ "0x34567890");
+ bitAndParsed(
+ "0x123456789ABCDEF01274567890",
+ "0x3FFFFFFF", // Max Smi for 32 bits.
+ "0x34567890");
+ bitAndParsed(
+ "0x123456789ABCDEF01234567890",
+ "0x40000000", // Max Smi for 32 bits + 1.
+ "0x0");
+ bitAndParsed(
+ "0x123456789ABCDEF01274567890",
+ "0x40000000", // Max Smi for 32 bits + 1.
+ "0x40000000");
+ bitAndParsed(
+ "0x123456789ABCDEF01234567890",
+ "0x3FFFFFFFFFFFFFFF", // Max Smi for 64 bits.
+ "0x3CDEF01234567890");
+ bitAndParsed(
+ "0x123456789ACCDEF01234567890",
+ "0x4000000000000000", // Max Smi for 64 bits + 1.
+ "0x4000000000000000");
+ bitAndParsed(
+ "0x123456789ABCDEF01234567890",
+ "0x4000000000000000", // Max Smi for 64 bits + 1.
+ "0x0");
}
bitOrParsed(String a, String b, String result) {
@@ -382,15 +405,15 @@ bitOrParsed(String a, String b, String result) {
int int_result = int.parse(result);
int ored = int_a | int_b;
Expect.equals(int_result, ored);
- String str_ored = ored >= 0 ?
- "0x${ored.toRadixString(16)}" :
- "-0x${(-ored).toRadixString(16)}";
+ String str_ored = ored >= 0
+ ? "0x${ored.toRadixString(16)}"
+ : "-0x${(-ored).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_ored);
int ored2 = int_b | int_a;
Expect.equals(int_result, ored2);
- String str_ored2 = ored2 >= 0 ?
- "0x${ored2.toRadixString(16)}" :
- "-0x${(-ored2).toRadixString(16)}";
+ String str_ored2 = ored2 >= 0
+ ? "0x${ored2.toRadixString(16)}"
+ : "-0x${(-ored2).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_ored2);
}
@@ -416,21 +439,16 @@ testBigintBitOr() {
bitOrParsed("0x50000000000000000", minus_one, minus_one);
bitOrParsed("-0x50000000", "-0x50000000", "-0x50000000");
bitOrParsed("-0x500000000", "-0x500000000", "-0x500000000");
- bitOrParsed("-0x50000000000000000",
- "-0x50000000000000000",
- "-0x50000000000000000");
- bitOrParsed("0x1234567890ABCDEF012345678",
- "0x876543210FEDCBA0987654321",
- "0x977557799FEFCFEF997755779");
- bitOrParsed("-0x1234567890ABCDEF012345678",
- "-0x876543210FEDCBA0987654321",
- "-0x224422000A9C9A0002244221");
- bitOrParsed("0x1234567890ABCDEF012345678",
- "-0x876543210FEDCBA0987654321",
- "-0x854101010F440200985410101");
+ bitOrParsed(
+ "-0x50000000000000000", "-0x50000000000000000", "-0x50000000000000000");
+ bitOrParsed("0x1234567890ABCDEF012345678", "0x876543210FEDCBA0987654321",
+ "0x977557799FEFCFEF997755779");
+ bitOrParsed("-0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321",
+ "-0x224422000A9C9A0002244221");
+ bitOrParsed("0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321",
+ "-0x854101010F440200985410101");
bitOrParsed("0x1234567890ABCDEF012345678FFFFFFFFFFFFFFFFFFFFFFFFF",
- "-0x876543210FEDCBA0987654321",
- "-0x1");
+ "-0x876543210FEDCBA0987654321", "-0x1");
bitOrParsed("0x12345678", "0xFFFFFFF", "0x1FFFFFFF");
bitOrParsed("0x123456789", "0xFFFFFFFF", "0x1FFFFFFFF");
bitOrParsed("-0x10000000", "0xFFFFFFF", "-0x1");
@@ -446,12 +464,9 @@ testBigintBitOr() {
bitOrParsed("-0x30000000000000000", "0xFFFFFFFFFFFFFFFFF", "-0x1");
bitOrParsed("-0x10000000", "-0x10000000", "-0x10000000");
bitOrParsed("-0x100000000", "-0x100000000", "-0x100000000");
- bitOrParsed("-0x100000000000000",
- "-0x100000000000000",
- "-0x100000000000000");
- bitOrParsed("-0x10000000000000000",
- "-0x10000000000000000",
- "-0x10000000000000000");
+ bitOrParsed("-0x100000000000000", "-0x100000000000000", "-0x100000000000000");
+ bitOrParsed(
+ "-0x10000000000000000", "-0x10000000000000000", "-0x10000000000000000");
bitOrParsed("-0x10000000", "-0x10000001", "-0x1");
bitOrParsed("-0x100000000", "-0x100000001", "-0x1");
bitOrParsed("-0x100000000000000", "-0x100000000000001", "-0x1");
@@ -465,21 +480,21 @@ bitXorParsed(String a, String b, String result) {
int int_result = int.parse(result);
int xored = int_a ^ int_b;
Expect.equals(int_result, xored);
- String str_xored = xored >= 0 ?
- "0x${xored.toRadixString(16)}" :
- "-0x${(-xored).toRadixString(16)}";
+ String str_xored = xored >= 0
+ ? "0x${xored.toRadixString(16)}"
+ : "-0x${(-xored).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_xored);
int xored2 = int_b ^ int_a;
Expect.equals(int_result, xored2);
- String str_xored2 = xored2 >= 0 ?
- "0x${xored2.toRadixString(16)}" :
- "-0x${(-xored2).toRadixString(16)}";
+ String str_xored2 = xored2 >= 0
+ ? "0x${xored2.toRadixString(16)}"
+ : "-0x${(-xored2).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_xored2);
int xored3 = int_a ^ xored2;
Expect.equals(int_b, xored3);
- String str_xored3 = xored3 >= 0 ?
- "0x${xored3.toRadixString(16)}" :
- "-0x${(-xored3).toRadixString(16)}";
+ String str_xored3 = xored3 >= 0
+ ? "0x${xored3.toRadixString(16)}"
+ : "-0x${(-xored3).toRadixString(16)}";
Expect.equals(b.toLowerCase(), str_xored3);
}
@@ -506,18 +521,16 @@ testBigintBitXor() {
bitXorParsed("-0x50000000", "-0x50000000", zero);
bitXorParsed("-0x500000000", "-0x500000000", zero);
bitXorParsed("-0x50000000000000000", "-0x50000000000000000", zero);
- bitXorParsed("0x1234567890ABCDEF012345678",
- "0x876543210FEDCBA0987654321",
- "0x955115599F46064F995511559");
- bitXorParsed("-0x1234567890ABCDEF012345678",
- "-0x876543210FEDCBA0987654321",
- "0x955115599F46064F995511557");
- bitXorParsed("0x1234567890ABCDEF012345678",
- "-0x876543210FEDCBA0987654321",
- "-0x955115599F46064F995511559");
- bitXorParsed("0x1234567890ABCDEF012345678FFFFFFFFFFFFFFFFFFFFFFFFF",
- "-0x876543210FEDCBA0987654321",
- "-0x1234567890ABCDEF012345678789ABCDEF012345F6789ABCE0");
+ bitXorParsed("0x1234567890ABCDEF012345678", "0x876543210FEDCBA0987654321",
+ "0x955115599F46064F995511559");
+ bitXorParsed("-0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321",
+ "0x955115599F46064F995511557");
+ bitXorParsed("0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321",
+ "-0x955115599F46064F995511559");
+ bitXorParsed(
+ "0x1234567890ABCDEF012345678FFFFFFFFFFFFFFFFFFFFFFFFF",
+ "-0x876543210FEDCBA0987654321",
+ "-0x1234567890ABCDEF012345678789ABCDEF012345F6789ABCE0");
bitXorParsed("0x12345678", "0xFFFFFFF", "0x1DCBA987");
bitXorParsed("0x123456789", "0xFFFFFFFF", "0x1DCBA9876");
bitXorParsed("-0x10000000", "0xFFFFFFF", "-0x1");
@@ -526,29 +539,22 @@ testBigintBitXor() {
bitXorParsed("-0x100000001", "0xFFFFFFFF", "-0x200000000");
bitXorParsed("-0x10000001", "0x3FFFFFFF", "-0x30000000");
bitXorParsed("-0x100000001", "0x3FFFFFFFF", "-0x300000000");
- bitXorParsed("-0x10000000000000001",
- "0x3FFFFFFFFFFFFFFFF",
- "-0x30000000000000000");
+ bitXorParsed(
+ "-0x10000000000000001", "0x3FFFFFFFFFFFFFFFF", "-0x30000000000000000");
bitXorParsed("-0x100000000000000", "0xFFFFFFFFFFFFFF", "-0x1");
bitXorParsed("-0x10000000000000000", "0xFFFFFFFFFFFFFFFF", "-0x1");
- bitXorParsed("-0x300000000000000",
- "0xFFFFFFFFFFFFFFF",
- "-0xD00000000000001");
- bitXorParsed("-0x30000000000000000",
- "0xFFFFFFFFFFFFFFFFF",
- "-0xD0000000000000001");
+ bitXorParsed("-0x300000000000000", "0xFFFFFFFFFFFFFFF", "-0xD00000000000001");
+ bitXorParsed(
+ "-0x30000000000000000", "0xFFFFFFFFFFFFFFFFF", "-0xD0000000000000001");
bitXorParsed("-0x10000000", "-0x10000000", zero);
bitXorParsed("-0x100000000", "-0x100000000", zero);
bitXorParsed("-0x100000000000000", "-0x100000000000000", zero);
bitXorParsed("-0x10000000000000000", "-0x10000000000000000", zero);
bitXorParsed("-0x10000000", "-0x10000001", "0x1FFFFFFF");
bitXorParsed("-0x100000000", "-0x100000001", "0x1FFFFFFFF");
- bitXorParsed("-0x100000000000000",
- "-0x100000000000001",
- "0x1FFFFFFFFFFFFFF");
- bitXorParsed("-0x10000000000000000",
- "-0x10000000000000001",
- "0x1FFFFFFFFFFFFFFFF");
+ bitXorParsed("-0x100000000000000", "-0x100000000000001", "0x1FFFFFFFFFFFFFF");
+ bitXorParsed(
+ "-0x10000000000000000", "-0x10000000000000001", "0x1FFFFFFFFFFFFFFFF");
}
bitNotParsed(String a, String result) {
@@ -556,15 +562,15 @@ bitNotParsed(String a, String result) {
int int_result = int.parse(result);
int inverted = ~int_a;
Expect.equals(int_result, inverted);
- String str_inverted = inverted >= 0 ?
- "0x${inverted.toRadixString(16)}" :
- "-0x${(-inverted).toRadixString(16)}";
+ String str_inverted = inverted >= 0
+ ? "0x${inverted.toRadixString(16)}"
+ : "-0x${(-inverted).toRadixString(16)}";
Expect.equals(result.toLowerCase(), str_inverted);
int back = ~inverted;
Expect.equals(int_a, back);
- String str_back = back >= 0 ?
- "0x${back.toRadixString(16)}" :
- "-0x${(-back).toRadixString(16)}";
+ String str_back = back >= 0
+ ? "0x${back.toRadixString(16)}"
+ : "-0x${(-back).toRadixString(16)}";
Expect.equals(a.toLowerCase(), str_back);
}
@@ -581,8 +587,7 @@ testBigintBitNot() {
bitNotParsed("0xFFFFFFFF", "-0x100000000");
bitNotParsed("0xFFFFFFFFFFFFFF", "-0x100000000000000");
bitNotParsed("0xFFFFFFFFFFFFFFFF", "-0x10000000000000000");
- bitNotParsed("0x1234567890ABCDEF012345678",
- "-0x1234567890ABCDEF012345679");
+ bitNotParsed("0x1234567890ABCDEF012345678", "-0x1234567890ABCDEF012345679");
}
main() {

Powered by Google App Engine
This is Rietveld 408576698