Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: basic functionality of readUIntBE()
  • Loading branch information
larissayvette committed Dec 23, 2016
commit 83e79cf3edff4a9be02093c4abe03b60ae60e044
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'
);