Skip to content

Commit

Permalink
test: basic functionality of readUIntLE()
Browse files Browse the repository at this point in the history
PR-URL: #10359
Reviewed-By: Julian Duque <julianduquej@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
larissayvette authored and evanlucas committed Jan 4, 2017
1 parent a5b8d09 commit d4c888d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/parallel/test-buffer-readuintle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';
require('../common');
const assert = require('assert');

// testing basic functionality of readUIntLE()

const buf = Buffer.from([42, 84, 168, 127]);
const result = buf.readUIntLE(2);

assert.strictEqual(result, 168);

assert.throws(
() => {
buf.readUIntLE(5);
},
/Index out of range/
);

assert.doesNotThrow(
() => {
buf.readUIntLE(5, 0, true);
},
'readUIntLE() should not throw if noAssert is true'
);

0 comments on commit d4c888d

Please sign in to comment.