Increase code coverage of bufferutils

This commit is contained in:
Jack Grigg 2017-05-31 16:13:31 +12:00
parent b6db786098
commit d386941bd0
No known key found for this signature in database
GPG Key ID: 665DBCD284F7DAFF
2 changed files with 28 additions and 3 deletions

View File

@ -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 () {
var buffer = Buffer.alloc(8, 0)

View File

@ -62,14 +62,39 @@
{
"description": "n === 2^53",
"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
},
{
"description": "n > 2^53",
"exception": "RangeError: value out of range",
"hex64": "0100000000002000",
"dec": 9007199254740993
},
{
"description": "floor(n) !== n",
"exception": "value has a fractional component",
"dec": 1.5
}
]
}