Skip to content

Commit

Permalink
test: swap arguments in strictEqual()
Browse files Browse the repository at this point in the history
Swap arguments in strictEqual() for parallel/test-buffer-copy.

PR-URL: #23204
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
DeltaEvo authored and jasnell committed Oct 17, 2018
1 parent 5d44fe6 commit 5055b3a
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions test/parallel/test-buffer-copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ let cntr = 0;
b.fill(++cntr);
c.fill(++cntr);
const copied = b.copy(c, 0, 0, 512);
assert.strictEqual(512, copied);
assert.strictEqual(copied, 512);
for (let i = 0; i < c.length; i++) {
assert.strictEqual(b[i], c[i]);
assert.strictEqual(c[i], b[i]);
}
}

Expand All @@ -23,9 +23,9 @@ let cntr = 0;
b.fill(++cntr);
c.fill(++cntr);
const copied = c.copy(b, 0, 0);
assert.strictEqual(c.length, copied);
assert.strictEqual(copied, c.length);
for (let i = 0; i < c.length; i++) {
assert.strictEqual(c[i], b[i]);
assert.strictEqual(b[i], c[i]);
}
}

Expand All @@ -34,9 +34,9 @@ let cntr = 0;
b.fill(++cntr);
c.fill(++cntr);
const copied = c.copy(b, 0);
assert.strictEqual(c.length, copied);
assert.strictEqual(copied, c.length);
for (let i = 0; i < c.length; i++) {
assert.strictEqual(c[i], b[i]);
assert.strictEqual(b[i], c[i]);
}
}

Expand All @@ -45,9 +45,9 @@ let cntr = 0;
b.fill(++cntr);
c.fill(++cntr);
const copied = b.copy(c);
assert.strictEqual(c.length, copied);
assert.strictEqual(copied, c.length);
for (let i = 0; i < c.length; i++) {
assert.strictEqual(b[i], c[i]);
assert.strictEqual(c[i], b[i]);
}
}

Expand All @@ -56,9 +56,9 @@ let cntr = 0;
b.fill(++cntr);
c.fill(++cntr);
const copied = b.copy(c, 0, b.length - Math.floor(c.length / 2));
assert.strictEqual(Math.floor(c.length / 2), copied);
assert.strictEqual(copied, Math.floor(c.length / 2));
for (let i = 0; i < Math.floor(c.length / 2); i++) {
assert.strictEqual(b[b.length - Math.floor(c.length / 2) + i], c[i]);
assert.strictEqual(c[i], b[b.length - Math.floor(c.length / 2) + i]);
}
for (let i = Math.floor(c.length / 2) + 1; i < c.length; i++) {
assert.strictEqual(c[c.length - 1], c[i]);
Expand All @@ -70,9 +70,9 @@ let cntr = 0;
b.fill(++cntr);
c.fill(++cntr);
const copied = b.copy(c, 0, 0, 513);
assert.strictEqual(c.length, copied);
assert.strictEqual(copied, c.length);
for (let i = 0; i < c.length; i++) {
assert.strictEqual(b[i], c[i]);
assert.strictEqual(c[i], b[i]);
}
}

Expand All @@ -81,9 +81,9 @@ let cntr = 0;
b.fill(++cntr);
b.fill(++cntr, 256);
const copied = b.copy(b, 0, 256, 1024);
assert.strictEqual(768, copied);
assert.strictEqual(copied, 768);
for (let i = 0; i < b.length; i++) {
assert.strictEqual(cntr, b[i]);
assert.strictEqual(b[i], cntr);
}
}

Expand All @@ -106,7 +106,7 @@ assert.throws(function() {
c.fill(++cntr);
b.copy(c, 0, 0, 1025);
for (let i = 0; i < c.length; i++) {
assert.strictEqual(b[i], c[i]);
assert.strictEqual(c[i], b[i]);
}
}

Expand All @@ -126,9 +126,9 @@ assert.strictEqual(b.copy(c, 512, 0, 10), 0);
b.fill(++cntr);
d.fill(++cntr);
const copied = b.copy(d, 0, 0, 512);
assert.strictEqual(512, copied);
assert.strictEqual(copied, 512);
for (let i = 0; i < d.length; i++) {
assert.strictEqual(b[i], d[i]);
assert.strictEqual(d[i], b[i]);
}
}

Expand All @@ -139,8 +139,8 @@ assert.strictEqual(b.copy(c, 512, 0, 10), 0);
e.fill(++cntr);
c.fill(++cntr);
const copied = Buffer.prototype.copy.call(e, c, 0, 0, 512);
assert.strictEqual(512, copied);
assert.strictEqual(copied, 512);
for (let i = 0; i < c.length; i++) {
assert.strictEqual(e[i], c[i]);
assert.strictEqual(c[i], e[i]);
}
}

0 comments on commit 5055b3a

Please sign in to comment.