Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix strictEqual arguments order #23486

Closed
wants to merge 1 commit into from
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
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