Skip to content

Commit f0ab4bf

Browse files
larissayvetteMylesBorins
authored andcommitted
test: basic functionality of readUIntLE()
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>
1 parent c93ef72 commit f0ab4bf

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
require('../common');
3+
constassert=require('assert');
4+
5+
// testing basic functionality of readUIntLE()
6+
7+
constbuf=Buffer.from([42,84,168,127]);
8+
constresult=buf.readUIntLE(2);
9+
10+
assert.strictEqual(result,168);
11+
12+
assert.throws(
13+
()=>{
14+
buf.readUIntLE(5);
15+
},
16+
/Indexoutofrange/
17+
);
18+
19+
assert.doesNotThrow(
20+
()=>{
21+
buf.readUIntLE(5,0,true);
22+
},
23+
'readUIntLE() should not throw if noAssert is true'
24+
);

0 commit comments

Comments
 (0)