Skip to content

Commit

Permalink
test: fix strictEqual arguments order
Browse files Browse the repository at this point in the history
Fix strictEqual assertion arguments order to conform
to the function signature in buffer tests

PR-URL: #23486
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information
jonathansamines authored and jasnell committed Oct 17, 2018
1 parent b61d31a commit 6445307
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions test/parallel/test-buffer-readuint.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,37 +47,37 @@ const assert = require('assert');
// Test 8 bit unsigned integers
{
const data = Buffer.from([0xff, 0x2a, 0x2a, 0x2a]);
assert.strictEqual(255, data.readUInt8(0));
assert.strictEqual(42, data.readUInt8(1));
assert.strictEqual(42, data.readUInt8(2));
assert.strictEqual(42, data.readUInt8(3));
assert.strictEqual(data.readUInt8(0), 255);
assert.strictEqual(data.readUInt8(1), 42);
assert.strictEqual(data.readUInt8(2), 42);
assert.strictEqual(data.readUInt8(3), 42);
}

// Test 16 bit unsigned integers
{
const data = Buffer.from([0x00, 0x2a, 0x42, 0x3f]);
assert.strictEqual(0x2a, data.readUInt16BE(0));
assert.strictEqual(0x2a42, data.readUInt16BE(1));
assert.strictEqual(0x423f, data.readUInt16BE(2));
assert.strictEqual(0x2a00, data.readUInt16LE(0));
assert.strictEqual(0x422a, data.readUInt16LE(1));
assert.strictEqual(0x3f42, data.readUInt16LE(2));
assert.strictEqual(data.readUInt16BE(0), 0x2a);
assert.strictEqual(data.readUInt16BE(1), 0x2a42);
assert.strictEqual(data.readUInt16BE(2), 0x423f);
assert.strictEqual(data.readUInt16LE(0), 0x2a00);
assert.strictEqual(data.readUInt16LE(1), 0x422a);
assert.strictEqual(data.readUInt16LE(2), 0x3f42);

data[0] = 0xfe;
data[1] = 0xfe;
assert.strictEqual(0xfefe, data.readUInt16BE(0));
assert.strictEqual(0xfefe, data.readUInt16LE(0));
assert.strictEqual(data.readUInt16BE(0), 0xfefe);
assert.strictEqual(data.readUInt16LE(0), 0xfefe);
}

// Test 32 bit unsigned integers
{
const data = Buffer.from([0x32, 0x65, 0x42, 0x56, 0x23, 0xff]);
assert.strictEqual(0x32654256, data.readUInt32BE(0));
assert.strictEqual(0x65425623, data.readUInt32BE(1));
assert.strictEqual(0x425623ff, data.readUInt32BE(2));
assert.strictEqual(0x56426532, data.readUInt32LE(0));
assert.strictEqual(0x23564265, data.readUInt32LE(1));
assert.strictEqual(0xff235642, data.readUInt32LE(2));
assert.strictEqual(data.readUInt32BE(0), 0x32654256);
assert.strictEqual(data.readUInt32BE(1), 0x65425623);
assert.strictEqual(data.readUInt32BE(2), 0x425623ff);
assert.strictEqual(data.readUInt32LE(0), 0x56426532);
assert.strictEqual(data.readUInt32LE(1), 0x23564265);
assert.strictEqual(data.readUInt32LE(2), 0xff235642);
}

// Test UInt
Expand Down

0 comments on commit 6445307

Please sign in to comment.