test(cbor): number precision error in decoding test (#6115)

This commit is contained in:
Doctor 2024-10-15 15:33:48 +11:00 committed by GitHub
parent 39278721df
commit bcc2c6b199
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,7 @@ Deno.test("decodeCbor() decoding integers", () => {
assertEquals(decodeCbor(encodeCbor(num)), num);
assertEquals(decodeCbor(encodeCbor(BigInt(num))), num);
num = random(2 ** 32, 2 ** 64);
num = random(2 ** 32, Number.MAX_SAFE_INTEGER);
assertEquals(decodeCbor(encodeCbor(num)), BigInt(num));
assertEquals(decodeCbor(encodeCbor(BigInt(num))), BigInt(num));
@ -59,7 +59,7 @@ Deno.test("decodeCbor() decoding integers", () => {
assertEquals(decodeCbor(encodeCbor(num)), num);
assertEquals(decodeCbor(encodeCbor(BigInt(num))), num);
num = -random(2 ** 32, 2 ** 64);
num = -random(2 ** 32, Number.MAX_SAFE_INTEGER);
assertEquals(decodeCbor(encodeCbor(num)), BigInt(num));
assertEquals(decodeCbor(encodeCbor(BigInt(num))), BigInt(num));
});