Separate readUInt64LE fixtures from writeUInt64LE; add two more tests: "n < 0" & "0 < n < 1"
This commit is contained in:
parent
68fb3cdb11
commit
62bb17b045
2 changed files with 27 additions and 1 deletions
|
@ -42,7 +42,7 @@ describe('bufferutils', () => {
|
|||
});
|
||||
});
|
||||
|
||||
fixtures.invalid.readUInt64LE.forEach(f => {
|
||||
fixtures.invalid.writeUInt64LE.forEach(f => {
|
||||
it('throws on ' + f.description, () => {
|
||||
const buffer = Buffer.alloc(8, 0);
|
||||
|
||||
|
|
26
test/fixtures/bufferutils.json
vendored
26
test/fixtures/bufferutils.json
vendored
|
@ -71,6 +71,32 @@
|
|||
"hex": "0100000000002000",
|
||||
"dec": 9007199254740993
|
||||
}
|
||||
],
|
||||
"writeUInt64LE": [
|
||||
{
|
||||
"description": "n === 2^53",
|
||||
"exception": "RangeError: value out of range",
|
||||
"hex": "0000000000002000",
|
||||
"dec": 9007199254740992
|
||||
},
|
||||
{
|
||||
"description": "n > 2^53",
|
||||
"exception": "RangeError: value out of range",
|
||||
"hex": "0100000000002000",
|
||||
"dec": 9007199254740993
|
||||
},
|
||||
{
|
||||
"description": "n < 0",
|
||||
"exception": "specified a negative value for writing an unsigned value",
|
||||
"hex": "",
|
||||
"dec": -1
|
||||
},
|
||||
{
|
||||
"description": "0 < n < 1",
|
||||
"exception": "value has a fractional component",
|
||||
"hex": "",
|
||||
"dec": 0.1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue