Commit 21532b80 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[bigint] Remove BigInt.parseInt

which was dropped from the proposal:
https://github.com/tc39/proposal-bigint/pull/101

Bug: v8:6791
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I5a3e0024900b34a322a23bcbc4bfdbdffbf8b9d4
Reviewed-on: https://chromium-review.googlesource.com/885510
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50877}
parent bbcccc1c
......@@ -4516,9 +4516,6 @@ void Genesis::InitializeGlobal_harmony_bigint() {
Context::BIGINT_FUNCTION_INDEX);
// Install the properties of the BigInt constructor.
// parseInt(string, radix)
SimpleInstallFunction(bigint_fun, "parseInt", Builtins::kBigIntParseInt, 2,
false);
// asUintN(bits, bigint)
SimpleInstallFunction(bigint_fun, "asUintN", Builtins::kBigIntAsUintN, 2,
false);
......
......@@ -36,33 +36,6 @@ BUILTIN(BigIntConstructor_ConstructStub) {
isolate->factory()->BigInt_string()));
}
BUILTIN(BigIntParseInt) {
HandleScope scope(isolate);
Handle<Object> string = args.atOrUndefined(isolate, 1);
Handle<Object> radix = args.atOrUndefined(isolate, 2);
// Convert {string} to a String and flatten it.
// Fast path: avoid back-and-forth conversion for Smi inputs.
if (string->IsSmi() && radix->IsUndefined(isolate)) {
RETURN_RESULT_OR_FAILURE(isolate, BigInt::FromNumber(isolate, string));
}
Handle<String> subject;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, subject,
Object::ToString(isolate, string));
subject = String::Flatten(subject);
// Convert {radix} to Int32.
if (!radix->IsNumber()) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, radix, Object::ToNumber(radix));
}
int radix32 = DoubleToInt32(radix->Number());
if (radix32 != 0 && (radix32 < 2 || radix32 > 36)) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewSyntaxError(MessageTemplate::kToRadixFormatRange));
}
RETURN_RESULT_OR_FAILURE(isolate, BigIntParseInt(isolate, subject, radix32));
}
BUILTIN(BigIntAsUintN) {
HandleScope scope(isolate);
Handle<Object> bits_obj = args.atOrUndefined(isolate, 1);
......
......@@ -376,7 +376,6 @@ namespace internal {
/* BigInt */ \
CPP(BigIntConstructor) \
CPP(BigIntConstructor_ConstructStub) \
CPP(BigIntParseInt) \
CPP(BigIntAsUintN) \
CPP(BigIntAsIntN) \
CPP(BigIntPrototypeToLocaleString) \
......
......@@ -175,8 +175,8 @@ double InternalStringToIntDouble(UnicodeCache* unicode_cache, Iterator current,
}
// ES6 18.2.5 parseInt(string, radix) (with NumberParseIntHelper subclass);
// https://tc39.github.io/proposal-bigint/#sec-bigint-parseint-string-radix
// (with BigIntParseIntHelper subclass).
// and BigInt parsing cases from https://tc39.github.io/proposal-bigint/
// (with StringToBigIntHelper subclass).
class StringToIntHelper {
public:
StringToIntHelper(Isolate* isolate, Handle<String> subject, int radix)
......@@ -852,17 +852,12 @@ double StringToInt(Isolate* isolate, Handle<String> string, int radix) {
return helper.GetResult();
}
class BigIntParseIntHelper : public StringToIntHelper {
class StringToBigIntHelper : public StringToIntHelper {
public:
enum class Behavior { kParseInt, kStringToBigInt, kLiteral };
// Used for BigInt.parseInt API, where the input is a Heap-allocated String.
BigIntParseIntHelper(Isolate* isolate, Handle<String> string, int radix)
: StringToIntHelper(isolate, string, radix),
behavior_(Behavior::kParseInt) {}
enum class Behavior { kStringToBigInt, kLiteral };
// Used for StringToBigInt operation (BigInt constructor and == operator).
BigIntParseIntHelper(Isolate* isolate, Handle<String> string)
StringToBigIntHelper(Isolate* isolate, Handle<String> string)
: StringToIntHelper(isolate, string),
behavior_(Behavior::kStringToBigInt) {
set_allow_binary_and_octal_prefixes();
......@@ -871,7 +866,7 @@ class BigIntParseIntHelper : public StringToIntHelper {
// Used for parsing BigInt literals, where the input is a buffer of
// one-byte ASCII digits, along with an optional radix prefix.
BigIntParseIntHelper(Isolate* isolate, const uint8_t* string, int length)
StringToBigIntHelper(Isolate* isolate, const uint8_t* string, int length)
: StringToIntHelper(isolate, string, length),
behavior_(Behavior::kLiteral) {
set_allow_binary_and_octal_prefixes();
......@@ -884,9 +879,7 @@ class BigIntParseIntHelper : public StringToIntHelper {
return MaybeHandle<BigInt>();
}
if (state() == kEmpty) {
if (behavior_ == Behavior::kParseInt) {
set_state(kJunk);
} else if (behavior_ == Behavior::kStringToBigInt) {
if (behavior_ == Behavior::kStringToBigInt) {
set_state(kZero);
} else {
UNREACHABLE();
......@@ -938,28 +931,20 @@ class BigIntParseIntHelper : public StringToIntHelper {
}
private:
ShouldThrow should_throw() const {
return behavior_ == Behavior::kParseInt ? kThrowOnError : kDontThrow;
}
ShouldThrow should_throw() const { return kDontThrow; }
Handle<FreshlyAllocatedBigInt> result_;
Behavior behavior_;
};
MaybeHandle<BigInt> BigIntParseInt(Isolate* isolate, Handle<String> string,
int radix) {
BigIntParseIntHelper helper(isolate, string, radix);
return helper.GetResult();
}
MaybeHandle<BigInt> StringToBigInt(Isolate* isolate, Handle<String> string) {
string = String::Flatten(string);
BigIntParseIntHelper helper(isolate, string);
StringToBigIntHelper helper(isolate, string);
return helper.GetResult();
}
MaybeHandle<BigInt> BigIntLiteral(Isolate* isolate, const char* string) {
BigIntParseIntHelper helper(isolate, reinterpret_cast<const uint8_t*>(string),
StringToBigIntHelper helper(isolate, reinterpret_cast<const uint8_t*>(string),
static_cast<int>(strlen(string)));
return helper.GetResult();
}
......
......@@ -105,9 +105,6 @@ double StringToDouble(UnicodeCache* unicode_cache,
double StringToInt(Isolate* isolate, Handle<String> string, int radix);
// This follows BigInt.parseInt semantics: "" => SyntaxError.
MaybeHandle<BigInt> BigIntParseInt(Isolate* isolate, Handle<String> string,
int radix);
// This follows https://tc39.github.io/proposal-bigint/#sec-string-to-bigint
// semantics: "" => 0n.
MaybeHandle<BigInt> StringToBigInt(Isolate* isolate, Handle<String> string);
......
......@@ -162,9 +162,9 @@ class V8_EXPORT_PRIVATE BigInt : public BigIntBase {
class BodyDescriptor;
private:
friend class BigIntParseIntHelper;
friend class StringToBigIntHelper;
// Special functions for BigIntParseIntHelper:
// Special functions for StringToBigIntHelper:
static Handle<BigInt> Zero(Isolate* isolate);
static MaybeHandle<FreshlyAllocatedBigInt> AllocateFor(
Isolate* isolate, int radix, int charcount, ShouldThrow should_throw);
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "a2102214b151421124f462d37f843",
b: "90f3fa0f2fb9b1481b1a4737586ad6bdf71cb2ae51e06fdcb00fb779163e94ae4237",
r: "90f3fa0f2fb9b1481b1a4737586ad6bdf71cb2b872e29127c523d88b6584c1e63a7a"
a: -0xc4043e2c4cc49e4d6870103ce7c2ff2d512bf4b1b67553ba410db514ee0af8888ad6cfn,
b: 0x2aae86de73ff479133a657a40d26e8dcf192019c7421836615ec34978bad93n,
r: -0xc4043e2c2216176ef470c8abb41ca78944050bd4c4e3521dccec31aed81ec3f0ff293cn
}, {
a: "35ca28bdd383c1b9ffdb851cc7f385ad370eef3d",
b: "-ca2d4dd677f23e005f44ec121303c3c304940eb2fd15e9e88772a3c5ba8515",
r: "-ca2d4dd677f23e005f44ebdc48db05ef80d254b32190cd2093ecf68eab95d8"
a: -0xee0933b25c8c0ef09fa385ffa1d3ca76855b560e186d27fa9f6ce105cb8517a4aecd5n,
b: -0x2ffc3a7babad313ede574774cb55cd40ab3b2n,
r: -0xee0933b25c8c0ef09fa385ffa1d3ca76b5579089c41a59397dc4287a96dae4e55a087n
}, {
a: "-8abb4b6ca534b584fad2f5898dd22ae6",
b: "0",
r: "-8abb4b6ca534b584fad2f5898dd22ae6"
a: -0xdbb3e8fac212affdeda8959829838af77e43172n,
b: 0x2315999da3ac2ab89d2076cbe6e2e03082352e92c274680117ce7012dn,
r: 0x2315999da3ac2ab89c44c2e2ec20cd80844785fd2a4ae47620502cfbbn
}, {
a: "b3",
b: "4180a0a",
r: "4180abd"
a: -0x5ad9780b309c24919defb1b331ebba4en,
b: 0xbe8dd806b3da0f79e7f6ad2fb566536cc78c1471c236891ce0n,
r: 0xbe8dd806b3da0f79e79bd3b7aa35b74835ee24c00f049d6292n
}, {
a: "-8de89",
b: "c329fbab24d762a9453f90b134fcf5da9777aa1fdb26b74f27583a92a43f0f2c450",
r: "c329fbab24d762a9453f90b134fcf5da9777aa1fdb26b74f27583a92a43f0e9e5c7"
a: -0xade45eac6aaaf2c8097d7a3efecba4e80dd7aac4f692cfe841d113e68096c0218d521an,
b: -0x73c4119b366e22edd0797b5883a13e3bfc4124a559903ce785e0c833a8306b41cfn,
r: -0xade4d2707c4629362c6b4ab87a2428894c13a7061b3829787eb899c748ca6851f893e9n
}, {
a: "-49af5f350d64c75047dfb107550dae478c983dd520e86c9807b1f5",
b: "60a62691669b8c323a29db2eb9cb75ba5811",
r: "-49af5f350d64c750477f0ae0c3a712bb5a5e13f9f22ea1224d59e4"
a: -0x6e9ab93d5cff3b3f31a55aa2f43fc321bff6978189e00fa4e64cn,
b: 0xec1caec29eb55312a313e50e20178873a350f1f89cbc971n,
r: -0x6e9aaa7b92131153dc743071b5eee120476f5d4c7ac085d91cdbn
}, {
a: "80bf614aaa1140792099375f7fac9c7046303a8d13086755d505795f38761",
b: "-949dc945",
r: "80bf614aaa1140792099375f7fac9c7046303a8d13086755d50570155be1c"
a: -0x9a61c05bd53b74b731b8f8687e64d1ed1340404b5137ce39n,
b: -0x1e6793ea0fa51b2354b48n,
r: -0x9a61c05bd53b74b731b8f8687e66b86651e13a9d036d1981n
}, {
a: "4241d736e6a40",
b: "-78e88f5eaeae4ff8b",
r: "-78e84d1cd7776954b"
a: -0x7c5a08517038f7dn,
b: 0x1d89f2n,
r: -0x7c5a08516e6058bn
}, {
a: "-8033927bf52210827b99e712fb220631503adfaa4e0045c872b9b",
b: "-2f",
r: "-8033927bf52210827b99e712fb220631503adfaa4e0045c872bca"
a: -0xc4fd1b5aae2cfdc7b3ea6a74b7926a9a1ca3513bd08341e0c770080ban,
b: 0x76c79770202f9d9c6d2e244n,
r: -0xc4fd1b5aae2cfdc7b3ea6a74b7926a9a1c2c89a4606312432b02d9e76n
}, {
a: "-3ad8b67efe9",
b: "-35586bf43788fd8e313da33c62d9a5",
r: "-35586bf43788fd8e314150c7cac98e"
a: 0xda114ddab6bfed910cc05c64f72961107beb98c3271n,
b: 0x98c52c393c6660663248fcbaa300b8n,
r: 0xda114ddab6bff71d5f83f02b5d2fc4350bb742f3329n
}, {
a: "-a43d8c9af54e8ea545e1af4674613932650c833669c7adc9273b77",
b: "-6a4",
r: "-a43d8c9af54e8ea545e1af4674613932650c833669c7adc927421b"
a: -0x46311d926dfd26f0850ea3497fcd0d95a5dabab0361f219a601dc3dbe35d0n,
b: -0xf340af7b84e4eced2ca613e1ef4bb6aec4b8f01bc3n,
r: -0x46311d926dfd26f0851dd75477855be474ad8511743e1655cb0a0f6ae5193n
}, {
a: "26c178e22dd42280a59b",
b: "fba77d85ba082981ce4a1ca21ac8b805b389297dc",
r: "fba77d85ba082981ce4a1f0e3256dae2f5b133d77"
a: 0xb2b4d9c0c73258a8092n,
b: 0xf4d1c3d2861cc0bfaea456c03b0f548a32effc1c3e1593935a6b0n,
r: 0xf4d1c3d2861cc0bfaea456c03b0f548a33a2b0f5fedcc5ec02742n
}, {
a: "-c9bc2ac82920efc63fa48f63fae105ec432672b50269fad72ee8b44a1",
b: "8967d49deeff878f40fa1bf408400b8085820d47b",
r: "-c9bc2ac82920efc5b63cbac60be17e5d022c56c0fa29ef56a966a7026"
a: -0x56604879bdaaff7409cd59cfbafe73a74c284bfaeb991b6e11171bc08cf68bean,
b: 0xf4016a6e94c0f256af54fca00d6c909a620c6ea950c73cade3724174c12888n,
r: -0x556c470f4f163e81b31e04d31af10716b1c63f8c424854316333a97f18356362n
}, {
a: "815a18c9a2d8c6e5f3fffa958430851c4ea3",
b: "59d451c6efad276d3cc393907dda0eca463488958f397bb09",
r: "59d451c6efad2f82de502dbe0a486e0a45dde0d8978b409ac"
a: -0x7a238c856c50aee41d1a2a1446a77f1567n,
b: 0x58n,
r: -0x7a238c856c50aee41d1a2a1446a77f150fn
}, {
a: "8cfc360e8d215045cb5c289a50e5c7fa9da34c0b9d9be9597e6e476efdb121",
b: "-482747619f0edd06",
r: "8cfc360e8d215045cb5c289a50e5c7fa9da34c0b9d9be9115726e5cfeed41b"
a: 0xcdaf8c242e5da7265cc715871c3n,
b: -0x63604dd2b8df176c627ce3b018b2e74448746123d5578e66e9c0n,
r: -0x63604dd2b8df176c627ce3b00bd7ee82058e86b16f8b1d0e77fdn
}, {
a: "346337dbb9bbfc08cb815434c50315d32d",
b: "-ac569f54f5ea8852463c7542e876a9953",
r: "299dcde66a5d5383a71d8ce0967bab39da"
a: 0xfa254e9c8d182d2bd90d8ff2b25d4e9819900b62b9ef60f3744ddc55cd362den,
b: -0x1fef80ff5d53dd0adaa75e8f0d16429851de115822n,
r: 0xfa254e9c8d182d2bd90d8df3ba4d58c2dbbf5db84406702210245737ec20abcn
}, {
a: "8bb7c3e56",
b: "-c334d52ed6eb903256253e01fc0c5118fe9bc",
r: "-c334d52ed6eb903256253e01fc0bc5613ab66"
a: 0x3e85cn,
b: 0x687c558b2c1308c1a133d647ff7en,
r: 0x687c558b2c1308c1a133d64be7dan
}, {
a: "b1f444a7a95e6d1d293ff0182e3dd5e945234484a5b47516b5b42627ed54fa8cf1221e",
b: "-93b77e906778b7e0a85c07e08babe730edd93ed37adef19da9e76de2add3",
r: "b1f444a7a8cab59e98d877604d9579e16497989d74c69bd7e23947364fab131f0e744b"
a: 0x9011db3dd56dbf2ef06154cbd48a67f6038483cff59f49011e57n,
b: 0xc033be10adcb6a7a5a697a7ef95ac3680611ff7ef690231314d338an,
r: 0xc03cbf2e61a8c1564d58809446180c0e857237c7338f7d07a4e51e1n
}, {
a: "9a156524b9",
b: "-bce28d1561fc0153b836c6e0969d2674fcb960331cdb55df24e34e4b65136fcb59",
r: "-bce28d1561fc0153b836c6e0969d2674fcb960331cdb55df24e34e4acafe0aa6a0"
a: -0xefac02ab40df0f00a1b97a4n,
b: 0xc3b5e53656cd891e179ec3fb8a8d192f9bab5cfd76c014400n,
r: 0xc3b5e53656cd891e179ec3fb899d6d2cf06a7dee761e5ac5cn
}, {
a: "5eaf418fbccefb4f53abc413c02cee60eb3880b615c615c2005b3d11c8ee4aaf3b4ded8",
b: "-eb8aa4a72cf44f06208",
r: "5eaf418fbccefb4f53abc413c02cee60eb3880b615c615c2005a518724471dbaec47cd0"
a: -0x7f9d48b408a5bb3827bc0149ecd538a2b2a7d4e1e0a4e9c36ee05f8be3a5b3n,
b: 0xd83d8cb2fb784703498cf0d61ff097ca42635664058cb85ea39f5931c37a1n,
r: -0x72196fe8d8ee36c7f323323c8ad62f260e819f7ba04c1e3d84a669f8c76e12n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a + b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a + d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: +");
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "-193b47d0d9a8688b329e80de92195f311825",
b: "-2fabed9434bff933e23ea21af0f21a43",
r: "-193b6ffbfdbc7cbffbbfe2feb21bfff31a67"
a: 0x9252b94f220ded0c18706998886397699c5a25527575dn,
b: -0x286817ba2e8fd8n,
r: 0x9252b94f220ded0c1870699888639769185a045015008n
}, {
a: "35979ec99b7ff03f81817ebc9ddd50025d1ccf41565b502f0fc85ec54f630",
b: "be96016cc031653c9b1eceb1dd",
r: "8c9401648000603c810c44b010"
a: 0x15a28152354fe421bbe4649d4d22d536ac34f9ba962n,
b: 0x8n,
r: 0n
}, {
a: "-f594f8199c11594681a9c38fd985a03d8c79ce6c8d342809924c89b385af43116ec3a21",
b: "-53e7b9738caaecc58fde1b5a4aa9f782f28a04e2bb29d207ccd5d45",
r: "-f594f8199c115946d3effbffddafecfd8fffdf7ecfbdff8bf2ce8df3bfafd317eed7f65"
a: 0xd09791bf7ae6703fae8d654104f54fcd957bbf028540b8e7c0f859fdcc1b7abd617en,
b: 0x24b473d03n,
r: 0x24a052102n
}, {
a: "dd7245d3ca5b360296082e6ca91915179b257f36e45e6e44cf892db875fdcfb19522b3",
b: "-dcc83137df3bb234e1144390f6c5bc0772a07f2a4540865554d20ebd37be",
r: "dd7245d3ca0336028000044c891801140b013a02e00c4e00c5882d3820a90db1000002"
a: 0x2f73fbd05e9f7f70beba3dc7cd883732149a3d02a422f90f336n,
b: 0x4490583f8n,
r: 0x9008330n
}, {
a: "-28",
b: "eaec4017147fd9741ff3b98f1b6f71d8f3d6869c18b39c6237a6b2d4d2fc3c81e9",
r: "eaec4017147fd9741ff3b98f1b6f71d8f3d6869c18b39c6237a6b2d4d2fc3c81c8"
a: 0xd6ea27844b3d356774e73de10d393ab9cadb81848e3b4a34d1f7440d3n,
b: 0x1639eeee731f3ba09234b5e15ec92f8bfb5cea28a0e89c59ed1c45b5f04n,
r: 0x10ea26000b39200234a5214009290ab948ca008088184824104504000n
}, {
a: "-223909fc585f36f995d6f72dd9f169df1fad8",
b: "b13e919ce59c18c7c0517eecdb2519155cc",
r: "80360184a0880042000052240a040000508"
a: -0x131f5e2c196269fd140c8727a9a02170e0dddb6aec109a89bcn,
b: 0x401ec4eae8b756f2b222f6f565fb6acecce3c524e9b453n,
r: 0x12c488800242f230005655448b0a0204810124613440n
}, {
a: "-fcb4ac9fdc7ee85d03585f944a79b28efffb461e17df2d",
b: "13cd27fb49c92d53c567688ab6b9",
r: "38023b100492100042160882091"
a: -0x5bcba128bf7b949780a4bd02782a63ae79f646a33b8672f3f692ab98n,
b: -0xa81dd8ff624072fce3a00eb0bd5700e5666c3beb7d59701c42489n,
r: -0x5bcba1fdbfffb497afeebf02fb2bf7fe7ff666e3bfb7f7f7f7d6afa0n
}, {
a: "-1a16ca8c3725cec0c8a61ce81",
b: "-dbf3e",
r: "-1a16ca8c3725cec0c8a6dffbe"
a: 0xc997546528786548270061bcn,
b: 0x75023f046c04f9095f64d3b8c75ab21950an,
r: 0x499014640838044023000108n
}, {
a: "-834db45b67472062091e",
b: "5aff66623af6b6cd042a361d5a22aea03152b764a056c71",
r: "5aff66623af6b6cd042a361d5a228a2030408304a056460"
a: 0x5ad0abd6e43ef787248af2607fb29b9c3f7a1e7b106269ff3bn,
b: -0xd483c8630392db4b620e0f6n,
r: 0x5ad0abd6e43ef787248af2607fb29380394a06520040491f0an
}, {
a: "1a8c37cff2e02f5272bc61d60b8301e443c38172446f75d75e01c41f60",
b: "e15d12bee18edaca77ad15ff0a567e132bb1b046623858",
r: "215012bc61860a8201a401c30052440321911000401840"
a: -0x9ed448bdb4794e4c0485db9ebe6cad0b0n,
b: -0x549a70753c9afn,
r: -0x9ed448bdb4794e4c0485df9efe7dbd9b0n
}, {
a: "-f463",
b: "bb02038e2ff03fa",
r: "bb02038e2ff0398"
a: -0x3a3fe42647633612082372714484767efc9673ce964b76f9f53a63d5n,
b: 0x99615e5edd0506cbb5512fb56ee2dd1238bn,
r: 0x986116189800068881100b0000608c1000bn
}, {
a: "3178f92d2eeee1aebc33f085aa96c9046f1133ad6afbd666664ab79625639e001",
b: "124d8bd8ea20d8e510ba30d9",
r: "20d02406020586010382001"
a: -0xac1b8238c08f5n,
b: -0xb9439dfbbc70e12b3a1fc7ccbfebeacd9bb321d83d3an,
r: -0xb9439dfbbc70e12b3a1fc7ccbfebeacfdbbb23dc3dfen
}, {
a: "fc7aaaa7a52f3604e1e700f01ea6f266912f583bffa78aee08939401056cde",
b: "-50e3611d6ada075f432319f10c8192f1de56ead628972",
r: "fc7aaaa7a52f3604e0e100e008025202010d4820ef2782c00012900005648e"
a: 0x120580503n,
b: 0x90e13d34618496af407fabefabdd23892f488n,
r: 0x20100400n
}, {
a: "7dea10c67bdf023c00d94643e9f2d38295635b0b2b55a0e40818",
b: "8defe4741785c6c2d2ecaf7752a903ed",
r: "443e0701380844252082b5500a00008"
a: 0xaa51cn,
b: 0x2122a9c43b2531d5n,
r: 0x2114n
}, {
a: "6f837e0ec2d00abb60051299bfd36b58c803f6445f91bb8dded858c6c1c476142",
b: "-26746eda5ca5095ab8f315c88b201cfa2affbbb700fc3bba8626b5bfd0a",
r: "6f837e08829000a3400400010cc22350c80304440000088d02c04040c14040042"
a: 0xaf43eb353c1547dc6ad79768e9a6n,
b: 0x55c80f89d8fe82dbf69eca557dd0479b6a449db77e38b2241ec81aa7d4042766dd3e63n,
r: 0x28022014081007d4000706482822n
}, {
a: "ab69c286138358dea4308b60f12f212fcd1e0",
b: "-c8735b6ce5513cc661fdae7941055028a2ea768dc13b9c83a79b9bf84e62cdf",
r: "aa29c2041181501e84200840602401218d120"
a: 0xbd38b2d88212ceea6fbe3890769e46236n,
b: 0xeb22e568873e9bfdb5d2ddbc03n,
r: 0x88202468863a83890540c42002n
}, {
a: "6c9ec2e7cdb2c1fb630a8e16323138db939c2a21e3576b777d",
b: "-51cf93f77a711c00",
r: "6c9ec2e7cdb2c1fb630a8e16323138db938c202000050a6400"
a: 0x24cd8c9634eddf319c57b54dffb49ce4974528f03b2c732d052ad496n,
b: -0x4079cfn,
r: 0x24cd8c9634eddf319c57b54dffb49ce4974528f03b2c732d052a8410n
}, {
a: "edee34cd0c29ad27fed12e77a42aedbf8b53161716c90d516394b9038a2f125c95",
b: "-18a515e3705a582d82f14bd42075b3b",
r: "edee34cd0c29ad27fed12e77a42aedbf8b52140600c8085061049003022d100485"
a: -0x61f263476a1212fce55cf7d437f4364b73a1815a641n,
b: -0x19226cb79772cca166043a29d1f0fe1df5n,
r: -0x61f263476b9236fffd7fffde37f477ebffbf8ffbff5n
}, {
a: "466fee7dabecbaea71c19892f045d7d196a80c6f",
b: "-5c93c7afd552be",
r: "466fee7dabecbaea71c19892f001441010280c42"
a: -0x44309b08a65bc7dc1e53d598d82ccdaa852941d7c851d907a6acn,
b: 0xdd93dc17d38658ee30453d5f27en,
r: 0x5d1304178102408230402d05054n
}, {
a: "-657c587f67a70177797befb96f116c2843",
b: "-c3b8e2",
r: "-657c587f67a70177797befb96f11efb8e4"
a: 0x1e3eea4668e7a6c3bfa87d3f7a419bd18an,
b: -0x592d83940f884f9n,
r: 0x1e3eea4668e7a6c3bfa86d274201035102n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a & b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a & d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: &");
......
......@@ -284,9 +284,7 @@
assertEquals(4294967296n, BigInt.asUintN(2**32, 4294967296n));
assertEquals(4294967297n, BigInt.asUintN(2**32, 4294967297n));
}{
assertEquals(
BigInt.parseInt("0x7234567812345678"),
BigInt.asUintN(63, BigInt.parseInt("0xf234567812345678")));
assertEquals(0x7234567812345678n, BigInt.asUintN(63, 0xf234567812345678n));
}{
assertThrows(() => BigInt.asUintN(2n, 12n), TypeError);
assertThrows(() => BigInt.asUintN(-1, 0n), RangeError);
......
......@@ -197,6 +197,28 @@ const six = BigInt(6);
// Multi-digit BigInts.
// Test parseInt/toString round trip on a list of randomly generated
// string representations of numbers in various bases.
// Userland polyfill while we wait for BigInt.fromString (see:
// https://mathiasbynens.github.io/proposal-number-fromstring/ ).
// This intentionally only implements what the tests below need.
function ParseBigInt(str, radix) {
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
var result = 0n;
var base = BigInt(radix);
var index = 0;
var negative = false;
if (str[0] === "-") {
negative = true;
index++;
}
for (; index < str.length; index++) {
var digit = alphabet.indexOf(str[index]);
assertTrue(digit >= 0 && digit < radix);
result = result * base + BigInt(digit);
}
if (negative) result = -result;
return result;
}
var positive = [0, 0, // Skip base 0 and 1.
"1100110001100010110011110110010010001011100111100101111000111101100001000",
"1001200022210010220101120212021002011002201122200002211102120120021011020",
......@@ -273,28 +295,12 @@ const six = BigInt(6);
];
for (var base = 2; base <= 36; base++) {
var input = positive[base];
assertEquals(input, BigInt.parseInt(input, base).toString(base));
assertEquals(input, ParseBigInt(input, base).toString(base));
input = negative[base];
assertEquals(input, BigInt.parseInt(input, base).toString(base));
assertEquals(input, ParseBigInt(input, base).toString(base));
}
}
// .parseInt
{
assertEquals("hellobigint", BigInt.parseInt("hellobigint", 32).toString(32));
assertEquals("abc", BigInt.parseInt("101010111100", 2).toString(16));
// Detect "0x" prefix.
assertEquals("f00dcafe", BigInt.parseInt("0xf00dcafe").toString(16));
// Default base is 10, trailing junk is skipped.
assertEquals("abc", BigInt.parseInt("2748junk").toString(16));
// Objects are converted to string.
let obj = {toString: () => "0x12345"};
assertEquals("12345", BigInt.parseInt(obj).toString(16));
// Empty and invalid strings throw.
assertThrows("BigInt.parseInt('')", SyntaxError);
assertThrows("BigInt.parseInt('nope', 2)", SyntaxError);
}
// .valueOf
{
assertEquals(Object(zero).valueOf(), another_zero);
......
......@@ -429,8 +429,8 @@ const six = BigInt(6);
assertFalse(%Equal("-0x1", minus_one));
const unsafe = "9007199254740993"; // 2**53 + 1
assertTrue(%GreaterThan(BigInt.parseInt(unsafe), unsafe));
assertTrue(%LessThan(unsafe, BigInt.parseInt(unsafe)));
assertTrue(%GreaterThan(eval(unsafe + "n"), unsafe));
assertTrue(%LessThan(unsafe, eval(unsafe + "n")));
assertThrows(() => %LessThan(six, Symbol(6)), TypeError);
assertThrows(() => %LessThan(Symbol(6), six), TypeError);
......@@ -508,10 +508,10 @@ const six = BigInt(6);
assertFalse("-0x1" <= minus_one);
const unsafe = "9007199254740993"; // 2**53 + 1
assertFalse(BigInt.parseInt(unsafe) < unsafe);
assertFalse(BigInt.parseInt(unsafe) <= unsafe);
assertTrue(unsafe < BigInt.parseInt(unsafe));
assertTrue(unsafe <= BigInt.parseInt(unsafe));
assertFalse(eval(unsafe + "n") < unsafe);
assertFalse(eval(unsafe + "n") <= unsafe);
assertTrue(unsafe < eval(unsafe + "n"));
assertTrue(unsafe <= eval(unsafe + "n"));
assertThrows(() => six < Symbol(6), TypeError);
assertThrows(() => six <= Symbol(6), TypeError);
......
......@@ -7,74 +7,73 @@
// Flags: --harmony-bigint
var data = [{
a: "-609648ccf253976b12f6b6c8e20790c17ef6b89ea9f536267783607cf465b1ca",
r: "-609648ccf253976b12f6b6c8e20790c17ef6b89ea9f536267783607cf465b1cb"
a: 0x26ffcdbd233a53e7ca4612f2b02e1f2c1d885c3177e7n,
r: 0x26ffcdbd233a53e7ca4612f2b02e1f2c1d885c3177e6n
}, {
a: "-6e4c39cdd2c666e32cf2fd3c53a20eeb725e7578af97d42",
r: "-6e4c39cdd2c666e32cf2fd3c53a20eeb725e7578af97d43"
a: 0xf2a29a35193377a223ef0d6d98db95eeb24a4165f288fd2b4an,
r: 0xf2a29a35193377a223ef0d6d98db95eeb24a4165f288fd2b49n
}, {
a: "34c93e1c",
r: "34c93e1b"
a: 0x454d22e29e6104n,
r: 0x454d22e29e6103n
}, {
a: "-db3032",
r: "-db3033"
a: -0xb00874640d30e6fce6bf79508378ed17e44dacb48a4200bce536cec462b3c2n,
r: -0xb00874640d30e6fce6bf79508378ed17e44dacb48a4200bce536cec462b3c3n
}, {
a: "8e658ffacbefbdec5",
r: "8e658ffacbefbdec4"
a: 0x4c151a24d765249c2bab4a1915b24b80ae437417c5n,
r: 0x4c151a24d765249c2bab4a1915b24b80ae437417c4n
}, {
a: "-d321033ec94d6a75f",
r: "-d321033ec94d6a760"
a: -0xcbd476b1f9ca08ff820941n,
r: -0xcbd476b1f9ca08ff820942n
}, {
a: "-286017f718d6118b581ec4357e456ce6d12c01aed9a32ff0cc048d",
r: "-286017f718d6118b581ec4357e456ce6d12c01aed9a32ff0cc048e"
a: -0xe848e5830fa1035322b39c2cdd031109ca8n,
r: -0xe848e5830fa1035322b39c2cdd031109ca9n
}, {
a: "c0",
r: "bf"
a: -0x4d58c5e190f0ebac5bb36ca4d214069f69726c63a5n,
r: -0x4d58c5e190f0ebac5bb36ca4d214069f69726c63a6n
}, {
a: "9f9577e008a6f46f7709f71362176ebe23d19eb9e58a41de6f2631b18f2ca",
r: "9f9577e008a6f46f7709f71362176ebe23d19eb9e58a41de6f2631b18f2c9"
a: 0x9b396n,
r: 0x9b395n
}, {
a: "-9d4294590df0aa8ea46a5c2a3d186a6afcc00c6ebb072752",
r: "-9d4294590df0aa8ea46a5c2a3d186a6afcc00c6ebb072753"
a: 0x593921fe8b9d4906cn,
r: 0x593921fe8b9d4906bn
}, {
a: "-4bc2aed1641151db908c0eb21aa46d8b406803dc0f71d66671322d59babf10c2",
r: "-4bc2aed1641151db908c0eb21aa46d8b406803dc0f71d66671322d59babf10c3"
a: -0xe127928c7cecd6e9ca94d98e858f9c76a0fccac62203aac7710cef1f9e352n,
r: -0xe127928c7cecd6e9ca94d98e858f9c76a0fccac62203aac7710cef1f9e353n
}, {
a: "-1dfb3929632fbba39f60cabdc27",
r: "-1dfb3929632fbba39f60cabdc28"
a: 0xeb14cd952d06eb6fc613016f73b7339cbdd010n,
r: 0xeb14cd952d06eb6fc613016f73b7339cbdd00fn
}, {
a: "c0d409943c093aec43ba99a33ef2bb54574ecdc7cccf6547ab44eafb27",
r: "c0d409943c093aec43ba99a33ef2bb54574ecdc7cccf6547ab44eafb26"
a: -0xfdeab6a3dbd603137f680413fecc9e1c80n,
r: -0xfdeab6a3dbd603137f680413fecc9e1c81n
}, {
a: "3d148dcffe94f859c80b38c4",
r: "3d148dcffe94f859c80b38c3"
a: -0x7e9abbdfad170df2129dae8e15088a02b9ba99276a351a05n,
r: -0x7e9abbdfad170df2129dae8e15088a02b9ba99276a351a06n
}, {
a: "0",
r: "-1"
a: 0x7b98f57n,
r: 0x7b98f56n
}, {
a: "d659f6507e0ac2e653bdb7c3fb38c1514dd33619a9a0c87fcb69b22",
r: "d659f6507e0ac2e653bdb7c3fb38c1514dd33619a9a0c87fcb69b21"
a: -0x919751deb470faa60d7c5c995c8bed72f9542d710fbbf1341n,
r: -0x919751deb470faa60d7c5c995c8bed72f9542d710fbbf1342n
}, {
a: "14efe",
r: "14efd"
a: -0xc5541d89b118a88afdd187228440427c8a24f9d9bn,
r: -0xc5541d89b118a88afdd187228440427c8a24f9d9cn
}, {
a: "-f2df301948cd17ff391a6589a67551c00679687ba5",
r: "-f2df301948cd17ff391a6589a67551c00679687ba6"
a: -0xe6c88a170595fn,
r: -0xe6c88a1705960n
}, {
a: "-e",
r: "-f"
a: -0xa1ffbfa388c332804dc4dc973n,
r: -0xa1ffbfa388c332804dc4dc974n
}, {
a: "-a09cf77fea7af1767695c978af13fdb62f4f040b6fb803625fb124cc99139cddadd",
r: "-a09cf77fea7af1767695c978af13fdb62f4f040b6fb803625fb124cc99139cddade"
a: 0x67b768ce0c415127a77402861d1901dd7f60a8624ebea6ecafe03adc3cen,
r: 0x67b768ce0c415127a77402861d1901dd7f60a8624ebea6ecafe03adc3cdn
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var r = --a;
if (d.r !== r.toString(16)) {
print("Input: " + a.toString(16));
var r = --d.a;
if (d.r !== r) {
print("Input: " + d.a.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
error_count++;
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "c0bb18527ab19a800932cc14c553c69688372809dde38f095fdb99478a7eba",
b: "8137ebc482f361a3e43fb80fe2ba509caa3f0acc62be0d2",
r: "17dd3b8ecbdd71a4"
a: -0x1e0f357314bac34227333c0c2086430dae88cb538f161174888591n,
b: 0x390n,
r: -0x8700f00dd65d4009ab90c5d3a887e9c8ad110a72ca7e0f84a40n
}, {
a: "10c5163e874c786fcfcb48bbb0ccf8d6c66f480b76332194",
b: "4e462b2",
r: "36d8ca96869a7226d456bff9b5ed3effdcaaf6f83"
a: 0x9b7a0098fd2d495b4b2c76ff5888ae2a0359cfec6b029e6f3ee9b014802n,
b: 0xbn,
r: 0xe225d252e49ef6563ecc4fff0c69b782ed99e89db2ec895bfe6b2ea974n
}, {
a: "-677f8c8668fcc826129f2724a5b88a6225dd19959810b5254afbc0",
b: "-2bf8ff1c49636",
r: "25a8bd406d721554f45ad37cc691d58821ad163f3a"
a: 0x6821a6dad136b9f64096337b45d6d947cf0f0b55501e33e66fbc4ef9776n,
b: 0xan,
r: 0xa69c3e2ae8578ff06756b8c53c8af53fb1b1abbbb363863d7f93b18f25n
}, {
a: "e80276ba7d416f4f7e5f8917529eb204cc7ed08413261e73aa23f169eb46e7162",
b: "-c884f07a",
r: "-12834073e7cbc44804a99cb2778fb82b098645946d5e4f5e6c47c49267"
a: 0xf42f96f0c7f5a9c656a66122a9bcc57aa386bdb9a834e4174d45795ae408dae14e085cn,
b: -0x5e0d81a1107ef9a38b4f24b4n,
r: -0x298a4d479eac8c186fd61939024b420080b6ae6500c70c1n
}, {
a: "-f9a51f64ce995e0a1c7f8369a573dae2533bc3df801edbb79235d41502e1ce",
b: "-f33bf",
r: "106bf522569501704f9700d6bfcd203a606e63725e339e92ff931f568f"
a: 0xbaf7baed984dda3c20f23201f366257c601f7fbcaf51d8b738a68fd92b4n,
b: 0xd24a1eafcn,
r: 0xe39bd4d870d72880e6ad88ec17bcca6bd0eaacfbbd28ba7458n
}, {
a: "-6c9ae08dfa5b11c29ae30e53c108d915e0e87f1a8ca82f42d23a53b08895",
b: "-43fd79afe1ae6a4994ee7dfc2c89453d6b6",
r: "198ecd667e8cca17c2839b38fe"
a: -0xa658d0683d450bfec3de3fe4253f4348dd8e9a5b1002f6c24ff0en,
b: -0xeffb9a6fa690e0be59aba488b7a7c5a85a65a018242n,
r: 0xb1730d7206n
}, {
a: "-d20a2f7074ecbc776b64c2e04ff007e194b8cdd106b2be2e78d752f2d16e9",
b: "43eb8ae7d7f9be6d77e3be696ffef",
r: "-317ab1a09014950e1c53b9e3e8f44873c"
a: 0x5a65f7b2dace4550099f4009192caa513468ef4da7e2fd81n,
b: 0xf144f8bfad42d9beaf7b82a46561n,
r: 0x5feae36e8e4932adcb21n
}, {
a: "-999e0f75f2f652d403840cea3536b1a522433a331dace7c39d7990b993908fdd6",
b: "cea1de74020232c6c4bedca49d63f140c",
r: "-be51ac62c073e7d7cb9e43fc12436bfe"
a: -0x87271b0cbb63eba5e3d70f6af1aa6ec60c0a7884fb8d657b03en,
b: -0xb67f8c18099ce8fa0c0f4ce2852b5590f7a8037d326b0n,
r: 0xbd9602n
}, {
a: "1b49ac0c323436294f1471a3f00feb197b9b42549c3",
b: "5a7e30888a22fbbcecfe2a0b2e5eca30",
r: "4d321e8fe1c"
a: 0xd4bc42a434dba1427d387f0858aaf39c6281ffc0f10b8b0996cb3bfn,
b: -0x4198d1fec9b48e38d42f2e295abc39c2a6866527efn,
r: -0x33e39b6878d955n
}, {
a: "-689adf0d332ed26c63f8f361d5cb66056321b683ce87c60567df7305396f20d6ab8",
b: "82f3b92f5bb57811fdb66f519",
r: "-cc7e64b9ef239ac4c31b6ae3687aa181bda7657222"
a: 0x6a6f0c97d974dfd20337ca611dbdc96433964a206d54n,
b: 0x16c7c6f9e0e4e24d521e463fecb394e2936f3104590n,
r: 0x4an
}, {
a: "-6fecb457f9e05c15b7fe038494c25053938d4747a01577cf2dc939a21e",
b: "b7cb6ce62c1d7483d0b675109f5782a1ad19",
r: "-9be52d2e94716bb441dbcd"
a: -0xd09af7515272d81a64307afaed8854c8e2996d8e01d4864n,
b: 0x7521dfcbdf4cfbbf8d3859bf67618c91dc6915718303dbn,
r: -0x1cn
}, {
a: "f96f8276f314d37657ce7774bc539198ee84fcec8a53cbb3d36ad81040b715",
b: "-891c9a0dd99b02",
r: "-1d1b803e3484173c0d2e8add5042117eaa27c853c222f5fdd"
a: 0xf0da5f24832a2b651aac5dff62b22475212c26e123ff78c34560f35e9bcn,
b: -0xf9n,
r: -0xf79fbd51bf65f518c82563b974e4632b505ebe13adbfb6c297859a98cn
}, {
a: "-d2c9a9068d57f2ebc9ad432b48b4135f2a911519d4b791",
b: "-a34d124b5b4825d314683098d0",
r: "14a715b96671307438926"
a: 0x76f4f5b5de8a263514554d62273e51f40342d5df692ae17625ead5b5fen,
b: -0xa5e697c57fb65858604e0a060737e7d9d1en,
r: -0xb78fb2167de210959e57cd3n
}, {
a: "-59593d55f61c1c739601e15624fe2e61592fe6abf1ecb238c9f8e1a7bded9c1bd1c",
b: "f067a5a155fc894b0f7f0a939f1772c4d135a",
r: "-5f250867331e7eff64dafcd58e9922"
a: -0xa714d4d9d747fa5258f80f3887f4dda8a11423050046282n,
b: -0xaa3b218ab92e21920a707487fdbn,
r: 0xfb437487ba8580181ca3n
}, {
a: "2c0a3172494623013ba14d01433ad38167f365765b1c0ca610",
b: "ffe8",
r: "2c0e52ca0c37483000215020c64d6ac36a455bf6fa4382"
a: -0x165f3c659ac4157cb3af081b3fc42c0c788e2df501596c2b8n,
b: -0xfaa86d6eca3n,
r: 0x16d94bce4865cf842d17a399d8b4467f3f369fn
}, {
a: "-a9cde7cdfe56eb8bd6777543ae714fadac2d97a394d8e9e8",
b: "104b0d7135d3d2",
r: "-a6bfb9031e60b5bc4b20e814cabfd80bd27"
a: 0x268d93a21aab44c52f961b1c97c002f427eb8b11e0707e3879c3a348f8e2b1c40c122n,
b: 0x70ccda2e2bba53b124c877bb4edbdbd387742cfe59d9bn,
r: 0x577effaeb2338647e38edb43n
}, {
a: "6216ceed0d221476bfba7701f8297af56a4e66d003f8165b",
b: "bfcaaf8676ad6a",
r: "82ed6efc83669b0bc476bdd717dcfb6f10"
a: 0x3a13493c9e8d3d986a2a56c0aa811be408e1560f30ae155n,
b: -0x62a1a35fd7e184be45a1d0ba67888f0d982afb7a90an,
r: -0x96bcn
}, {
a: "-707752a899efbe8989d205293535a404a6afb39cf21ce1274",
b: "-3a24848be1024a6ea901f",
r: "1ef2f2a8c0ad85ff4e6e6afdd3966"
a: -0x2a3f3f90ea280bf64e7e460f004ea4fb2553637cb7c844f349f045ffdbn,
b: -0xf2af2581bddfd9bfc1158c86211c4f4b169c0b1n,
r: 0x2c90ab8577b8d0ee86en
}, {
a: "-e662fb8c46f979ff3b3f576fffd5c51cf70071ab61168b2eafee4708af",
b: "964c4dd019b9a543df0cd1830a90428ec84ec04f8165283",
r: "-18869d87ce54"
a: 0x8fd5f992d4d767c8a360ad32142fa9e9d87bc0036d1d6bb7aa7471dd7f38bn,
b: 0xe70n,
r: 0x9f6709805e05fd8b3c433e470387f06391b6948459e4c2bc072747e2a0n
}, {
a: "b4403dee3a192009a5aae85c74efdb52b66dee1be6befa66f708ca9bf6b7",
b: "-36db9f9f6e",
r: "-34928ce65c2b71a6b6ce351838d4263d91ff2bceecec7a91441"
a: 0x52c0e08ba0a22a00498058dfeeaab2b21909e81e30c48652699n,
b: 0x1d516c96827an,
r: 0x2d2967f58654a5d30934348b225bf2b6e2a3123dn
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a / b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a / d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: /");
......
......@@ -7,74 +7,73 @@
// Flags: --harmony-bigint
var data = [{
a: "-989c298c6fc3",
r: "-989c298c6fc2"
a: 0xb3df90n,
r: 0xb3df91n
}, {
a: "bff2c86c449a56",
r: "bff2c86c449a57"
a: 0xaacd53fc9545eb394304a3c69caba730230a6527730an,
r: 0xaacd53fc9545eb394304a3c69caba730230a6527730bn
}, {
a: "-6fb15264369b63e3b92d6f74458140d4b62a56ecbfca000492b6b8a0c56c651ebaecdd1",
r: "-6fb15264369b63e3b92d6f74458140d4b62a56ecbfca000492b6b8a0c56c651ebaecdd0"
a: 0x32efa4ba1c29098be7df8fa0f3c74a183612ecn,
r: 0x32efa4ba1c29098be7df8fa0f3c74a183612edn
}, {
a: "e161f6284b91fa2646dc0f162c575bb8a0d0f5bfee26748b7181413567",
r: "e161f6284b91fa2646dc0f162c575bb8a0d0f5bfee26748b7181413568"
a: -0xcabed06f63ad50406b96187208cf9ec6faf46413ce83e280c31ben,
r: -0xcabed06f63ad50406b96187208cf9ec6faf46413ce83e280c31bdn
}, {
a: "-4d073653cc812",
r: "-4d073653cc811"
a: -0x8a40ce58f753466f4008faa0814e76d9b594908df0e42cf6ad4a781e60ce2n,
r: -0x8a40ce58f753466f4008faa0814e76d9b594908df0e42cf6ad4a781e60ce1n
}, {
a: "-ce31549364717dea9d1bf30baed642f",
r: "-ce31549364717dea9d1bf30baed642e"
a: -0x848c8fc23bc93801n,
r: -0x848c8fc23bc93800n
}, {
a: "2ae123a62361f1de2cc5ca9cfd9658f47d",
r: "2ae123a62361f1de2cc5ca9cfd9658f47e"
a: -0x13a8316c5af3f3b06aab6642e717a7bdn,
r: -0x13a8316c5af3f3b06aab6642e717a7bcn
}, {
a: "-4820298153b7bbd86337ad72e0d1ac7448de99bc6ce4c43c2",
r: "-4820298153b7bbd86337ad72e0d1ac7448de99bc6ce4c43c1"
a: -0x5f5e517cf7efe577cd689c36d1beb3d9df4cfdc3fcb55ed9e9d8fan,
r: -0x5f5e517cf7efe577cd689c36d1beb3d9df4cfdc3fcb55ed9e9d8f9n
}, {
a: "2e",
r: "2f"
a: 0n,
r: 0x1n
}, {
a: "-8f3b598ac2ab8a78a2d3e1f7ab1124b05a830aa1261bf57d8de2a",
r: "-8f3b598ac2ab8a78a2d3e1f7ab1124b05a830aa1261bf57d8de29"
a: 0x107d5ec8048c4d715e213ec74f9f04006d3f2d90dd95d17c3e82f7a4ccn,
r: 0x107d5ec8048c4d715e213ec74f9f04006d3f2d90dd95d17c3e82f7a4cdn
}, {
a: "-5c070fdee0d3f4a9adc63",
r: "-5c070fdee0d3f4a9adc62"
a: 0xb8e09fc6037a75bbfn,
r: 0xb8e09fc6037a75bc0n
}, {
a: "-3700cd6a6d1e68de1",
r: "-3700cd6a6d1e68de0"
a: 0x515d1b999660074184n,
r: 0x515d1b999660074185n
}, {
a: "56c68c",
r: "56c68d"
a: 0xe12def67dc33628638612b8137d0fa425ea2dn,
r: 0xe12def67dc33628638612b8137d0fa425ea2en
}, {
a: "-1ab894376fcf0dab9c",
r: "-1ab894376fcf0dab9b"
a: 0x96a9n,
r: 0x96aan
}, {
a: "-937dcf37c57588e55260c3eea20318",
r: "-937dcf37c57588e55260c3eea20317"
a: -0x9df122a299a5e65b275028n,
r: -0x9df122a299a5e65b275027n
}, {
a: "-f8ee63b438580a8915baf84edcfd0688247905e593e153644a88761bab0",
r: "-f8ee63b438580a8915baf84edcfd0688247905e593e153644a88761baaf"
a: 0x20dd05bfb5ed6ebfb05da9a7488800b8895fbfe6d709eecb6071cda73e13n,
r: 0x20dd05bfb5ed6ebfb05da9a7488800b8895fbfe6d709eecb6071cda73e14n
}, {
a: "-c63d4353ddf575bf02",
r: "-c63d4353ddf575bf01"
a: 0xb38294d2e5523534c56dd6ef38ba744b29e3a3bb6f863f1aeaen,
r: 0xb38294d2e5523534c56dd6ef38ba744b29e3a3bb6f863f1aeafn
}, {
a: "-bef439cc990a8b1d69b80fa7b3c703ba2",
r: "-bef439cc990a8b1d69b80fa7b3c703ba1"
a: -0x6b58de4ba9b2699ea6777dc1adc0b2486n,
r: -0x6b58de4ba9b2699ea6777dc1adc0b2485n
}, {
a: "6007edbd20b0ba90d86cf80e871e898c8907bb37",
r: "6007edbd20b0ba90d86cf80e871e898c8907bb38"
a: 0xf40028a48894df5d81131046477a22e55cbead5n,
r: 0xf40028a48894df5d81131046477a22e55cbead6n
}, {
a: "-692b36b5e874a448415678ac2b4d0a61c75bdc1674ae14d753cad7d46846",
r: "-692b36b5e874a448415678ac2b4d0a61c75bdc1674ae14d753cad7d46845"
a: -0x44cbe6c7f5e7e879d3cb2eaffc4af0a43affc094218031a1f123746549dd7b8cdcbdn,
r: -0x44cbe6c7f5e7e879d3cb2eaffc4af0a43affc094218031a1f123746549dd7b8cdcbcn
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var r = ++a;
if (d.r !== r.toString(16)) {
print("Input: " + a.toString(16));
var r = ++d.a;
if (d.r !== r) {
print("Input: " + d.a.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
error_count++;
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "-67c2a5ba4221c048b64ecca6dd979391c44296b8b87ce97584ebab03be18",
b: "-bebdbd9b278d05704416fd87d09aece9b69f98843",
r: "-8794ba5d9204eb8adfb5e44c11a65fe5af057e6a4"
a: 0xaed3c714bb42a73d708bcf1dc9a9deebadc913ef42bac6a6178a60n,
b: -0xf3d6bd1c059b79n,
r: 0x2a4f893c8ece3n
}, {
a: "-843cfbe576106b8e7c0aabec2cde402e7f76a711dbbf6ae79d6d932e22cf",
b: "553d800ffcf69f80026",
r: "-272250d344908c21525"
a: -0x8a6d8cb8e32aba50e08fd50aecbda6821e1863bf9a2n,
b: 0xe19ab8530bce542ec6b4c848fc383a2b688f07976dd523dabn,
r: -0x8a6d8cb8e32aba50e08fd50aecbda6821e1863bf9a2n
}, {
a: "-b5fc9e8e21fbad798bcd3571ab169dd5e2059d1a9aa4d1bf44fe18da725b",
b: "-da5d287414fbb2b4b",
r: "-2610eb2277e01a758"
a: 0x7cd19a308b217ddd9dcda69ebe37767f09a483cb87060314aeade6f6c619d27c3n,
b: 0xae30b5c754e0an,
r: 0x619154797565dn
}, {
a: "a9c92d42b53a6fbf0824f5b7bd9ed1cab1f9419d7ec2b50f192abfa6d620d53",
b: "9de30592e1fe27d26afe06bbb4781c77ef58418",
r: "9a67af5868a619a48883aed4c0d0a876e2ce143"
a: -0xaa90d777e849974d7ebebd2ed76dce635e36713e9e0c97cen,
b: 0xcc2bc7239bf83ecafc74b25750981df258n,
r: -0xa32d47bc250c5a41d147a862099778685en
}, {
a: "ffa271b138163a779c89f17aa720490854520120b1307ef",
b: "ab27ef49f3a00085981a5bc1c13530aec35e29c",
r: "4c49a63b98d2dd7a33a843f98ba82b54909e337"
a: 0x7386178fe1159c4ca3c4e5caa6eda4413926047efd22007931c22ab54bn,
b: 0xc05100caa704bca144n,
r: 0x55ead7f83d4a795753n
}, {
a: "d43f739464bcc8643dfaa807cbbe1157189e33368dd19b800db3682bb0dcb73",
b: "bf66b1dc93054920039f9b3eba688d9",
r: "bb2f3000959d66b3962d755d141c3ac"
a: -0xa48867cf46692351a59bc89c0ddc9a6d2cd9f72578c0bab72d8389n,
b: 0x77c2eec6cc0bef33dd4756b223c35a0f2b528f8648a7n,
r: -0x184a6eed8fcd32399c59605c7255b5614b388be24b44n
}, {
a: "111ae5ba62ec37fd157ef531195363c5c8ace4427ff58811746af94ab8",
b: "58112d0d88f3c8722d1e28942e8949c433c4619b451",
r: "283276aa2b6316ca2146b1e6bcc8aa8de4b5446847a"
a: 0xac7681c26f78191107c9cde47f984fc7ffb7bffd0a055fc14n,
b: -0xe2d91d1a0e1edc3f806a24c36f7ca0a8a9b44b66c9n,
r: 0xdf0b3460335089fca0b1da676b3d1e9caf15afd3den
}, {
a: "-4609a1c7d563bbdb49fd01e05031395e6e06b78407e440",
b: "-75ee71f85344163bae2ba0e438",
r: "-68b517938971cb261babea1cf8"
a: -0x3035011f4adba0c032ddc2fc884ff7663b45cb3baebec0fn,
b: 0xcc27f9a21470911a61aae50ae118ebcf85ea4dn,
r: -0xc5ea1db5af95ccdce2844b13b82659be1ac2adn
}, {
a: "292cd2c5eb3e80942066c5af8bfdaf8d1d091f61f3005d226318",
b: "5",
r: "3"
a: -0x2dbe79c42b1e8db7aea4ca9cfaf1350528b096e23f69ea322cn,
b: -0x82f7e4f2ee432485n,
r: -0x824bddbaf61ce383n
}, {
a: "-a9f8c03f06200b54959a2ced325090be25417f0bf1274d",
b: "13eb3a0c772fc98e537883a3ef72e1ee37b249ee17c0510",
r: "-a9f8c03f06200b54959a2ced325090be25417f0bf1274d"
a: 0xc5c7fbeb60fdb9f8e8347ebf9fe303e3223394b2db93ce2n,
b: 0xcd988b4cb278a39fd3ae58c16616855f01fab0fb0n,
r: 0xc3b5157e680c8ca66df1bd640c6ad1601bd612b02n
}, {
a: "c4ddadae9abee150068fe6536c6b2fe229070410da61a09abe1a7270b",
b: "5f4d55e3345e37fe8887f3ca5e",
r: "42eea65dd545aacdcd250b505b"
a: 0x73dd1e27450edb450fe4bd70494a8ad85a8ad9691bc40bf500a1n,
b: 0xc8fb467f71be8a6b965d21857ecfdn,
r: 0x646e6d9fa1e2eb2933b2e5a837d37n
}, {
a: "-7a73d61e639dacedd207dfe1edc630b1dfda9078489a7f0cf79dcdfcbf3992efc13861f",
b: "-c0f2b9045bb3865d89cc0c9920c3ccfae382c250",
r: "-6bdc3d5943d7a35e4ecbc5c8deb335ca2c3bbc0f"
a: -0xecb217583ec4240399bfa34560b45f1fd08efd0ebb56b2dn,
b: 0xeba34abn,
r: -0xc2d347bn
}, {
a: "-a9ac4a2e055f22c8ba7956ffca5457a71412eb74d3a180555bb25ce5096e23d6c619",
b: "-f3c",
r: "-a5d"
a: 0x29c8a9854802b9317b90683eb82609b3aa695598807fea0482a56567n,
b: -0xabe5e55b228f8n,
r: 0x52303615b525fn
}, {
a: "-b16cfd7fbbf820afc77be1590fd9802ecd12059238b98bb96d9d215af4808",
b: "2c288a9de167",
r: "-2b3901c1b8d1"
a: 0x7b532ee90b3945dbed20180632f46c90d0edb558e39456103f50e5a74ff1dn,
b: 0x17n,
r: 0x6n
}, {
a: "-df12dd3e56dc3c3dd769ad964f8356a5860177f1b4a3b95acc75",
b: "4ec6f5474b18",
r: "-17bf0980582d"
a: -0x6f1dbf8dedea796a2423fad9688d71340963da3a4f005f13e9cd4aa03b96c864552cn,
b: -0x408a4f36ec4a1b74642fb0a4559en,
r: -0x33c06c53e6e47ca87f36447f1b0n
}, {
a: "1d197bf4aa09a02760cb004e9edf25e6591ae14d92b6cbf1349ea1c040d66",
b: "-23ebacc5f380e5649a1234c3ed050472569cbcd056",
r: "20e5e588b4861be3ec7b4005a6a50566e60a3a4364"
a: -0xe77508ff49bc76c78678676ca1edc82eb167f3b07d3208d89d26582ef74d60n,
b: -0xf005fb1a8b29035c72980abe4a0715c90n,
r: -0x159e8c7616079663b4e12765a05cc6d40n
}, {
a: "fab19b7e774bf33bb42a7af90d8dc75cbc927e3225003610c05b117c25c90944d",
b: "-3b433469282a54d46cac",
r: "10eda9e98b721b4a2505"
a: 0x626749ef019017f53b2c686f26594e6d3c5f247cf0ed7024cca277n,
b: 0x5bd931ea8c6939115ad69f6ce3c6bbc300320n,
r: 0x3a4b041c36d0a45ef932745eab473943b1a97n
}, {
a: "5b19514660782d3a2429d7791659868abb9d8fc96077247",
b: "-59188be60",
r: "2340c3607"
a: -0x960dde134b881d3366d659c7d8c3eb6346f50c08c6f78en,
b: -0xc9e7fa60f6ce1997012f5a6164138447fa248754985905dc6n,
r: -0x960dde134b881d3366d659c7d8c3eb6346f50c08c6f78en
}, {
a: "-2884ed1401b5e976be7dc1faf7bffb632c808649fa75ab458cc66ef4e75",
b: "bf",
r: "-40"
a: 0x702dc0033e09e9e58ec3fc96f861587ad13cea1ed7b7eb301n,
b: 0x71f0c97687b4f3318be2fe54b90273n,
r: 0x4e1859254ac1d42f7c812decef00a3n
}, {
a: "-4c9cdf26be1797e54480ab20797e35d04941c11ff78b040c00099422cec",
b: "ee20f34835529f4a73",
r: "-e24db40426d47f968b"
a: 0x39376649769a0abb26133deee934330ef21a2f90ea89476569630021af6023235n,
b: -0x4aaaec4085f65ccc9d547beb122160afcbb3n,
r: 0x3027d5ebb37c5aa438f11dfcafa3b003b91bn
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a % b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a % d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: %");
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "-be5e349bf5ad48e7a5d",
b: "a47a19a48667620a82973579739e08c64651b3ede2c578ff975e",
r: "-7a4f25aa8725368922062fc91a110352a660657ffb3a489126ded10ccd29d929120c926"
a: 0x2bf1f236c2df29f7c99be052dfe1b69ae158d777fea487af889f6259f472c0n,
b: -0xae0090dfn,
r: -0x1dde8b7f987479d7b308e2b8a122703d417f921fd4ab04fcac81439ace4f445c7bf540n
}, {
a: "912d5d85aec5ec6caf90514f0ec005f711caac82960c0ee911ef30f145107ae236783e6",
b: "0",
r: "0"
a: -0x71cd629b6682b5b1c50f9436ded88468bcn,
b: -0xb24ce1d11726048158fb42c02e9361973193n,
r: 0x4f42fbebca0bc1746d114996d9c9cceb4065c347da31dc0efa88db41f1f724aef81ff4n
}, {
a: "-87c17f6930bdef7e7c7ae7dab8be3baa2e7d67",
b: "285af6503c42d077a0d59558deb170bad",
r: "-1566788db7747e33ddb6540190617b57856e5f3924447f9f400f34a9aa75aa7d20f2b9b"
a: 0xef7c15fb2256338bd0650fa51c28551108ccb9828850f1b415d0c8f1a47fc0e2f86n,
b: 0xc17n,
r: 0xb4f552dbf2c20292f5475d025276b9c70f16316c91e0a9a2833bf2d616bc484f808d0an
}, {
a: "-3d0fd72abc5fb82d5cf45679812b71",
b: "-3c537c742e17c5fac136e33f5e7edf256ef52b6df",
r: "e63a0402966391e13e600371183f223379b66912ee706a2b369668b3e33e9a15992d6f"
a: 0xcc8a5a56c623d9f9be2103bc237976f26n,
b: 0x13a02fec7cfd49c5a081c06bbbaac5c70dc3an,
r: 0xfae417740ef1963ad78aa4252159d986593845690f4f5fe759f6d913d79810473d69cn
}, {
a: "dfd77cf4b0d071df2487c9b77959ee027380a159b0",
b: "-56300fb05cba28d5150892ff66e77",
r: "-4b5c6a1976d3a318cb9f93e154dc362da4e740fa31d82baefead60c355bfea99eaa50d0"
a: -0x519n,
b: 0x7de5551df3ec2619a89139153663a79f8bdb47047423c8070d7cfddc26d43af8ee9n,
r: -0x281c60ee5b06ece38cc4c4bfd2242017c4ff0cd05b40a66abf3c22a1741efe09ef81c1n
}, {
a: "-bea52261387bb2aaf8c61b5ee7bbf85b3bbbedfe60773ed9873cbceba078d3fecbb",
b: "-2ad7",
r: "1fe73453d2eabb331a676ede8eb9759c8c6bffe09c76947578e08b0152379841d867f0d"
a: 0x6fb9ba0d0n,
b: -0x86b45ffb80fbf2b61abc14b28855780f83e187fd6ae26e09d28d6f05260e1n,
r: -0x3ac9efdd4e930fcbf654819060b858f182f7768db6bc72deb8d734d2ea10fa02b656d0n
}, {
a: "5b5a3a047d8f7e1519d6d92d3241c0f32c4d789",
b: "-4bd3e8c09b0ba71bc25416877a4c7135",
r: "-1b0f0d6ba20fe60049c4a172e8b1fb9824c1e85e21f1ebe08556b7074d8d4f4ac90185d"
a: -0xde2e7a0883a63d69d2120108f92943e4a34b63e8468c12b38a0519a6498n,
b: -0xb1857781fefn,
r: 0x9a11f83db6da31f78a2415d3891f79a0f6aafc69553fb458a2bc3ae2e2f65cb09251e8n
}, {
a: "1b2c8263d4bac8cc825657f81fca6196799aff00fa960d5c04",
b: "-6b140fca30c8037b18d88",
r: "-b5dbba6fba700592408e2ebbba2d4c6557d61d1201e24314f690e77c0b59c68d8b1620"
a: -0x2c90284ebdb5237ba7c9562f596ef9a21254a3n,
b: -0xb55feab8b45cc1bcdcfc5585c9114de0n,
r: 0x1f929eda8d33ec2ded8d76382a4cb731f805d28e827521a27154b6618a6f87ed5215a0n
}, {
a: "dd74f1f92ab5b9e0b447b7fe9076f7",
b: "-9dbb0acb24e6336fe4f37f8e942d1d5c22dfe4f34",
r: "-88728628dd4ed79514e720448e4f9ad422ba6ca62cd61bf779cfb3cb12afb5bbe20632c"
a: 0x11ffe68d26ca29eac43b64n,
b: -0xe3311b278fec1fb3f8f59acfd9147c773197fc54c66b25bdn,
r: -0xff95d530fd53e61744d86d09f9ab5401b1efb2133af5c47ffeca31aca22a4da414cd4n
}, {
a: "-e97d2712832aa20a",
b: "-cb98c0fa9b4b35fc7a4ebed6d3d106bb758c244eb756c75587300ad",
r: "b9b1904d502a19d20cc7bd8e05670f667db817bb9104ef8acc747f3df6541eede4d80c2"
a: 0xbda74de44eeb2995a4185325014863n,
b: 0xf99164c7248a0372d72d82cbf65fdb345c84bca6n,
r: 0xb8e3712f119fefa47168950100b33aa1ec4e61a970d0eec2d2dd4b925cc4dfd709a432n
}, {
a: "828ca2d8981f347f4bec14ba",
b: "-8ce5b6b1c329477a0a728ed81331af1f03e3eaa1ccb2cb3",
r: "-47da0e06c179e58b3e5d8abc4a2b274ede3a7d73c0b5fcb3690f0b544ed6c0b7120760e"
a: 0x47fc0bb6d761e12a1f7cf2a14f4cc777486b22516ca339641fn,
b: -0xd2fa2494ae242494f307n,
r: -0x3b531808ad9095f9f904dba47ef4a0aef54f736cc2836accb7b1b70f07ee862e8729d9n
}, {
a: "aade382f2483a571e12cb1796bd124e21c6014261cef5d733a1b35fb01db7232c5b",
b: "-d34a",
r: "-8d068c8b18b90f6aaf82ed3260f68bdb06bf64613cdda736fc33395b7d16688edb9d34e"
a: 0x91d09f35203fcf69974d347ab718912cn,
b: 0xfc2d9a00611e4e1767b67db898b951e5d2bbb9n,
r: 0x8fa3561bff2cc00a780a71e5b16d6092296514d401c88fc54e04a91062775cb4e40cccn
}, {
a: "34188043594e64ac10b37923ad29b4b536a4098ce76c9133155820b7843de95af",
b: "106952",
r: "356f6c0aa4a1a0d27dd2e8867420eddcd9fb5614450d6bb85cba0071e03e4563a0b90e"
a: 0x5a5b1ede360dafcac08c92f4b809e401502df5ab8569303a2n,
b: -0xb64d963b1ac4eb46ddd65n,
r: -0x40582a6083cd0feb5b33ac138feaf9250b5084e561807e56a8415c810a1bf9861d48ean
}, {
a: "96b2a125fc041fe36aebe7dfd02a4f56b90",
b: "-a9f9c57a732002abf0764868f297442f61d1",
r: "-640ef4605c38f6643d60526833e7a3b7b71a72b7042434abc0ca600e7f79b3aa98e6090"
a: 0xf68275dc25d6af7dde130n,
b: 0xfe330b766e44f479e342e3315812e977d4d5e39bffe42111dn,
r: 0xf4c697f78dc7c9b3207b50cf2cf3035aa065e96c37c0be3345f71f34096f057e76b270n
}, {
a: "-ae8327a77a340d2c90c93bb0ebe02d7a77d7c2a4e8d21a21d0",
b: "268a49068f2769f949d95",
r: "-1a45bc5e1b636b28bf716dfeaf0599cd932270796233adf7d58b8d72d06ac580c323e10"
a: 0x77009ed053f71n,
b: -0x647aecfc2af4079a586fbba99070c3f51d5465d9a4fd8c12cdab10854n,
r: -0x2eb5627edb1072a65a1db2d243d0bf2eeb5c3ff6ad61ec1063e9ee40b783bd06d55914n
}, {
a: "-a0adcb953540a4f25fc97a40a2c9285bfba7e70e4ffc",
b: "fff2302a069e8f69d00e529a81b",
r: "-a0a5204f09eeb3ecd9fe2c6de34d0e0ed70c6d1589d95fd83de33d921a3152dfe5bcf94"
a: 0xccfa15bb6125b01bece5a919ab5e9128e784d63e50b5990ba8047a7effn,
b: 0x1a366ac48cdan,
r: 0x14fcf8728aa3dc5ef26b077dfc012d592c3a0cdfc3331942f921f037eea5af9eff9926n
}, {
a: "-83771467194c5b612539be7228f366a8",
b: "9412ce8f98510486287bc15c35883fff04d126e",
r: "-4c0a803e9a079742969e01dbb7990566b2f5ac9658653c967b5d295f6a996ba1655ec30"
a: 0x4fc54a59f2n,
b: -0x93bbcbd684987407c4ec4a3cbdc7c4821c33ca20ca8449b0055905e9a8ffn,
r: -0x2e08ce533fdc7bb8a3a2280cfb116c85837b74606ed25f8daad623baa4ac7de758680en
}, {
a: "12c3327d3d7ed4b3180cc301f98d351804451be431137fa48aa67627db867a2cd",
b: "-ee0af6",
r: "-11724697fa94a9caafbee6e7b778ecae17ed7ebba5575296b1fc4995a12fe5c9a8872fe"
a: -0xcf21626f318089a85738f7e9cdcf0a477f4d880ce58679n,
b: -0xc7ca8704a49fdb8f9567c68cn,
r: 0xa1a6d11a77d8e1b723bfa0242407a454274145c31bb6ede29bb0e3883b08951b36202cn
}, {
a: "-5",
b: "-a00c8e774e3d4a6fc2fa384382720700e49e3e4b882bb5c4c0dbe4cdcd92126731128b",
r: "3203ec8548732742ecee319518c3a230477173779a8da8cd7c44b780503da5c03f55cb7"
a: 0x20c3cb19e51d4e2ac2c89f26e052bef8n,
b: -0xab2a148297108425ebd2fd17d897f647e0792fn,
r: -0x15e82b69a0eaed04cd140c6aed3b1f5bc0fc5de7ceddcb2d77615767b19dd82c744788n
}, {
a: "a0a4dc9610ada50dfa633ad910a02aa20c85",
b: "-4d7aa1dc1cc1d1767b4e25a839e7c177652",
r: "-309e8a7c10fbc6b50f6ad012099765a35395b9d51112d50e0a8f3ac076942a9e5a0509a"
a: -0xcc4f48f45d8165569348fb995370n,
b: 0x140cc111df0a06e32335478ded744eb3a737a53409n,
r: -0x10005f808c07a1d91faac090aad06804b491919a9d2ed58f6caa52448ad97bd486aef0n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a * b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a * d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: *");
......
......@@ -7,74 +7,73 @@
// Flags: --harmony-bigint
var data = [{
a: "58ad59aa3aa9d04d4c12493966e204ef0500d5f92ecb31",
r: "-58ad59aa3aa9d04d4c12493966e204ef0500d5f92ecb31"
a: 0xcn,
r: -0xcn
}, {
a: "6dbd19e4b781a8f113ae95738dda4b70ba027755052126c198d20ade97869ff",
r: "-6dbd19e4b781a8f113ae95738dda4b70ba027755052126c198d20ade97869ff"
a: -0x5a3d0f6cdb7987a2d262838c05359f786a484d052529n,
r: 0x5a3d0f6cdb7987a2d262838c05359f786a484d052529n
}, {
a: "d02befb1c96364a984664f85",
r: "-d02befb1c96364a984664f85"
a: -0x98d8c6cbfd67b6b652b7a4670478f6706e06a3n,
r: 0x98d8c6cbfd67b6b652b7a4670478f6706e06a3n
}, {
a: "86",
r: "-86"
a: -0xe66ac692ff012bd0f4ca38804628f71ff411aede09c59597n,
r: 0xe66ac692ff012bd0f4ca38804628f71ff411aede09c59597n
}, {
a: "0",
r: "0"
a: -0x97e1e0c13c0c0c420aca92268ea802047c30570335de0000dn,
r: 0x97e1e0c13c0c0c420aca92268ea802047c30570335de0000dn
}, {
a: "-f8da",
r: "f8da"
a: 0x6b2eddc3b212913abed4f5c84e3eee64d6463224dff8n,
r: -0x6b2eddc3b212913abed4f5c84e3eee64d6463224dff8n
}, {
a: "2b0f358b54a82fbaddc5a6e61a5d",
r: "-2b0f358b54a82fbaddc5a6e61a5d"
a: -0xfcd42a712dd928deb51ab2d151fa6bee0f4dd2fa6n,
r: 0xfcd42a712dd928deb51ab2d151fa6bee0f4dd2fa6n
}, {
a: "-3d32065b9bbb36ee521ff82da",
r: "3d32065b9bbb36ee521ff82da"
a: -0x75ba8e0e92a05ff552f2dc3afb39a4dn,
r: 0x75ba8e0e92a05ff552f2dc3afb39a4dn
}, {
a: "ca3da934e8081c457933c90",
r: "-ca3da934e8081c457933c90"
a: 0x4570376e541836fab5190e08an,
r: -0x4570376e541836fab5190e08an
}, {
a: "-e4d2bbdf90affad1d2a",
r: "e4d2bbdf90affad1d2a"
a: 0x15aca33cfb06n,
r: -0x15aca33cfb06n
}, {
a: "-290845e8f55d467e3",
r: "290845e8f55d467e3"
a: 0x7ec0027910c44b791bf193c6f25487a9435n,
r: -0x7ec0027910c44b791bf193c6f25487a9435n
}, {
a: "-771c77d2dd2227c30cf44f1bf3230",
r: "771c77d2dd2227c30cf44f1bf3230"
a: -0x31f0d92f358618e6b29a2899bd988533838d33839fb37n,
r: 0x31f0d92f358618e6b29a2899bd988533838d33839fb37n
}, {
a: "-77aa11",
r: "77aa11"
a: 0xb4f84118d797244c982f1n,
r: -0xb4f84118d797244c982f1n
}, {
a: "d220c8af9c97516bf5ec295585f711e020480d08ac11689726a285930",
r: "-d220c8af9c97516bf5ec295585f711e020480d08ac11689726a285930"
a: 0x626n,
r: -0x626n
}, {
a: "53841e699f994e1a43f7f848f34d418792191de15b78e1a852c430b2f8af6e7",
r: "-53841e699f994e1a43f7f848f34d418792191de15b78e1a852c430b2f8af6e7"
a: 0x9f35c8968457d07608699df5894c0542f35b73b0b5ce8423aan,
r: -0x9f35c8968457d07608699df5894c0542f35b73b0b5ce8423aan
}, {
a: "7c30187b8901bd748adc4bc243",
r: "-7c30187b8901bd748adc4bc243"
a: -0xb5be1f7937895adc457f051d1f4bc74d556b432dn,
r: 0xb5be1f7937895adc457f051d1f4bc74d556b432dn
}, {
a: "-e07ac5649eb741a023b0f9928d5982032f6766a479c7fbf26",
r: "e07ac5649eb741a023b0f9928d5982032f6766a479c7fbf26"
a: 0xcacb413b3cab5a5f5086511728d1afbaa82ca41e69805daf47503e2n,
r: -0xcacb413b3cab5a5f5086511728d1afbaa82ca41e69805daf47503e2n
}, {
a: "5ab3237bb32234bcaf8",
r: "-5ab3237bb32234bcaf8"
a: -0x77ef7cbb15cee20a519a1n,
r: 0x77ef7cbb15cee20a519a1n
}, {
a: "7df7",
r: "-7df7"
a: -0x71ac9bfe7f5f70038c7fn,
r: 0x71ac9bfe7f5f70038c7fn
}, {
a: "-518b7b",
r: "518b7b"
a: -0x500a02b8fd66ee1067022c02c7241acdc42b947bfb933aa95a8d6n,
r: 0x500a02b8fd66ee1067022c02c7241acdc42b947bfb933aa95a8d6n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var r = -a;
if (d.r !== r.toString(16)) {
print("Input: " + a.toString(16));
var r = -d.a;
if (d.r !== r) {
print("Input: " + d.a.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
error_count++;
......
......@@ -7,74 +7,73 @@
// Flags: --harmony-bigint
var data = [{
a: "3d02c87edc77722299f6559ecca038911f864a4e78c20af80f4a6d9",
r: "-3d02c87edc77722299f6559ecca038911f864a4e78c20af80f4a6da"
a: 0x9f0305cd75e4n,
r: -0x9f0305cd75e5n
}, {
a: "ac01894aeaf77255ede209897561ec1e3c7e916b9",
r: "-ac01894aeaf77255ede209897561ec1e3c7e916ba"
a: -0xe8e9c8312f553c9n,
r: 0xe8e9c8312f553c8n
}, {
a: "-7aaab657ab197f26eb6b98fe4c2c79b199a8156129ca04",
r: "7aaab657ab197f26eb6b98fe4c2c79b199a8156129ca03"
a: -0x1a29f0783a66534da3c024ad1cc854073f886888fen,
r: 0x1a29f0783a66534da3c024ad1cc854073f886888fdn
}, {
a: "9718579cc52befdaff1ec035b5ed03cec5c1d1678c28712cf0c9bec2c807897b74f0",
r: "-9718579cc52befdaff1ec035b5ed03cec5c1d1678c28712cf0c9bec2c807897b74f1"
a: -0xfc2cc19496c1ced95be832ca5246d41c526b9fa28b88bcd39813aa336n,
r: 0xfc2cc19496c1ced95be832ca5246d41c526b9fa28b88bcd39813aa335n
}, {
a: "e614366bc4e67509843254c52e13da5380b00a35aa1d233e70821f7d649ad1957db",
r: "-e614366bc4e67509843254c52e13da5380b00a35aa1d233e70821f7d649ad1957dc"
a: 0x13ebn,
r: -0x13ecn
}, {
a: "fb815f78e6952b500226c",
r: "-fb815f78e6952b500226d"
a: 0x4c12d642b2a132f0c927ec7504b530fb45d5e249163ffdc59feb3de31881n,
r: -0x4c12d642b2a132f0c927ec7504b530fb45d5e249163ffdc59feb3de31882n
}, {
a: "94404df802649cff2ea6c0996f55ec60c14f00ab29b287092389951f6227c4ec7",
r: "-94404df802649cff2ea6c0996f55ec60c14f00ab29b287092389951f6227c4ec8"
a: 0x49637a624cb8782002e3e0874ad76215e188cee948c7ce7b0f66e1d0n,
r: -0x49637a624cb8782002e3e0874ad76215e188cee948c7ce7b0f66e1d1n
}, {
a: "-74b42cd7bccd",
r: "74b42cd7bccc"
a: -0x81cbae84e6753b885ada46c0bf72368c083fed622fn,
r: 0x81cbae84e6753b885ada46c0bf72368c083fed622en
}, {
a: "da",
r: "-db"
a: -0xcdf793acfdd08b6n,
r: 0xcdf793acfdd08b5n
}, {
a: "3a9ade198",
r: "-3a9ade199"
a: 0x88n,
r: -0x89n
}, {
a: "56e766d24fd18c2241f244dedc426c0b1ae59e7ed4f06def0a75e0a5c8651e2ce87928",
r: "-56e766d24fd18c2241f244dedc426c0b1ae59e7ed4f06def0a75e0a5c8651e2ce87929"
a: -0x1fn,
r: 0x1en
}, {
a: "cc430c91347b22ecb1a6f1a2ceea168ffa4a9b80065bd1ec5d",
r: "-cc430c91347b22ecb1a6f1a2ceea168ffa4a9b80065bd1ec5e"
a: 0x5c3278e76266b9e93d63eb4f2aa53716220aa1n,
r: -0x5c3278e76266b9e93d63eb4f2aa53716220aa2n
}, {
a: "32e4b7f82d8c037d0f562296e21b1e58a",
r: "-32e4b7f82d8c037d0f562296e21b1e58b"
a: -0x9f4fe05n,
r: 0x9f4fe04n
}, {
a: "-526d3f1a904561f0cde1f0a2a4",
r: "526d3f1a904561f0cde1f0a2a3"
a: 0xdn,
r: -0xen
}, {
a: "3de5a9635a40539831c9665577e5eedbf680755e2065a0caa346759e17225",
r: "-3de5a9635a40539831c9665577e5eedbf680755e2065a0caa346759e17226"
a: -0x74a9d63d02bd1393b311211e35c8b2d11e2367ffffb812683365f02d98n,
r: 0x74a9d63d02bd1393b311211e35c8b2d11e2367ffffb812683365f02d97n
}, {
a: "-d912828b8d6419900",
r: "d912828b8d64198ff"
a: 0x8a2831ae3e1b6b21a7b3d7ee921a0c0edf29b272d654f647169a5a6141d3aaf41439n,
r: -0x8a2831ae3e1b6b21a7b3d7ee921a0c0edf29b272d654f647169a5a6141d3aaf4143an
}, {
a: "-17968ddf93",
r: "17968ddf92"
a: 0xa2ef28270a7e668e190bc303537f5a8ba3f0d59bcn,
r: -0xa2ef28270a7e668e190bc303537f5a8ba3f0d59bdn
}, {
a: "-c2bfd766e34923d549bbaedb4d9b7bb35a61908e6144462a",
r: "c2bfd766e34923d549bbaedb4d9b7bb35a61908e61444629"
a: -0x4f8bd11ee4ef38682a0c94en,
r: 0x4f8bd11ee4ef38682a0c94dn
}, {
a: "af426ec83aaafc84a94930e51a2899696a3d",
r: "-af426ec83aaafc84a94930e51a2899696a3e"
a: 0x5436d0721d1282755068add3b5ab5424cb455fad50811a9afff0be5n,
r: -0x5436d0721d1282755068add3b5ab5424cb455fad50811a9afff0be6n
}, {
a: "-283de5b9379a45f065d3b8662ac38faa6492bc0eea6b7e3b51591a5cc27669e",
r: "283de5b9379a45f065d3b8662ac38faa6492bc0eea6b7e3b51591a5cc27669d"
a: 0x5db6907c92529f517d24a6ff7303de42cb9059ae2adc0c22n,
r: -0x5db6907c92529f517d24a6ff7303de42cb9059ae2adc0c23n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var r = ~a;
if (d.r !== r.toString(16)) {
print("Input: " + a.toString(16));
var r = ~d.a;
if (d.r !== r) {
print("Input: " + d.a.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
error_count++;
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "a66",
b: "d0671cd6e4ebd7baf6e48b2529348cfa89fc9513ba30ef3f99aee07f267df163cf8",
r: "d0671cd6e4ebd7baf6e48b2529348cfa89fc9513ba30ef3f99aee07f267df163efe"
a: 0x77a87n,
b: 0xde08e7433fb9584911b8cb4bc7eed802299b4489fc635974d063847da4e8b461df5dn,
r: 0xde08e7433fb9584911b8cb4bc7eed802299b4489fc635974d063847da4e8b467ffdfn
}, {
a: "a9950e5fc429f0f93d5fa8f306f4e5da88a8c9f9",
b: "d1fc1ac3db7ff5547462800923e616727120f74f0a6cb7bf1886dd4f4ac",
r: "d1fc1ac3db7ff554746a9959e7fe56ff7fb3f7ff8f7cffff5daedfcfdfd"
a: -0x1d3ff6f353f2d035ed7b4b8e5e4ae1c8d162n,
b: -0xcf829b11c2f996f388b22cd03aeb75ec434f3be8fde6466n,
r: -0x192f308302c00024a55a4004520a81c84062n
}, {
a: "5e277a64b6515ad69ed8935ae8dcdb6dc66f98fcbb462b10bea0db15ad6010d",
b: "7df3",
r: "5e277a64b6515ad69ed8935ae8dcdb6dc66f98fcbb462b10bea0db15ad67dff"
a: 0x6dbbc93af9a9c222187dn,
b: -0xfaa906348dc49859c34bc7c6n,
r: -0xfaa9020404c400500149c781n
}, {
a: "3b8368196588e684403965902763d66aa",
b: "-edf58c5ab418f49cf9fdb7f3b1c416a03c1dfbe90ba7ea6373c",
r: "-edf58c5ab418f49cf9c43493a0801600381dc2880b808821112"
a: 0xf8n,
b: 0x4388532n,
r: 0x43885fan
}, {
a: "-5587f5e86137f8ea4d7259acdd0b77a26ea069385501c9985df6a5fcd3c",
b: "9878871628ea5cb66",
r: "-5587f5e86137f8ea4d7259acdd0b77a26ea069385501811849d605a041a"
a: -0x3ee35e1823b91414618f05995e11594920539921e9440n,
b: -0x58c5811ee19db01b7d9824c49682af55956119cfbc9868287ef138da08ee3n,
r: -0x3c80040002800414010101891c1048082051180008423n
}, {
a: "-dc65679b1ea7c86c10890e6d6be3bd069b4c7",
b: "83ea9",
r: "-dc65679b1ea7c86c10890e6d6be3bd0618047"
a: -0xa2a70c5da9a7e98f242e82d518n,
b: 0n,
r: -0xa2a70c5da9a7e98f242e82d518n
}, {
a: "-755f422bfb614b7ed2c8e05cd1e0e0a",
b: "-d3185fac5454a495d7b149e67df4436339e060d924d",
r: "-24154221496049744240204040c0209"
a: 0x7868475f450ff2b15a03eccb4d26ce8711383f615cn,
b: 0x1c62774e1db239cb461c4190b54de4d872f9484cf82ed1258cc14580cf29f608n,
r: 0x1c62774e1db239cb461c41f8fd4fffdd7ffbf95efbeedb6daecfc791ff3ff75cn
}, {
a: "-1dfdf84b41ddd069053",
b: "f9b2bc80b580311773e9a5d57e8f24ace46bd2a0fce24404db684efa8692638b5d604e6",
r: "-1105784900548009011"
a: 0x865d033028551a71f6f9f8d7b36cf9819n,
b: -0x68e30391d9831a4ea3e65b2e433f55ba398n,
r: -0x68610290c9830a4482000206000c1102387n
}, {
a: "18d1b78380aa9016029417c2ebe77a",
b: "-b63b35e6711dcbf00dc02cd936",
r: "-3835446109c9600800041806"
a: -0x817a0dacbafbaf40ef819fc62a8efc4b4960n,
b: -0x5af313e32a5386e29cb5d2b34d54f04da389f33d52444f177671e41n,
r: -0x12a04840a008a008f019504008074430841n
}, {
a: "-9981f",
b: "-5d876576146a2d5dc8d52d26ea3304287af0922685f8e1a46875e80f24a470",
r: "-800f"
a: -0xef8c9475210c0a31aa12c34db6e7737609c75b78a54cn,
b: -0xba91b4ec3a5390db84febaeaddb8209155413e2e02fb0n,
r: -0xa9080441210808300a02820d9282011400034260250cn
}, {
a: "-20f8052991bc5a8f2631c9e4b34aa9073a69913185a539d719",
b: "a59fdaa025b42",
r: "-20f8052991bc5a8f2631c9e4b34aa9073a6991200005398419"
a: -0xf4e707078d14001959f4n,
b: 0n,
r: -0xf4e707078d14001959f4n
}, {
a: "-d02620570",
b: "-3b14d75fb9d9b95d13f884a82c9f16",
r: "-400200506"
a: 0x601f0n,
b: 0x246fbfn,
r: 0x266fffn
}, {
a: "-8",
b: "-4",
r: "-4"
a: -0x9ccd3d1b6d4bcde8643ad641d395980bn,
b: -0x379e57728185fd098383a23c7f56dn,
r: -0x13901650808484018100003859009n
}, {
a: "e0e8ab319d1f051560e1155ae5789dd4d9b638e07e5a57c3432e6cb9239d",
b: "85c9cd1f09436dc45ac783f31a21a1ff4e11ceca00cc164",
r: "e0e8ab319d1f0d5dfcf1f5def7fcddfcf9bf39e27e5ff7e35feeecbde3fd"
a: 0xcc4b3ba719bd1b37f254f36a72ee375ad22abn,
b: -0xb0c220750f2dad9de91ffb8a7bbf8ffefen,
r: -0x4000640e0c8098a0095880188a02dc55n
}, {
a: "8131173cb5597e2ae560cae6d0907f004792b1b1c7",
b: "-2ac290724a7c86",
r: "-c290604a4c01"
a: 0xa230c33b718cd563f9c1577f4f8da160851902341ba1a6e6bdcbec413d98a18n,
b: 0xc2f4e2db2df59ccc34690479ebe64df967n,
r: 0xa230c33b718cd563f9c1577f4f8dad6fcf3db2ff5bede7e6bdcffeff7ddfb7fn
}, {
a: "bdb24fd4d78b01d77e41d95f2c3eedeb2bf919",
b: "-97f6ccbd94d64ada501e0f288568",
r: "-14f60881940600d2401204000467"
a: -0x5fbac9a8f47n,
b: 0xf1bfe6f97e8f516685372b06ea89659c3df4ab3f6779e5c0b41e1b570fn,
r: -0x54ba0808841n
}, {
a: "-d5ad86f9a4808394f6e7dcd2a67bd3e6a9",
b: "1a80309934942e4e55fbf2ba4d1d2f8cc4697338097e2c1b7ce013da8a79965974286",
r: "-408c066804000010f6c25450261a40a429"
a: -0x7fd2d4a4c60ba795e2fcn,
b: 0x33dcea557cc5156dacb9ad7b252598172f92d8cf7d38e69f0a0n,
r: -0xd02d02000082194025cn
}, {
a: "c7a0086120a1613a28456",
b: "b8",
r: "c7a0086120a1613a284fe"
a: -0x3833089d7cf4e0181247572037a90cc2506342a2191137345e3a0e10n,
b: 0xededf5c7e54cd86afc6d838205c8a78cac7a0e410792a21cf3e4e38dd8ca2dd80n,
r: -0x283208103824c01802450720300908c2004142200111072052180210n
}, {
a: "c8480c",
b: "0",
r: "c8480c"
a: -0x188818a47abbfe64357ccd1a33fb5cb875f86n,
b: -0x14faf1811ee737d048c025f7a1fe156f7e90d23a699d040609e631836500df2e30cdn,
r: -0x108808202299d040201c411832500cb061085n
}, {
a: "ec8913fc89aa7a47672bc0f5269e8629cabf2dba88836cb3a9",
b: "-52594e7",
r: "-4010447"
a: 0xf60c0260022920bdbd1c837778657936956c15b4cb1n,
b: 0xa10df3b397c24n,
r: 0xf60c0260022920bdbd1c8377786579b79dffb7b7cb5n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a | b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a | d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: |");
......
......@@ -7,100 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "-4efa0d1f8a127",
b: "-66",
r: "-13be8347e2849c0000000000000000000000000"
a: 0x211a34fn,
b: 0xa6n,
r: 0n
}, {
a: "-100000001",
b: "20",
r: "-2"
a: 0xa0d0aff5d2783ad192f37423n,
b: 0x7n,
r: 0x141a15feba4f075a325e6e8n
}, {
a: "853cd87b0bd5c046aecbf4b3d",
b: "-96",
r: "214f361ec2f57011abb2fd2cf40000000000000000000000000000000000000"
a: -0x68ba010a12ed551fc17c67f63331eea3n,
b: 0xae5n,
r: -0x1n
}, {
a: "-4bc82dba903fedec0a079f7ae4fa6bd6befa",
b: "0",
r: "-4bc82dba903fedec0a079f7ae4fa6bd6befa"
a: 0xb64dc8009n,
b: 0xf1n,
r: 0n
}, {
a: "43969b4db0d921d9f0ca68f74e4e4b9073732a7955a5b4571",
b: "-91",
r: "872d369b61b243b3e194d1ee9c9c9720e6e654f2ab4b68ae2000000000000000000000000000000000000"
a: -0x364cdec628e438712e4f8cb7an,
b: 0x48cn,
r: -0x1n
}, {
a: "495f57",
b: "-a5",
r: "92beae00000000000000000000000000000000000000000"
a: -0xb417099aba80a783f52790b779b38c2e6fbdf5f490d7b02a59e81032een,
b: 0x6a3n,
r: -0x1n
}, {
a: "-22109b99d3025aaef5c3fbd27420a72",
b: "45d",
r: "-1"
a: 0x9d2b41n,
b: 0n,
r: 0x9d2b41n
}, {
a: "b3f6b156f4afcf259efd3cd1",
b: "c7",
r: "0"
a: -0x4a070c83b02ba86434228a50cbaf50ddf38n,
b: -0x63n,
r: -0x25038641d815d4321a11452865d7a86ef9c0000000000000000000000000n
}, {
a: "137aeeadc8d1395042e80393cc1b6a1c7b6e526ab1b6fc2f2859fd70e0c29df2802",
b: "f49",
r: "0"
a: 0x3e76514036ccb958c98f60n,
b: -0x76n,
r: 0xf9d94500db32e563263d8000000000000000000000000000000n
}, {
a: "70f51026476e43bd7e911d37a4553701",
b: "33",
r: "e1ea204c8edc877afd2"
a: -0x51fe20d47ba564bc09337d5c8d284deb5006549bad2629230198f34n,
b: -0xfn,
r: -0x28ff106a3dd2b25e0499beae469426f5a8032a4dd693149180cc79a0000n
}, {
a: "-3f935a89481c85d666498cf64fdc2a57028f7b295621dc665c0442229563",
b: "-2",
r: "-fe4d6a2520721759992633d93f70a95c0a3deca5588771997011088a558c"
a: 0x49adce1d09dadc5a0635f24d066d3a29e37b9be6059b88d0239d6ca6d92267a372n,
b: -0x6n,
r: 0x126b73874276b716818d7c93419b4e8a78dee6f98166e23408e75b29b64899e8dc80n
}, {
a: "-c3",
b: "-87",
r: "-618000000000000000000000000000000000"
a: 0xca19971406fb07cn,
b: -0x17n,
r: 0x650ccb8a037d83e000000n
}, {
a: "aae225520f630c0dfbb815f121836612d75a1f65a301461cd05ad0a741496",
b: "-4",
r: "aae225520f630c0dfbb815f121836612d75a1f65a301461cd05ad0a7414960"
a: 0xd8de8f631313b1f98f77d265ee48014f82eb20n,
b: 0xen,
r: 0x3637a3d8c4c4ec7e63ddf4997b920053e0bn
}, {
a: "a5348f9af939041cc6ed386c060619a42f30c4aa8",
b: "95",
r: "529a"
a: -0x550d3470c8ad9b8f22ed01a4b1d3f648n,
b: -0x4dn,
r: -0xaa1a68e1915b371e45da034963a7ec900000000000000000000n
}, {
a: "-4c27fc7e3892a6a5b517",
b: "-6c",
r: "-4c27fc7e3892a6a5b517000000000000000000000000000"
a: -0xa7eadcd4a1b8037081952f0a9199n,
b: -0xcfn,
r: -0x53f56e6a50dc01b840ca978548cc8000000000000000000000000000000000000000000000000000n
}, {
a: "98efd35f2239f7efde9aef42ad0acd835e68ad868a2cd8fac260f1c7496e3fd2ada76",
b: "0",
r: "98efd35f2239f7efde9aef42ad0acd835e68ad868a2cd8fac260f1c7496e3fd2ada76"
a: -0x65b3933c9e1eb5f953f6cc55cn,
b: 0xa6cn,
r: -0x1n
}, {
a: "-92f0264c863bdf66d4c83e8bf812123d759b4",
b: "-96",
r: "-24bc0993218ef7d9b5320fa2fe04848f5d66d00000000000000000000000000000000000000"
a: -0x92cea858475460661a2831a28434bde95e5132e1dcaeb161ec89bd9555f41n,
b: -0xbn,
r: -0x4967542c23aa30330d1418d1421a5ef4af289970ee5758b0f644decaaafa0800n
}, {
a: "ec6341ff2b0e9cf8721e2eb4ec9c9",
b: "74",
r: "0"
a: -0x1d838ade17fe571916a26314b6a8b42e9b6e2b74238de734d6f5575df7n,
b: -0x7n,
r: -0xec1c56f0bff2b8c8b51318a5b545a174db715ba11c6f39a6b7aabaefb80n
}, {
a: "-32de8dced947fa55cd0b91332a81f70",
b: "-5b",
r: "-196f46e76ca3fd2ae685c8999540fb800000000000000000000000"
a: 0xdd5bf8581e32875d44e26ef10c45bdff68d209015933586dc37211n,
b: -0xa9n,
r: 0x1bab7f0b03c650eba89c4dde2188b7bfed1a41202b266b0db86e422000000000000000000000000000000000000000000n
}, {
a: "-3ef43bf8610f6533526ba734e85eafa04cd50a3",
b: "-25",
r: "-7de877f0c21eca66a4d74e69d0bd5f4099aa146000000000"
}, {
a: "-9979591a367a32ae0039c54fd0f3d9e0ccc80be52b7e517fc94d9f3587dc54d933bb",
b: "0",
r: "-9979591a367a32ae0039c54fd0f3d9e0ccc80be52b7e517fc94d9f3587dc54d933bb"
a: -0xa92d3014dcn,
b: -0x4cn,
r: -0xa92d3014dc0000000000000000000n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a >> b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a >> d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: >>");
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "-9a6d035348727045f6abf7d59056d30e9ce885e87f5f8438347bfcda0a1f9b",
b: "-2",
r: "-269b40d4d21c9c117daafdf56415b4c3a73a217a1fd7e10e0d1eff368287e7"
a: -0xe813d76adc0a177778c0c232c595e8572b783210f4a7009d7c1787n,
b: 0x9en,
r: -0x3a04f5dab70285ddde30308cb1657a15cade0c843d29c0275f05e1c000000000000000000000000000000000000000n
}, {
a: "615f9676062ea7a1b89396ce4208712f279475490829",
b: "ff",
r: "30afcb3b031753d0dc49cb672104389793ca3aa484148000000000000000000000000000000000000000000000000000000000000000"
a: -0xded00dff14554cn,
b: 0xd9n,
r: -0x1bda01bfe28aa98000000000000000000000000000000000000000000000000000000n
}, {
a: "-9b6131d8b806543fce32b4c2ca2038ffa956929848a61b5eb7f",
b: "-e7",
r: "-1"
a: -0x50c2df089209be37998c8f6e30c4c95a61e77a9241n,
b: 0x46n,
r: -0x1430b7c224826f8de66323db8c3132569879dea490400000000000000000n
}, {
a: "-331d9e",
b: "0",
r: "-331d9e"
a: 0x668086293eab52b52b879f00375d0f513f1ff9a93df788e38527en,
b: -0x3n,
r: 0xcd010c527d56a56a570f3e006eba1ea27e3ff3527bef11c70a4fn
}, {
a: "cb79696d3a6f5d5d034e9d2",
b: "-d33",
r: "0"
a: 0n,
b: -0x1n,
r: 0n
}, {
a: "ca99",
b: "10",
r: "ca990000"
a: 0x26bd28fb3e06bb0ddan,
b: -0xcn,
r: 0x26bd28fb3e06bb0n
}, {
a: "6f97833d5",
b: "0",
r: "6f97833d5"
a: -0xa04dca5c74bdb1dbf2f0n,
b: -0x3fn,
r: -0x1409cn
}, {
a: "67d36e7948d18af35f0823c0d58ba47ca0846cdfaa7a7407f09d44747275532681b343",
b: "f",
r: "33e9b73ca468c579af8411e06ac5d23e5042366fd53d3a03f84ea23a393aa99340d9a18000"
a: -0xd6b46ec3ead311e2e45ca4ae8aa9cf5acf4c2d6c61de06e9e36n,
b: -0xan,
r: -0x35ad1bb0fab4c478b917292ba2aa73d6b3d30b5b187781ba8n
}, {
a: "f4896",
b: "-7",
r: "1e91"
a: -0x1f1922aen,
b: -0xbfn,
r: -0x1n
}, {
a: "996ce2a9e0f7d65e0523204c9c469bfd14821efe571ac59cdc01",
b: "1d",
r: "132d9c553c1efacbc0a464099388d37fa29043dfcae358b39b8020000000"
a: 0x47n,
b: -0x2n,
r: 0x11n
}, {
a: "-f8f",
b: "f1",
r: "-1f1e000000000000000000000000000000000000000000000000000000000000"
a: -0xf64n,
b: 0x7en,
r: -0x3d900000000000000000000000000000000n
}, {
a: "-b685bbcd953ba9c5973ae523dc81d7b35e0cf2b9b51026d4ba1ac21bd5c3c18f9c13",
b: "0",
r: "-b685bbcd953ba9c5973ae523dc81d7b35e0cf2b9b51026d4ba1ac21bd5c3c18f9c13"
a: -0x78dn,
b: -0x85en,
r: -0x1n
}, {
a: "e2295b362b7048fb163d1272178ed441517fc689e5ec5ea40f29",
b: "-30",
r: "e2295b362b7048fb163d1272178ed441517fc689"
a: -0xa03bc462b00e4113a2472eb73dn,
b: 0n,
r: -0xa03bc462b00e4113a2472eb73dn
}, {
a: "-b322e816b014448f44e60b418582390d2a3ad95",
b: "0",
r: "-b322e816b014448f44e60b418582390d2a3ad95"
a: 0x3816aa0f01396f4abe0ee7164e211ce60ce590b615d86f6e6363c0bdd513d8a0n,
b: 0x4n,
r: 0x3816aa0f01396f4abe0ee7164e211ce60ce590b615d86f6e6363c0bdd513d8a00n
}, {
a: "4c135e4d7",
b: "0",
r: "4c135e4d7"
a: -0xaf8711d29fdecd42a255f14aafe13b9404cced5df0af8b86080af7682cben,
b: 0x1n,
r: -0x15f0e23a53fbd9a8544abe2955fc277280999dabbe15f170c1015eed0597cn
}, {
a: "-d5b694",
b: "f1",
r: "-1ab6d28000000000000000000000000000000000000000000000000000000000000"
a: 0x218b11dfn,
b: 0n,
r: 0x218b11dfn
}, {
a: "-7994be7",
b: "-d",
r: "-3ccb"
a: 0x263fcb4707e6fd4a21b1f646ddd90a5e78d781c272621dcaf861d6250d7be675e067n,
b: -0x868n,
r: 0n
}, {
a: "a6443add555ea15af90092e8",
b: "42",
r: "29910eb75557a856be4024ba00000000000000000"
a: 0x8312b459b585847682en,
b: 0x4en,
r: 0x20c4ad166d61611da0b80000000000000000000n
}, {
a: "9385ed",
b: "e5",
r: "1270bda000000000000000000000000000000000000000000000000000000000"
a: 0xb45d42e0595a4b104b0b9a177ffdc52b401b61659fe163e720621aef8c8e6191ba7an,
b: 0x3n,
r: 0x5a2ea1702cad25882585cd0bbffee295a00db0b2cff0b1f390310d77c64730c8dd3d0n
}, {
a: "-531",
b: "7d",
r: "-a620000000000000000000000000000000"
a: -0x42d2c4n,
b: 0xfdn,
r: -0x85a588000000000000000000000000000000000000000000000000000000000000000n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a << b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a << d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: <<");
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "e5e5071838eb1314",
b: "3b7f55dce703a25ea14fdea6186156f775dec5d29f6edb3a014",
r: "-3b7f55dce703a25ea14fdea6186156f775d067822deb4c88d00"
a: 0xc4fd438551d58edn,
b: 0x91b42ee55a50d974an,
r: -0x90ef31a1d4ff03e5dn
}, {
a: "-f",
b: "22d6805c7201a8ad4b9e6c2a7e8b5ab3bac",
r: "-22d6805c7201a8ad4b9e6c2a7e8b5ab3bbb"
a: -0x86b766ec276e390087458ce093b07b2574732d5f3f5125n,
b: 0x4b1fe0dd23316de1b38b343d4112fbd7e8c8d081de5dbabda7357fd9e868466693den,
r: -0x4b1fe0dd23316de1b38b34c3f879e7ff5701d10923ea9b5157b0a54e5b95a5a5e503n
}, {
a: "-22",
b: "-11a0adfaedd5adb92297af1c3794ef5461dd8bc146db3",
r: "11a0adfaedd5adb92297af1c3794ef5461dd8bc146d91"
a: 0x63e1eac0d5470c8f802ec390b6415c43ed16d28d6dn,
b: -0xbe26927b2f6ae85b5d3062d869d22da005805d23142a236955127b6ca688c07fn,
r: 0xbe26927b2f6ae85b5d30633c4bbcee754c8ceca342edb41f966ebf59bd5b4decn
}, {
a: "-d20c39d0",
b: "-46faa9d3eabcbd8b6d07adc2d0ff289d2",
r: "46faa9d3eabcbd8b6d07adc2c3de65002"
a: -0x873cf988993d97e5180fn,
b: -0xd791aa365f881a7f05f21f73ef390c0b37408dd0a908801682464178426an,
r: 0xd791aa365f881a7f05f21f73ef390c0b37408dd021cb868de908a9932a5bn
}, {
a: "-e5b56109a11",
b: "211e1dcdf52f020ab0f16e18cc4e46027d05bfa3155b88973e630ae9a75bf2c7fbad269",
r: "-211e1dcdf52f020ab0f16e18cc4e46027d05bfa3155b88973e630ae9a75cd87d5cb6c7a"
a: -0xcb273d5b123eff101c62f016ae2896223b93b9114e40d1fn,
b: 0x2169f8c954623f8381bf12fd0927e1a645f5b3c6c00e58105c297ba40446208dn,
r: -0x2169f8c954623f838e7186d2ba4bd19747bbe2c82af0e1727fe2b735192a2dacn
}, {
a: "-b682aa",
b: "-5fa59a6a80d39c0c885c030e9c8c84ec7",
r: "5fa59a6a80d39c0c885c030e9c811cc1d"
a: -0xe965bf745fffcf22n,
b: 0x7c3b92f8a030cbfca7cc5f2fd454459c79a3ac2201524468fbn,
r: -0x7c3b92f8a030cbfca7cc5f2fd454459c7a8d11e175b244381dn
}, {
a: "-c1325b8ab9fea966f093bbfbc2e611b0e5bf0b13ce047c7133056d4eea",
b: "f97d5c4014c5cc87923c344a",
r: "-c1325b8ab9fea966f093bbfbc2e611b0e6b888700e19423dba97a98334"
a: 0n,
b: 0x6975a8ededffd265f472e660e18n,
r: -0x6975a8ededffd265f472e660e18n
}, {
a: "-1872900ab729911a3c021db53672eda07a9ad623",
b: "152d13997090c43551edfc89d4c7ea5e9ffee4a114085858892e67e82edea6384aaaba7",
r: "-152d13997090c43551edfc89d4c7ea602727e54c86a169fc4950433b960d803ff4581ca"
a: -0x236bda1a3a9635190f26c3739b7342f33a27cd2568n,
b: 0x1a7e6n,
r: -0x236bda1a3a9635190f26c3739b7342f33a27cecd4en
}, {
a: "5440388fc10de9",
b: "-4b",
r: "5440388fc10e34"
a: 0xb682b9c88f0b6d7b5e9a4f77dd0d7885d62cd162783b2e55b30b954e10caf3n,
b: 0x2c6574161d9aff7bbebd95e561fbd5d70d893e8c9772bcc697cddn,
r: 0xb682b9c88c451639fcc09f8021219f27800d140507629a6ce9946981a74e16n
}, {
a: "-198dc54795a81722f70acc9cc20505492172c7819ba168e57d",
b: "-48f3b40bf850f771d44e423eb266846801d9e4e920c",
r: "-198dc543066cd66371fb557f7d20e15dfb0a81017e031a5371"
a: 0xdd6aa5240c4n,
b: 0xb9c7bef20c0cc0f814cce3c40d43e4c26en,
r: -0xb9c7bef20c0cc0f814cce3b636999281aan
}, {
a: "c78082429b3163ce243c778",
b: "-97afe29",
r: "c78082429b3163cebbec5a1"
a: 0x35cd14329d5f81dbn,
b: 0x25997b1f3500f9b27f2ceean,
r: -0x25997b1bd82fb688a934d0fn
}, {
a: "-50df",
b: "-d5352ec9c1b0e62b97ea1363ce8b72",
r: "d5352ec9c1b0e62b97ea1363ce3a93"
a: -0x55ec15d7ed316df3fc7bcfcce0f0a6d7034113bad6d74bae88d4aab03032n,
b: 0x9d09b8869aab44d6690fad48c8dffd0e18cc21fb26c2a80ac08fd4f42296f46d37cddn,
r: -0x9d09b886a00a0633e7e2c42808a7ba0ae6db2c6896f6b9466dfd49af0b243f183ad0fn
}, {
a: "-5c9777f93d64636ff8bcda39125625aa58a49e9a4f29ece2b7afa5d",
b: "894bb7aa90b8687e6290c3218a4258dac9400d556caafe02cf8c312c053f2fc73",
r: "-894bb7aa9114fff65bce2784fa3b15b50252637b1703a2a169db5b18e7f6df6d0"
a: 0n,
b: -0xfbf3b308a6066d497e1cn,
r: 0xfbf3b308a6066d497e1cn
}, {
a: "-e15c51f0627e460c477",
b: "-dfd13bac43ebe2f8e77f5b31314843",
r: "dfd13bac43ddcd33c879334cd083cc"
a: 0x6acfc1e4b681be9582cd28453387ed2c29f5eb4cd6d78aaac67n,
b: -0x4f5997n,
r: 0x6acfc1e4b681be9582cd28453387ed2c29f5eb4cd6d78fa05fen
}, {
a: "0",
b: "adbd3e4b06b92771ae25eb52fca5fc86391303ebf7962",
r: "-adbd3e4b06b92771ae25eb52fca5fc86391303ebf7962"
a: -0xc93eb5cae0c90eb77e702ccb44eea6180829d0b360872n,
b: 0xdn,
r: -0xc93eb5cae0c90eb77e702ccb44eea6180829d0b36087fn
}, {
a: "960a8aa627a1c48721f4e0",
b: "-9e8742ae61615481cdd12f0728f0b61",
r: "9e8742ae6ac1fd2c304b4b4f9b10041"
a: -0x324ef140a16c5c20a9a189a720136f4836ea98056n,
b: 0x49471582a658bf5524128e130b3378d29331baa8eb8n,
r: -0x49796473e6fa2bb144bc2f9cb2538c41db68a540f0en
}, {
a: "-abf5cf9ff3c15b0645009",
b: "-e805773176aaa712d144e172db033c64aeaddf3380b2",
r: "e805773176aaa712d144e1681ba6426572982ecf30a9"
a: 0x6f15ac8490de4e308286fdde1142ad0052c2cn,
b: 0x9ca6c715de18d7f64a751452e967b5807eec951777245ce5fe3n,
r: -0x9ca6c715de18d78734c88fc20b1984fdf7eeb70634775c933b7n
}, {
a: "349ebb89b13a7149ec1a4e067574c3825f90ec4e4413948b808c6a",
b: "-44cdc0e3efa11513525f68163033a59d7b0610070",
r: "349ebb89b13a7596c8288d0086c5f8a856124f517e6d6c3be18cda"
a: -0xc303adn,
b: 0x5ec0a706a54978a59b10007942e563957ad22e708678fbfdb02862b2c3n,
r: -0x5ec0a706a54978a59b10007942e563957ad22e708678fbfdb02925b670n
}, {
a: "a86c53e8c49b20cff057882c4345c40f5c34a8cb8",
b: "-76453703c781511b52e663",
r: "a86c53e8c49b20cff05eec7fb3823c246de9d731b"
a: -0xdb736b5f3979c24f70aafa5f17711d725d552a9778e1n,
b: 0x70b56a0773498a45b796cf79ea18211614cn,
r: -0xdb736b5f408518efe7df930372ea8a69fbf6aca8da2dn
}, {
a: "-2647d3c",
b: "776e5b3a57bd5196be1b9c99ae899d949cb2b94310c53be8910db71b",
r: "-776e5b3a57bd5196be1b9c99ae899d949cb2b94310c53be893723457"
a: 0xe91b9a797168c6b7440f946n,
b: -0x2588c1301521dd9646a2e22e3aca462ca95e76069be2f7b95d8bb81ccn,
r: 0x2588c1301521dd9646a2e22e3aca462caa4791a11554608014cfc7b12n
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a - b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a - d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: -");
......
......@@ -7,96 +7,94 @@
// Flags: --harmony-bigint
var data = [{
a: "abde23cae3113c95ec7f444c7277658",
b: "-65e40fb1",
r: "-abde23cae3113c95ec7f444a2c379e9"
a: -0x46505bec40d461c595b5e4be178b7d00n,
b: -0x9170e5437d4e3ec7c0971e2c6d3bbbd2929ff108ea4ee64f7a91aa367fn,
r: 0x9170e5437d4e3ec7c0971e2c6d7deb897edf25692fdb53abc486214a81n
}, {
a: "2d0bbdc05059c78b7e9f43689b2f7a9afaefd679212c2a9b990",
b: "29fcdb109b54650f9762b494916bc1cf14853430697febe7acf4327983ce0c6c4c183",
r: "29fcdb109b54650f974fbf29513b98089ffbab7301e4c49d360eddaffaef2046d7813"
a: -0x49171f24aa9660f7f854148018a8b03256200508n,
b: 0x75c2103e4e8e52d0311n,
r: -0x49171f24aa9660f7f85413dc39ab54dab30d0617n
}, {
a: "b958dc77068d01811e031d6320df5e53823697be94f7654340b",
b: "-c1f5ca609a658e24fc33fec10a84b18fb745cb7c6",
r: "-b958dc77064cf44b7e9978ed04236dad433c130f1b4020883cf"
a: -0x3cde31210d299e4f6734f76c4f2df3056fn,
b: -0x402b7fe66d16877867f43n,
r: 0x3cde31210d299a4dd0ca91bd275a757a2cn
}, {
a: "cf7319e3fe16912370c830906f88b",
b: "98d972f3c",
r: "cf7319e3fe16912370c8a8491d7b7"
a: 0x727n,
b: 0xe1c82371da63bdb801273077095be8977ff9f14aa619829bf4b418n,
r: 0xe1c82371da63bdb801273077095be8977ff9f14aa619829bf4b33fn
}, {
a: "aea6d9e7cec74bca19",
b: "5abbcd0c5aa1f96fef9db32b3618de782db64b8f6b4",
r: "5abbcd0c5aa1f96fef9db32b3cf2b3e6515a3f33cad"
a: 0x7c2b1e0918a85bf5faea9077b7dn,
b: -0xed714ba58fd54b19n,
r: -0x7c2b1e0918a68ce140b26d23066n
}, {
a: "-b522a022e90fa094f3b729a7a0a914349f5e1fd778829d7576ad36711",
b: "-aa00d2fd6a7636",
r: "b522a022e90fa094f3b729a7a0a914349f5e1fd778883d78597b91125"
a: 0x1dded5fd695f4babcan,
b: 0x7e1cb4346c68e84f8fbdd3501daead2ce99a90e56038n,
r: 0x7e1cb4346c68e84f8fbdd3501db373f914f3cfaecbf2n
}, {
a: "9c2bc822ec4a590eb8a77ee630009713090",
b: "30b13459c1434",
r: "9c2bc822ec4a590eb8a77ed68134ced24a4"
a: 0xec7d9595de759652a3bb96c80edca63790c32ce7f6cf0ef0n,
b: -0x67f0feef424f56d6ae6856a20901199de53ebn,
r: -0xec7d9595de73e95d4d4fb23d63b640b2fae3bcf66f115d1bn
}, {
a: "-f14873e1f6121d584d5541073c7ce162873e156b72fb3c943ffd5f212c0d6",
b: "f449f0a292048546924d2973626f5441c045d4adbfd00d301791f0db965f",
r: "-fe0cecebdf32550c247193900a5a14269b3a4821a9063c473e84402c9568b"
a: 0x69ab204291f752866c3d49fdf1d656298f43e896cea3ef31a04n,
b: -0x5f5b2fd130e33ed76fa22de5ac70bdf96dee80a09e3107e1c93a135ea80b7e3640cdn,
r: -0x5f5b2fd130e33ed769389fe1856fc8d10b2d543f412c628351ce2dd7c4e140c55ac9n
}, {
a: "83d5552fba4213d8dd1ed9bc6c2",
b: "4f7ccc10ba9b6880b862f8d5e1c9",
r: "47419942413f49bd35b3154e270b"
a: -0xd396d40076en,
b: 0x3158623c80393n,
r: -0x318bf4e8804ffn
}, {
a: "9fdb44741177921c8338b70fc7fa362295bfc92f6275fa16492",
b: "93676e5ef972",
r: "9fdb44741177921c8338b70fc7fa362295bfc92654031ff9de0"
a: 0x8c1dbfbd68007d171986777446303896a1ee46n,
b: -0x75fd69710f5bea1cece9d59ec4bca29712b49dcf5ee5cc3299d7fb4fb024f10ae955fn,
r: -0x75fd69710f5bea1cece9d59ec4bca29fd36f6619dee21d4301b08c0bd3277860f7b19n
}, {
a: "4355637ed",
b: "-7aeb3013cc5eb39d56eed8104407a3e68039944f7673a0c75bd3",
r: "-7aeb3013cc5eb39d56eed8104407a3e68039944f767795916c40"
a: -0x4c6e3ccbabdd6f58450ec3ec8adfb10831b70893cb996f0ac97a0ae2f3a943185d1n,
b: 0xeb136731a19867949d46886e62050c4b446767a076c73dn,
r: -0x4c6e3ccbabdd6f58450ecd5dbcacab11b7ce4147a31f892a99bebea485d344742een
}, {
a: "7fdf50188f716c13feced67a1c33ecf422",
b: "-7106cd7b9",
r: "-7fdf50188f716c13feced67a1b2380239b"
a: 0xeaff60e10ebb4b8f2da6a517n,
b: -0x17af62a3e808af1be3d864132dfd7363bc95872580585d7a9904n,
r: -0x17af62a3e808af1be3d864132dfd999cdc74899ecbd770dc3c15n
}, {
a: "368cf8d0f5790a03774b9a1e116f82281ebd9e18de7f54a7d91f50",
b: "8bc4e4f24ce2a7d037079552e6c7db2795f15c92a01f4e0d9",
r: "368cf06cbb362ecd5d36996e683aac44630fe747cbb67ea62dff89"
a: -0xd4424b4f09210108076d63bd621180f280df8f4480n,
b: -0x20953185dd2c534b3cb8da73ce55ab386d62fe8a793a1e74cdf3ad95f3cc2573b3n,
r: 0x20953185dd2c534b3cb8da731a17e0776443ff827e577dc9afe22d677313aa37cdn
}, {
a: "-7466a596078a20cc4eca96953e3",
b: "-666328e5437b1475dcfe2f44f1c6a82af82ce7ee7cf229c8398836d2d834f9014",
r: "666328e5437b1475dcfe2f44f1c6a82af82ce79a1a57bfcfb3a8fa9c12a26c3f1"
a: 0x84317d7ec6df6dbfe9413cee812ff95c587f61c7b8de5828d445a69555cff26fba9n,
b: -0x853c667aed62685df5993748e5668802b7bf918f8c1222a5267c33f013ff1e10f1b909n,
r: -0x8534256d3a8e05ab2e67a35b2b8e9afd227a16799069af40a4f177aa7aaa42efd742a2n
}, {
a: "ad284b70a22d96bdefba53f134c65a1e4958013bb9a31f091fde6fc89",
b: "-c89374df2",
r: "-ad284b70a22d96bdefba53f134c65a1e4958013bb9a31f09d74d1b179"
a: -0xe3b4bf724b172b23c5834ed6f70f984ab3b146070770cbc3b86779db7n,
b: -0x68166de3a03d9efce30cb36e242db000c850c0d4f454594e23a1a7cn,
r: 0xe3dca91fa8b716bd39604265992bb5fab37916c7d3849f9af644d87cdn
}, {
a: "-47df52354db5",
b: "-aa7f61aba9ad859e803e964418af30",
r: "aa7f61aba9ad859e807949162de29b"
a: -0x5358b8efb260b40e37cb5b45eb4e7864n,
b: -0x3e617e3967a5b3554ebf24f1e51a253dfc20a76ef01f02442fn,
r: 0x3e617e3967a5b3554eec7c490aa84589f2176c35b5f44c3c4dn
}, {
a: "-f03ea80f22a3dc03f036b13f85faf5fb1",
b: "86e9110772d369fdd52b45a8fb22cea26cb73e908408f8a3cdf637f0042c8efdc11",
r: "-86e9110772d369fdd52b45a8fb22cea26c4700388b2a5b7fce0601413ba974083a2"
a: -0x702359917a8aceedc381n,
b: -0x714f08d9c29e9fc0044982eb2469707896265n,
r: 0x714f08d9c29e9fc0034bb77233c1dc964a1e4n
}, {
a: "3603d29c8",
b: "f4849ec3ec3c352b",
r: "f4849ec08c011ce3"
a: -0x455ac38dn,
b: -0x6152562bf5b6f785abec41e8625bccd3bf3067225733dan,
r: 0x6152562bf5b6f785abec41e8625bccd3bf3067670df055n
}, {
a: "e6668ed8eae8b4bb7bdf522d44e9f1bcf66",
b: "361cab4f5be1",
r: "e6668ed8eae8b4bb7bdf522e25234549487"
a: 0x47n,
b: 0xa3d30490286ddf5d4f4256n,
r: 0xa3d30490286ddf5d4f4211n
}, {
a: "-d0395d",
b: "-4a8ee89d006d22a124070241caf5f4343bdfd30d12",
r: "4a8ee89d006d22a124070241caf5f4343bdf03344d"
a: -0x530cc599859ccdbbb3c1dcb46248a4474c63323cc58a7891da79e0322b91c795ac57n,
b: 0x2d986083244cd488657c947a952ae15b23d90ebbc34daan,
r: -0x530cc599859ccdbbb3c1dc99fa28276300b7ba59b91e0204f098bb11f29f7c56e1fdn
}];
var error_count = 0;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var a = BigInt.parseInt(d.a, 16);
var b = BigInt.parseInt(d.b, 16);
var r = a ^ b;
if (d.r !== r.toString(16)) {
print("Input A: " + a.toString(16));
print("Input B: " + b.toString(16));
var r = d.a ^ d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(16));
print("Input B: " + d.b.toString(16));
print("Result: " + r.toString(16));
print("Expected: " + d.r);
print("Op: ^");
......
......@@ -440,6 +440,8 @@
'built-ins/DataView/prototype/setBigUint64/*': [SKIP],
'built-ins/TypedArrays/BigInt64Array/*': [SKIP],
'built-ins/TypedArrays/BigUint64Array/*': [SKIP],
# The current version of test262 still uses parseInt.
'built-ins/BigInt/parseInt/*': [SKIP],
# https://bugs.chromium.org/p/v8/issues/detail?id=7184
'annexB/language/expressions/yield/star-iterable-return-emulates-undefined-throws-when-called': [FAIL],
......
......@@ -13,9 +13,9 @@ import sys
import tempfile
# Configuration.
kChars = "0123456789abcdefghijklmnopqrstuvwxyz"
kChars = "0123456789abcdef"
kBase = 16
kLineLength = 71 # A bit less than 80.
kLineLength = 70 # A bit less than 80.
kNumInputsGenerate = 20
kNumInputsStress = 1000
......@@ -46,29 +46,36 @@ if (error_count !== 0) {
}"""
def GenRandom(length, negative=kRandom):
if length == 0: return "0"
if length == 0: return "0n"
s = []
if negative == kYes or (negative == kRandom and (random.randint(0, 1) == 0)):
s.append("-") # 50% chance of negative.
s.append("0x")
s.append(kChars[random.randint(1, kBase - 1)]) # No leading zero.
for i in range(1, length):
s.append(kChars[random.randint(0, kBase - 1)])
s.append("n")
return "".join(s)
def Format(x, base):
def Parse(x):
assert x[-1] == 'n', x
return int(x[:-1], kBase)
def Format(x):
original = x
negative = False
if x == 0: return "0"
if x == 0: return "0n"
if x < 0:
negative = True
x = -x
s = ""
while x > 0:
s = kChars[x % base] + s
x = x / base
s = kChars[x % kBase] + s
x = x / kBase
s = "0x" + s + "n"
if negative:
s = "-" + s
assert int(s, base) == original
assert Parse(s) == original
return s
class TestGenerator(object):
......@@ -120,17 +127,16 @@ class UnaryOp(TestGenerator):
# Subclasses should not override anything below.
def EmitOne(self):
x_str = self.GenerateInput()
x_num = int(x_str, kBase)
x_num = Parse(x_str)
result_num = self.GenerateResult(x_num)
result_str = Format(result_num, kBase)
return "{\n a: \"%s\",\n r: \"%s\"\n}" % (x_str, result_str)
result_str = Format(result_num)
return "{\n a: %s,\n r: %s\n}" % (x_str, result_str)
def EmitTestCore(self):
return """\
var a = BigInt.parseInt(d.a, %(base)d);
var r = %(op)sa;
if (d.r !== r.toString(%(base)d)) {
print("Input: " + a.toString(%(base)d));
var r = %(op)sd.a;
if (d.r !== r) {
print("Input: " + d.a.toString(%(base)d));
print("Result: " + r.toString(%(base)d));
print("Expected: " + d.r);
error_count++;
......@@ -152,21 +158,19 @@ class BinaryOp(TestGenerator):
# Subclasses should not override anything below.
def EmitOne(self):
left_str, right_str = self.GenerateInputs()
left_num = int(left_str, kBase)
right_num = int(right_str, kBase)
left_num = Parse(left_str)
right_num = Parse(right_str)
result_num = self.GenerateResult(left_num, right_num)
result_str = Format(result_num, kBase)
return ("{\n a: \"%s\",\n b: \"%s\",\n r: \"%s\"\n}" %
result_str = Format(result_num)
return ("{\n a: %s,\n b: %s,\n r: %s\n}" %
(left_str, right_str, result_str))
def EmitTestCore(self):
return """\
var a = BigInt.parseInt(d.a, %(base)d);
var b = BigInt.parseInt(d.b, %(base)d);
var r = a %(op)s b;
if (d.r !== r.toString(%(base)d)) {
print("Input A: " + a.toString(%(base)d));
print("Input B: " + b.toString(%(base)d));
var r = d.a %(op)s d.b;
if (d.r !== r) {
print("Input A: " + d.a.toString(%(base)d));
print("Input B: " + d.b.toString(%(base)d));
print("Result: " + r.toString(%(base)d));
print("Expected: " + d.r);
print("Op: %(op)s");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment