diff --git a/test/bufferutils.js b/test/bufferutils.js index 414e843..addabd0 100644 --- a/test/bufferutils.js +++ b/test/bufferutils.js @@ -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) diff --git a/test/fixtures/bufferutils.json b/test/fixtures/bufferutils.json index 0b82d50..b6c13e5 100644 --- a/test/fixtures/bufferutils.json +++ b/test/fixtures/bufferutils.json @@ -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 } ] }