Skip to content

Commit

Permalink
Applied review suggestion to the rest of the files
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannad committed Jun 20, 2024
1 parent d9a2bac commit 0bc2d66
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ for (let ctor of ctors) {
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const fixedLengthWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT, 2);
values = [];
resizeAfter = 1;
resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
const rab = CreateRabForTest(ctor);
const const fixedLengthWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT, 2);
const values = [];
const resizeAfter = 1;
const resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
assert(ArrayEveryHelper(fixedLengthWithOffset, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
4,
6
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const lengthTracking = new ctor(rab, 0);
values = [];
resizeAfter = 2;
resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
const rab = CreateRabForTest(ctor);
const const lengthTracking = new ctor(rab, 0);
const values = [];
const resizeAfter = 2;
const resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
assert(ArrayEveryHelper(lengthTracking, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
0,
Expand All @@ -62,11 +62,11 @@ for (let ctor of ctors) {
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const lengthTrackingWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT);
values = [];
resizeAfter = 1;
resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
const rab = CreateRabForTest(ctor);
const const lengthTrackingWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT);
const values = [];
const resizeAfter = 1;
const resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
assert(ArrayEveryHelper(lengthTrackingWithOffset, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,33 @@ const ArrayEveryHelper = (ta, values, rab, resizeAfter, resizeTo) => {
// [4, 6] << fixedLengthWithOffset
// [0, 2, 4, 6, ...] << lengthTracking
// [4, 6, ...] << lengthTrackingWithOffset
let values;
let rab;
let resizeAfter;
let resizeTo;
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const fixedLength = new ctor(rab, 0, 4);
values = [];
resizeAfter = 2;
resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 2;
const resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
assert(ArrayEveryHelper(fixedLength, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
0,
2
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const fixedLengthWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT, 2);
values = [];
resizeAfter = 1;
resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 1;
const resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
assert(ArrayEveryHelper(fixedLengthWithOffset, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [4]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const lengthTracking = new ctor(rab, 0);
values = [];
resizeAfter = 2;
resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 2;
const resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
assert(ArrayEveryHelper(lengthTracking, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
0,
Expand All @@ -60,11 +56,11 @@ for (let ctor of ctors) {
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const lengthTrackingWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT);
values = [];
resizeAfter = 1;
resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 1;
const resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
assert(ArrayEveryHelper(lengthTrackingWithOffset, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [4]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@ const TypedArrayEveryHelper = (ta, values, rab, resizeAfter, resizeTo) => {
// [4, 6] << fixedLengthWithOffset
// [0, 2, 4, 6, ...] << lengthTracking
// [4, 6, ...] << lengthTrackingWithOffset
let values;
let rab;
let resizeAfter;
let resizeTo;
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const fixedLength = new ctor(rab, 0, 4);
values = [];
resizeAfter = 2;
resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 2;
const resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
assert(TypedArrayEveryHelper(fixedLength, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
0,
Expand All @@ -39,23 +35,23 @@ for (let ctor of ctors) {
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const fixedLengthWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT, 2);
values = [];
resizeAfter = 1;
resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 1;
const resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
assert(TypedArrayEveryHelper(fixedLengthWithOffset, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
4,
6
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const lengthTracking = new ctor(rab, 0);
values = [];
resizeAfter = 2;
resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 2;
const resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
assert(TypedArrayEveryHelper(lengthTracking, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
0,
Expand All @@ -65,11 +61,11 @@ for (let ctor of ctors) {
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const lengthTrackingWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT);
values = [];
resizeAfter = 1;
resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 1;
const resizeTo = 5 * ctor.BYTES_PER_ELEMENT;
assert(TypedArrayEveryHelper(lengthTrackingWithOffset, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ const TypedArrayEveryHelper = (ta, values, rab, resizeAfter, resizeTo) => {
// [4, 6] << fixedLengthWithOffset
// [0, 2, 4, 6, ...] << lengthTracking
// [4, 6, ...] << lengthTrackingWithOffset
let values;
let rab;
let resizeAfter;
let resizeTo;

for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const fixedLength = new ctor(rab, 0, 4);
values = [];
resizeAfter = 2;
resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 2;
const resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
assert(TypedArrayEveryHelper(fixedLength, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
0,
Expand All @@ -39,23 +36,23 @@ for (let ctor of ctors) {
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const fixedLengthWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT, 2);
values = [];
resizeAfter = 1;
resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 1;
const resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
assert(TypedArrayEveryHelper(fixedLengthWithOffset, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
4,
undefined
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const lengthTracking = new ctor(rab, 0);
values = [];
resizeAfter = 2;
resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 2;
const resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
assert(TypedArrayEveryHelper(lengthTracking, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
0,
Expand All @@ -65,11 +62,11 @@ for (let ctor of ctors) {
]);
}
for (let ctor of ctors) {
rab = CreateRabForTest(ctor);
const rab = CreateRabForTest(ctor);
const lengthTrackingWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT);
values = [];
resizeAfter = 1;
resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
const values = [];
const resizeAfter = 1;
const resizeTo = 3 * ctor.BYTES_PER_ELEMENT;
assert(TypedArrayEveryHelper(lengthTrackingWithOffset, values, rab, resizeAfter, resizeTo));
assert.compareArray(values, [
4,
Expand Down

0 comments on commit 0bc2d66

Please sign in to comment.