Increase code coverage of bufferutils
This commit is contained in:
parent
b6db786098
commit
d386941bd0
|
@ -37,7 +37,7 @@ describe('bufferutils', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
fixtures.invalid.readUInt64LE.forEach(function (f) {
|
fixtures.invalid.writeUInt64LE.forEach(function (f) {
|
||||||
it('throws on ' + f.description, function () {
|
it('throws on ' + f.description, function () {
|
||||||
var buffer = Buffer.alloc(8, 0)
|
var buffer = Buffer.alloc(8, 0)
|
||||||
|
|
||||||
|
|
|
@ -62,14 +62,39 @@
|
||||||
{
|
{
|
||||||
"description": "n === 2^53",
|
"description": "n === 2^53",
|
||||||
"exception": "RangeError: value out of range",
|
"exception": "RangeError: value out of range",
|
||||||
"hex64": "0000000000002000",
|
"hex64": "0000000000002000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "n > 2^53",
|
||||||
|
"exception": "RangeError: value out of range",
|
||||||
|
"hex64": "0100000000002000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"writeUInt64LE": [
|
||||||
|
{
|
||||||
|
"description": "n not a number",
|
||||||
|
"exception": "cannot write a non-number as a number",
|
||||||
|
"dec": "foo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "n < 0",
|
||||||
|
"exception": "specified a negative value for writing an unsigned value",
|
||||||
|
"dec": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "n === 2^53",
|
||||||
|
"exception": "RangeError: value out of range",
|
||||||
"dec": 9007199254740992
|
"dec": 9007199254740992
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "n > 2^53",
|
"description": "n > 2^53",
|
||||||
"exception": "RangeError: value out of range",
|
"exception": "RangeError: value out of range",
|
||||||
"hex64": "0100000000002000",
|
|
||||||
"dec": 9007199254740993
|
"dec": 9007199254740993
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "floor(n) !== n",
|
||||||
|
"exception": "value has a fractional component",
|
||||||
|
"dec": 1.5
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue