mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
test(cbor): number precision error in decoding test (#6115)
This commit is contained in:
parent
39278721df
commit
bcc2c6b199
@ -39,7 +39,7 @@ Deno.test("decodeCbor() decoding integers", () => {
|
|||||||
assertEquals(decodeCbor(encodeCbor(num)), num);
|
assertEquals(decodeCbor(encodeCbor(num)), num);
|
||||||
assertEquals(decodeCbor(encodeCbor(BigInt(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(num)), BigInt(num));
|
||||||
assertEquals(decodeCbor(encodeCbor(BigInt(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(num)), num);
|
||||||
assertEquals(decodeCbor(encodeCbor(BigInt(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(num)), BigInt(num));
|
||||||
assertEquals(decodeCbor(encodeCbor(BigInt(num))), BigInt(num));
|
assertEquals(decodeCbor(encodeCbor(BigInt(num))), BigInt(num));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user