Skip to content

Commit

Permalink
test: basic functionality of readUIntBE()
Browse files Browse the repository at this point in the history
PR-URL: #10417
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Italo A. Casas <[email protected]>
Reviewed-By: Julian Duque <[email protected]>
  • Loading branch information
larissayvette authored and evanlucas committed Jan 4, 2017
1 parent 6d15e7b commit 826decf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/parallel/test-buffer-readuintbe.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 readUIntBE()

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

assert.strictEqual(result, 84);

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

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

0 comments on commit 826decf

Please sign in to comment.