Skip to content

Commit 62bb17b

Browse files
committed
Separate readUInt64LE fixtures from writeUInt64LE; add two more tests: "n < 0" & "0 < n < 1"
1 parent 68fb3cd commit 62bb17b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

test/bufferutils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('bufferutils', () => {
4242
});
4343
});
4444

45-
fixtures.invalid.readUInt64LE.forEach(f => {
45+
fixtures.invalid.writeUInt64LE.forEach(f => {
4646
it('throws on ' + f.description, () => {
4747
const buffer = Buffer.alloc(8, 0);
4848

test/fixtures/bufferutils.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,32 @@
7171
"hex": "0100000000002000",
7272
"dec": 9007199254740993
7373
}
74+
],
75+
"writeUInt64LE": [
76+
{
77+
"description": "n === 2^53",
78+
"exception": "RangeError: value out of range",
79+
"hex": "0000000000002000",
80+
"dec": 9007199254740992
81+
},
82+
{
83+
"description": "n > 2^53",
84+
"exception": "RangeError: value out of range",
85+
"hex": "0100000000002000",
86+
"dec": 9007199254740993
87+
},
88+
{
89+
"description": "n < 0",
90+
"exception": "specified a negative value for writing an unsigned value",
91+
"hex": "",
92+
"dec": -1
93+
},
94+
{
95+
"description": "0 < n < 1",
96+
"exception": "value has a fractional component",
97+
"hex": "",
98+
"dec": 0.1
99+
}
74100
]
75101
}
76102
}

0 commit comments

Comments
 (0)