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

Unified Diff: test/codegen/expect/corelib/big_integer_parsed_arith_vm_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 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: test/codegen/expect/corelib/big_integer_parsed_arith_vm_test.js
diff --git a/test/codegen/expect/corelib/big_integer_parsed_arith_vm_test.js b/test/codegen/expect/corelib/big_integer_parsed_arith_vm_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6f7381d43f513e304c41da7e7f50261e2f78f405
--- /dev/null
+++ b/test/codegen/expect/corelib/big_integer_parsed_arith_vm_test.js
@@ -0,0 +1,440 @@
+dart_library.library('corelib/big_integer_parsed_arith_vm_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__big_integer_parsed_arith_vm_test(exports, dart_sdk, expect) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const expect$ = expect.expect;
+ const big_integer_parsed_arith_vm_test = Object.create(null);
+ let StringAndStringAndStringTodynamic = () => (StringAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String, core.String])))();
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ let StringAndintAndStringTodynamic = () => (StringAndintAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.int, core.String])))();
+ let StringAndStringTodynamic = () => (StringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String])))();
+ big_integer_parsed_arith_vm_test.addSubParsed = function(a, b, sum) {
+ let int_a = core.int.parse(a);
+ let int_b = core.int.parse(b);
+ let int_sum = core.int.parse(sum);
+ let computed_sum = dart.notNull(int_a) + dart.notNull(int_b);
+ expect$.Expect.equals(int_sum, computed_sum);
+ let str_sum = computed_sum >= 0 ? dart.str`0x${computed_sum[dartx.toRadixString](16)}` : dart.str`-0x${(-computed_sum)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(sum[dartx.toLowerCase](), str_sum);
+ let computed_difference1 = dart.notNull(int_sum) - dart.notNull(int_a);
+ expect$.Expect.equals(int_b, computed_difference1);
+ let str_difference1 = computed_difference1 >= 0 ? dart.str`0x${computed_difference1[dartx.toRadixString](16)}` : dart.str`-0x${(-computed_difference1)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(b[dartx.toLowerCase](), str_difference1);
+ let computed_difference2 = dart.notNull(int_sum) - dart.notNull(int_b);
+ expect$.Expect.equals(int_a, computed_difference2);
+ let str_difference2 = computed_difference2 >= 0 ? dart.str`0x${computed_difference2[dartx.toRadixString](16)}` : dart.str`-0x${(-computed_difference2)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(a[dartx.toLowerCase](), str_difference2);
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.addSubParsed, StringAndStringAndStringTodynamic());
+ big_integer_parsed_arith_vm_test.testBigintAddSub = function() {
+ let zero = "0x0";
+ let one = "0x1";
+ let minus_one = "-0x1";
+ big_integer_parsed_arith_vm_test.addSubParsed(zero, zero, zero);
+ big_integer_parsed_arith_vm_test.addSubParsed(zero, one, one);
+ big_integer_parsed_arith_vm_test.addSubParsed(one, zero, one);
+ big_integer_parsed_arith_vm_test.addSubParsed(one, one, "0x2");
+ big_integer_parsed_arith_vm_test.addSubParsed(minus_one, minus_one, "-0x2");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x123", zero, "0x123");
+ big_integer_parsed_arith_vm_test.addSubParsed(zero, "0x123", "0x123");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x123", one, "0x124");
+ big_integer_parsed_arith_vm_test.addSubParsed(one, "0x123", "0x124");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xFFFFFFF", one, "0x10000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xFFFFFFFF", one, "0x100000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xFFFFFFFFFFFFFF", one, "0x100000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xFFFFFFFFFFFFFFFF", one, "0x10000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", one, "0x100000000000000000000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", one, "0x10000000000000000000000000000000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x8000000", "0x8000000", "0x10000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x80000000", "0x80000000", "0x100000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x80000000000000", "0x80000000000000", "0x100000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x8000000000000000", "0x8000000000000000", "0x10000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x80000000000000000000000000000000", "0x80000000000000000000000000000000", "0x100000000000000000000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x8000000000000000000000000000000000000000000", "0x8000000000000000000000000000000000000000000", "0x10000000000000000000000000000000000000000000");
+ {
+ let a = "0x123456789ABCDEF01234567890ABCDEF0123456789ABCDEF0";
+ let sum1 = "0x123456789ABCDEF01234567890ABCDEF0123456789ABCDEF1";
+ let times2 = "0x2468ACF13579BDE02468ACF121579BDE02468ACF13579BDE0";
+ big_integer_parsed_arith_vm_test.addSubParsed(a, zero, a);
+ big_integer_parsed_arith_vm_test.addSubParsed(a, one, sum1);
+ big_integer_parsed_arith_vm_test.addSubParsed(a, a, times2);
+ }
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x123", minus_one, "-0x124");
+ big_integer_parsed_arith_vm_test.addSubParsed(minus_one, "-0x123", "-0x124");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0xFFFFFFF", minus_one, "-0x10000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0xFFFFFFFF", minus_one, "-0x100000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0xFFFFFFFFFFFFFF", minus_one, "-0x100000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0xFFFFFFFFFFFFFFFF", minus_one, "-0x10000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", minus_one, "-0x100000000000000000000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", minus_one, "-0x10000000000000000000000000000000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x8000000", "-0x8000000", "-0x10000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x80000000", "-0x80000000", "-0x100000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x80000000000000", "-0x80000000000000", "-0x100000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x8000000000000000", "-0x8000000000000000", "-0x10000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x80000000000000000000000000000000", "-0x80000000000000000000000000000000", "-0x100000000000000000000000000000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x8000000000000000000000000000000000000000000", "-0x8000000000000000000000000000000000000000000", "-0x10000000000000000000000000000000000000000000");
+ {
+ let a = "-0x123456789ABCDEF01234567890ABCDEF0123456789ABCDEF0";
+ let sum1 = "-0x123456789ABCDEF01234567890ABCDEF0123456789ABCDEF1";
+ let times2 = "-0x2468ACF13579BDE02468ACF121579BDE02468ACF13579BDE0";
+ big_integer_parsed_arith_vm_test.addSubParsed(a, zero, a);
+ big_integer_parsed_arith_vm_test.addSubParsed(a, minus_one, sum1);
+ big_integer_parsed_arith_vm_test.addSubParsed(a, a, times2);
+ }
+ big_integer_parsed_arith_vm_test.addSubParsed("0x10000000000000000000000000000000000000000000", "0xFFFF", "0x1000000000000000000000000000000000000000FFFF");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x10000000000000000000000000000000000000000000", "0xFFFF00000000", "0x10000000000000000000000000000000FFFF00000000");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "0x100000000", "0x1000000000000000000000000000000000000FFFFFFFF");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "0x10000000000000000000", "0x10000000000000000000000000FFFFFFFFFFFFFFFFFFF");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xB", "-0x7", "0x4");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0xB", "-0x7", "-0x12");
+ big_integer_parsed_arith_vm_test.addSubParsed("0xB", "0x7", "0x12");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0xB", "0x7", "-0x4");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x7", "0xB", "0x4");
+ big_integer_parsed_arith_vm_test.addSubParsed("-0x7", "-0xB", "-0x12");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x7", "0xB", "0x12");
+ big_integer_parsed_arith_vm_test.addSubParsed("0x7", "-0xB", "-0x4");
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.testBigintAddSub, VoidTodynamic());
+ big_integer_parsed_arith_vm_test.shiftLeftParsed = function(a, amount, result) {
+ let int_a = core.int.parse(a);
+ let int_result = core.int.parse(result);
+ let shifted = int_a[dartx['<<']](amount);
+ expect$.Expect.equals(int_result, shifted);
+ let str_shifted = shifted >= 0 ? dart.str`0x${shifted[dartx.toRadixString](16)}` : dart.str`-0x${(-shifted)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_shifted);
+ let back_shifted = shifted[dartx['>>']](amount);
+ expect$.Expect.equals(int_a, back_shifted);
+ let str_back_shifted = back_shifted >= 0 ? dart.str`0x${back_shifted[dartx.toRadixString](16)}` : dart.str`-0x${(-back_shifted)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(a[dartx.toLowerCase](), str_back_shifted);
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.shiftLeftParsed, StringAndintAndStringTodynamic());
+ big_integer_parsed_arith_vm_test.testBigintLeftShift = function() {
+ let zero = "0x0";
+ let one = "0x1";
+ let minus_one = "-0x1";
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(zero, 0, zero);
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(one, 0, one);
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x1234", 0, "0x1234");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(zero, 100000, zero);
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(one, 1, "0x2");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(one, 28, "0x10000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(one, 32, "0x100000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(one, 64, "0x10000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 28, "0x50000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 32, "0x500000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 56, "0x500000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 64, "0x50000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 128, "0x500000000000000000000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 27, "0x28000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 31, "0x280000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 55, "0x280000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 63, "0x28000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x5", 127, "0x280000000000000000000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x8000001", 1, "0x10000002");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x80000001", 1, "0x100000002");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x8000000000000001", 1, "0x10000000000000002");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x8000001", 29, "0x100000020000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x80000001", 33, "0x10000000200000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("0x8000000000000001", 65, "0x100000000000000020000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(minus_one, 0, minus_one);
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x1234", 0, "-0x1234");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(minus_one, 1, "-0x2");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(minus_one, 28, "-0x10000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(minus_one, 32, "-0x100000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed(minus_one, 64, "-0x10000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x5", 28, "-0x50000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x5", 32, "-0x500000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x5", 64, "-0x50000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x5", 27, "-0x28000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x5", 31, "-0x280000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x5", 63, "-0x28000000000000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x8000001", 1, "-0x10000002");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x80000001", 1, "-0x100000002");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x8000000000000001", 1, "-0x10000000000000002");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x8000001", 29, "-0x100000020000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x80000001", 33, "-0x10000000200000000");
+ big_integer_parsed_arith_vm_test.shiftLeftParsed("-0x8000000000000001", 65, "-0x100000000000000020000000000000000");
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.testBigintLeftShift, VoidTodynamic());
+ big_integer_parsed_arith_vm_test.shiftRightParsed = function(a, amount, result) {
+ let int_a = core.int.parse(a);
+ let int_result = core.int.parse(result);
+ let shifted = int_a[dartx['>>']](amount);
+ expect$.Expect.equals(int_result, shifted);
+ let str_shifted = shifted >= 0 ? dart.str`0x${shifted[dartx.toRadixString](16)}` : dart.str`-0x${(-shifted)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_shifted);
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.shiftRightParsed, StringAndintAndStringTodynamic());
+ big_integer_parsed_arith_vm_test.testBigintRightShift = function() {
+ let zero = "0x0";
+ let one = "0x1";
+ let minus_one = "-0x1";
+ big_integer_parsed_arith_vm_test.shiftRightParsed(one, 1, zero);
+ big_integer_parsed_arith_vm_test.shiftRightParsed(minus_one, 1, minus_one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x2", 1, minus_one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x12345678", 29, zero);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x12345678", 29, minus_one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x12345678", 100, minus_one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x5", 1, "0x2");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x5", 2, "0x1");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x5", 1, "-0x3");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x5", 2, "-0x2");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x10000001", 28, one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x100000001", 32, one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x10000000000000001", 64, one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x10000001", 28, "-0x2");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x100000001", 32, "-0x2");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x10000000000000001", 64, "-0x2");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x30000000", 29, one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x300000000", 33, one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("0x30000000000000000", 65, one);
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x30000000", 29, "-0x2");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x300000000", 33, "-0x2");
+ big_integer_parsed_arith_vm_test.shiftRightParsed("-0x30000000000000000", 65, "-0x2");
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.testBigintRightShift, VoidTodynamic());
+ big_integer_parsed_arith_vm_test.bitAndParsed = function(a, b, result) {
+ let int_a = core.int.parse(a);
+ let int_b = core.int.parse(b);
+ let int_result = core.int.parse(result);
+ let anded = (dart.notNull(int_a) & dart.notNull(int_b)) >>> 0;
+ expect$.Expect.equals(int_result, anded);
+ let str_anded = anded >= 0 ? dart.str`0x${anded[dartx.toRadixString](16)}` : dart.str`-0x${(-anded)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_anded);
+ let anded2 = (dart.notNull(int_b) & dart.notNull(int_a)) >>> 0;
+ expect$.Expect.equals(int_result, anded2);
+ let str_anded2 = anded2 >= 0 ? dart.str`0x${anded2[dartx.toRadixString](16)}` : dart.str`-0x${(-anded2)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_anded2);
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.bitAndParsed, StringAndStringAndStringTodynamic());
+ big_integer_parsed_arith_vm_test.testBigintBitAnd = function() {
+ let zero = "0x0";
+ let one = "0x1";
+ let minus_one = "-0x1";
+ big_integer_parsed_arith_vm_test.bitAndParsed(one, zero, zero);
+ big_integer_parsed_arith_vm_test.bitAndParsed(one, one, one);
+ big_integer_parsed_arith_vm_test.bitAndParsed(minus_one, zero, zero);
+ big_integer_parsed_arith_vm_test.bitAndParsed(minus_one, one, one);
+ big_integer_parsed_arith_vm_test.bitAndParsed(minus_one, minus_one, minus_one);
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x5", "0x3", one);
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x5", minus_one, "0x5");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x50000000", one, zero);
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x50000000", minus_one, "0x50000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x500000000", one, zero);
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x500000000", minus_one, "0x500000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x50000000000000000", one, zero);
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x50000000000000000", minus_one, "0x50000000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x50000000", "-0x50000000", "-0x50000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x500000000", "-0x500000000", "-0x500000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x50000000000000000", "-0x50000000000000000", "-0x50000000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x1234567890ABCDEF012345678", "0x876543210FEDCBA0987654321", "0x224422000A9C9A0002244220");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321", "-0x977557799FEFCFEF997755778");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321", "0x101014589002044F010101458");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x1234567890ABCDEF012345678FFFFFFFFFFFFFFFFFFFFFFFFF", "-0x876543210FEDCBA0987654321", "0x1234567890ABCDEF012345678789ABCDEF012345F6789ABCDF");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x12345678", "0xFFFFFFF", "0x2345678");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x123456789", "0xFFFFFFFF", "0x23456789");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000000", "0xFFFFFFF", "0x0");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x100000000", "0xFFFFFFFF", "0x0");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000001", "0xFFFFFFF", "0xFFFFFFF");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x100000001", "0xFFFFFFFF", "0xFFFFFFFF");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000001", "0x3FFFFFFF", "0x2FFFFFFF");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x100000001", "0x3FFFFFFFF", "0x2FFFFFFFF");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000000000000001", "0x3FFFFFFFFFFFFFFFF", "0x2FFFFFFFFFFFFFFFF");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x100000000000000", "0xFFFFFFFFFFFFFF", "0x0");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000000000000000", "0xFFFFFFFFFFFFFFFF", "0x0");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x300000000000000", "0xFFFFFFFFFFFFFFF", "0xD00000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x30000000000000000", "0xFFFFFFFFFFFFFFFFF", "0xD0000000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000000", "-0x10000000", "-0x10000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x100000000", "-0x100000000", "-0x100000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x100000000000000", "-0x100000000000000", "-0x100000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000000000000000", "-0x10000000000000000", "-0x10000000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x3", "-0x2", "-0x4");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000000", "-0x10000001", "-0x20000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x100000000", "-0x100000001", "-0x200000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x100000000000000", "-0x100000000000001", "-0x200000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("-0x10000000000000000", "-0x10000000000000001", "-0x20000000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x123456789ABCDEF01234567890", "0x3FFFFFFF", "0x34567890");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x123456789ABCDEF01274567890", "0x3FFFFFFF", "0x34567890");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x123456789ABCDEF01234567890", "0x40000000", "0x0");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x123456789ABCDEF01274567890", "0x40000000", "0x40000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x123456789ABCDEF01234567890", "0x3FFFFFFFFFFFFFFF", "0x3CDEF01234567890");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x123456789ACCDEF01234567890", "0x4000000000000000", "0x4000000000000000");
+ big_integer_parsed_arith_vm_test.bitAndParsed("0x123456789ABCDEF01234567890", "0x4000000000000000", "0x0");
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.testBigintBitAnd, VoidTodynamic());
+ big_integer_parsed_arith_vm_test.bitOrParsed = function(a, b, result) {
+ let int_a = core.int.parse(a);
+ let int_b = core.int.parse(b);
+ let int_result = core.int.parse(result);
+ let ored = (dart.notNull(int_a) | dart.notNull(int_b)) >>> 0;
+ expect$.Expect.equals(int_result, ored);
+ let str_ored = ored >= 0 ? dart.str`0x${ored[dartx.toRadixString](16)}` : dart.str`-0x${(-ored)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_ored);
+ let ored2 = (dart.notNull(int_b) | dart.notNull(int_a)) >>> 0;
+ expect$.Expect.equals(int_result, ored2);
+ let str_ored2 = ored2 >= 0 ? dart.str`0x${ored2[dartx.toRadixString](16)}` : dart.str`-0x${(-ored2)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_ored2);
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.bitOrParsed, StringAndStringAndStringTodynamic());
+ big_integer_parsed_arith_vm_test.testBigintBitOr = function() {
+ let zero = "0x0";
+ let one = "0x1";
+ let minus_one = "-0x1";
+ big_integer_parsed_arith_vm_test.bitOrParsed(one, zero, one);
+ big_integer_parsed_arith_vm_test.bitOrParsed(one, one, one);
+ big_integer_parsed_arith_vm_test.bitOrParsed(minus_one, zero, minus_one);
+ big_integer_parsed_arith_vm_test.bitOrParsed(minus_one, one, minus_one);
+ big_integer_parsed_arith_vm_test.bitOrParsed(minus_one, minus_one, minus_one);
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x3", one, "-0x3");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x5", "0x3", "0x7");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x5", minus_one, minus_one);
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x5", zero, "0x5");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x50000000", one, "0x50000001");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x50000000", minus_one, minus_one);
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x500000000", one, "0x500000001");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x500000000", minus_one, minus_one);
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x50000000000000000", one, "0x50000000000000001");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x50000000000000000", minus_one, minus_one);
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x50000000", "-0x50000000", "-0x50000000");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x500000000", "-0x500000000", "-0x500000000");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x50000000000000000", "-0x50000000000000000", "-0x50000000000000000");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x1234567890ABCDEF012345678", "0x876543210FEDCBA0987654321", "0x977557799FEFCFEF997755779");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321", "-0x224422000A9C9A0002244221");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321", "-0x854101010F440200985410101");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x1234567890ABCDEF012345678FFFFFFFFFFFFFFFFFFFFFFFFF", "-0x876543210FEDCBA0987654321", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x12345678", "0xFFFFFFF", "0x1FFFFFFF");
+ big_integer_parsed_arith_vm_test.bitOrParsed("0x123456789", "0xFFFFFFFF", "0x1FFFFFFFF");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000000", "0xFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x100000000", "0xFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000001", "0xFFFFFFF", "-0x10000001");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x100000001", "0xFFFFFFFF", "-0x100000001");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000001", "0x3FFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x100000001", "0x3FFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000000000000001", "0x3FFFFFFFFFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x100000000000000", "0xFFFFFFFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000000000000000", "0xFFFFFFFFFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x300000000000000", "0xFFFFFFFFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x30000000000000000", "0xFFFFFFFFFFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000000", "-0x10000000", "-0x10000000");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x100000000", "-0x100000000", "-0x100000000");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x100000000000000", "-0x100000000000000", "-0x100000000000000");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000000000000000", "-0x10000000000000000", "-0x10000000000000000");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000000", "-0x10000001", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x100000000", "-0x100000001", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x100000000000000", "-0x100000000000001", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000000000000000", "-0x10000000000000001", "-0x1");
+ big_integer_parsed_arith_vm_test.bitOrParsed("-0x10000000000000000", "-0x1", "-0x1");
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.testBigintBitOr, VoidTodynamic());
+ big_integer_parsed_arith_vm_test.bitXorParsed = function(a, b, result) {
+ let int_a = core.int.parse(a);
+ let int_b = core.int.parse(b);
+ let int_result = core.int.parse(result);
+ let xored = (dart.notNull(int_a) ^ dart.notNull(int_b)) >>> 0;
+ expect$.Expect.equals(int_result, xored);
+ let str_xored = xored >= 0 ? dart.str`0x${xored[dartx.toRadixString](16)}` : dart.str`-0x${(-xored)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_xored);
+ let xored2 = (dart.notNull(int_b) ^ dart.notNull(int_a)) >>> 0;
+ expect$.Expect.equals(int_result, xored2);
+ let str_xored2 = xored2 >= 0 ? dart.str`0x${xored2[dartx.toRadixString](16)}` : dart.str`-0x${(-xored2)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_xored2);
+ let xored3 = (dart.notNull(int_a) ^ xored2) >>> 0;
+ expect$.Expect.equals(int_b, xored3);
+ let str_xored3 = xored3 >= 0 ? dart.str`0x${xored3[dartx.toRadixString](16)}` : dart.str`-0x${(-xored3)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(b[dartx.toLowerCase](), str_xored3);
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.bitXorParsed, StringAndStringAndStringTodynamic());
+ big_integer_parsed_arith_vm_test.testBigintBitXor = function() {
+ let zero = "0x0";
+ let one = "0x1";
+ let minus_one = "-0x1";
+ big_integer_parsed_arith_vm_test.bitXorParsed(one, zero, one);
+ big_integer_parsed_arith_vm_test.bitXorParsed(one, one, zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed(minus_one, zero, minus_one);
+ big_integer_parsed_arith_vm_test.bitXorParsed(minus_one, one, "-0x2");
+ big_integer_parsed_arith_vm_test.bitXorParsed(minus_one, minus_one, zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x5", "0x3", "0x6");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x5", minus_one, "-0x6");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x5", zero, "0x5");
+ big_integer_parsed_arith_vm_test.bitXorParsed(minus_one, "-0x8", "0x7");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x50000000", one, "0x50000001");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x50000000", minus_one, "-0x50000001");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x500000000", one, "0x500000001");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x500000000", minus_one, "-0x500000001");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x50000000000000000", one, "0x50000000000000001");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x50000000000000000", minus_one, "-0x50000000000000001");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x50000000", "-0x50000000", zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x500000000", "-0x500000000", zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x50000000000000000", "-0x50000000000000000", zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x1234567890ABCDEF012345678", "0x876543210FEDCBA0987654321", "0x955115599F46064F995511559");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321", "0x955115599F46064F995511557");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x1234567890ABCDEF012345678", "-0x876543210FEDCBA0987654321", "-0x955115599F46064F995511559");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x1234567890ABCDEF012345678FFFFFFFFFFFFFFFFFFFFFFFFF", "-0x876543210FEDCBA0987654321", "-0x1234567890ABCDEF012345678789ABCDEF012345F6789ABCE0");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x12345678", "0xFFFFFFF", "0x1DCBA987");
+ big_integer_parsed_arith_vm_test.bitXorParsed("0x123456789", "0xFFFFFFFF", "0x1DCBA9876");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000000", "0xFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x100000000", "0xFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000001", "0xFFFFFFF", "-0x20000000");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x100000001", "0xFFFFFFFF", "-0x200000000");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000001", "0x3FFFFFFF", "-0x30000000");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x100000001", "0x3FFFFFFFF", "-0x300000000");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000000000000001", "0x3FFFFFFFFFFFFFFFF", "-0x30000000000000000");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x100000000000000", "0xFFFFFFFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000000000000000", "0xFFFFFFFFFFFFFFFF", "-0x1");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x300000000000000", "0xFFFFFFFFFFFFFFF", "-0xD00000000000001");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x30000000000000000", "0xFFFFFFFFFFFFFFFFF", "-0xD0000000000000001");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000000", "-0x10000000", zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x100000000", "-0x100000000", zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x100000000000000", "-0x100000000000000", zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000000000000000", "-0x10000000000000000", zero);
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000000", "-0x10000001", "0x1FFFFFFF");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x100000000", "-0x100000001", "0x1FFFFFFFF");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x100000000000000", "-0x100000000000001", "0x1FFFFFFFFFFFFFF");
+ big_integer_parsed_arith_vm_test.bitXorParsed("-0x10000000000000000", "-0x10000000000000001", "0x1FFFFFFFFFFFFFFFF");
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.testBigintBitXor, VoidTodynamic());
+ big_integer_parsed_arith_vm_test.bitNotParsed = function(a, result) {
+ let int_a = core.int.parse(a);
+ let int_result = core.int.parse(result);
+ let inverted = ~dart.notNull(int_a) >>> 0;
+ expect$.Expect.equals(int_result, inverted);
+ let str_inverted = inverted >= 0 ? dart.str`0x${inverted[dartx.toRadixString](16)}` : dart.str`-0x${(-inverted)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(result[dartx.toLowerCase](), str_inverted);
+ let back = ~inverted >>> 0;
+ expect$.Expect.equals(int_a, back);
+ let str_back = back >= 0 ? dart.str`0x${back[dartx.toRadixString](16)}` : dart.str`-0x${(-back)[dartx.toRadixString](16)}`;
+ expect$.Expect.equals(a[dartx.toLowerCase](), str_back);
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.bitNotParsed, StringAndStringTodynamic());
+ big_integer_parsed_arith_vm_test.testBigintBitNot = function() {
+ let zero = "0x0";
+ let one = "0x1";
+ let minus_one = "-0x1";
+ big_integer_parsed_arith_vm_test.bitNotParsed(zero, minus_one);
+ big_integer_parsed_arith_vm_test.bitNotParsed(one, "-0x2");
+ big_integer_parsed_arith_vm_test.bitNotParsed("0x5", "-0x6");
+ big_integer_parsed_arith_vm_test.bitNotParsed("0x50000000", "-0x50000001");
+ big_integer_parsed_arith_vm_test.bitNotParsed("0xFFFFFFF", "-0x10000000");
+ big_integer_parsed_arith_vm_test.bitNotParsed("0xFFFFFFFF", "-0x100000000");
+ big_integer_parsed_arith_vm_test.bitNotParsed("0xFFFFFFFFFFFFFF", "-0x100000000000000");
+ big_integer_parsed_arith_vm_test.bitNotParsed("0xFFFFFFFFFFFFFFFF", "-0x10000000000000000");
+ big_integer_parsed_arith_vm_test.bitNotParsed("0x1234567890ABCDEF012345678", "-0x1234567890ABCDEF012345679");
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.testBigintBitNot, VoidTodynamic());
+ big_integer_parsed_arith_vm_test.main = function() {
+ big_integer_parsed_arith_vm_test.testBigintAddSub();
+ big_integer_parsed_arith_vm_test.testBigintLeftShift();
+ big_integer_parsed_arith_vm_test.testBigintRightShift();
+ big_integer_parsed_arith_vm_test.testBigintBitAnd();
+ big_integer_parsed_arith_vm_test.testBigintBitOr();
+ big_integer_parsed_arith_vm_test.testBigintBitXor();
+ big_integer_parsed_arith_vm_test.testBigintBitNot();
+ };
+ dart.fn(big_integer_parsed_arith_vm_test.main, VoidTodynamic());
+ // Exports:
+ exports.big_integer_parsed_arith_vm_test = big_integer_parsed_arith_vm_test;
+});

Powered by Google App Engine
This is Rietveld 408576698