-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use an object for parameters in xSequentialFillFromStep and xSe…
…quentialFillFromTo (#223)
- Loading branch information
Showing
4 changed files
with
42 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
import { xSequentialFillFromStep } from '../xSequentialFillFromStep'; | ||
|
||
test('Default array type (Float64Array)', () => { | ||
const result = xSequentialFillFromStep(0, 2, 6, {}); | ||
const result = xSequentialFillFromStep({ from: 0, step: 2, size: 6 }, {}); | ||
expect(result).toStrictEqual(new Float64Array([0, 2, 4, 6, 8, 10])); | ||
}); | ||
|
||
test('Int32Array', () => { | ||
const result = xSequentialFillFromStep(0, 2, 6, { | ||
ArrayConstructor: Int32Array, | ||
}); | ||
const result = xSequentialFillFromStep( | ||
{ from: 0, step: 2, size: 6 }, | ||
{ | ||
ArrayConstructor: Int32Array, | ||
}, | ||
); | ||
expect(result).toStrictEqual(new Int32Array([0, 2, 4, 6, 8, 10])); | ||
}); | ||
|
||
test('Array', () => { | ||
const result = xSequentialFillFromStep(0, 2, 6, { | ||
ArrayConstructor: Array, | ||
}); | ||
const result = xSequentialFillFromStep( | ||
{ from: 0, step: 2, size: 6 }, | ||
{ | ||
ArrayConstructor: Array, | ||
}, | ||
); | ||
expect(typeof result.push).toBe('function'); | ||
expect(result).toStrictEqual([0, 2, 4, 6, 8, 10]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
import { xSequentialFillFromTo } from '../xSequentialFillFromTo'; | ||
|
||
test('Default array type (Float64Array)', () => { | ||
const result = xSequentialFillFromTo(0, 10, 6, {}); | ||
const result = xSequentialFillFromTo({ from: 0, to: 10, size: 6 }, {}); | ||
expect(result).toStrictEqual(new Float64Array([0, 2, 4, 6, 8, 10])); | ||
}); | ||
|
||
test('Int32Array', () => { | ||
const result = xSequentialFillFromTo(0, 10, 6, { | ||
ArrayConstructor: Int32Array, | ||
}); | ||
const result = xSequentialFillFromTo( | ||
{ from: 0, to: 10, size: 6 }, | ||
{ | ||
ArrayConstructor: Int32Array, | ||
}, | ||
); | ||
expect(result).toStrictEqual(new Int32Array([0, 2, 4, 6, 8, 10])); | ||
}); | ||
|
||
test('Array', () => { | ||
const result = xSequentialFillFromTo(0, 10, 6, { | ||
ArrayConstructor: Array, | ||
}); | ||
const result = xSequentialFillFromTo( | ||
{ from: 0, to: 10, size: 6 }, | ||
{ | ||
ArrayConstructor: Array, | ||
}, | ||
); | ||
expect(result).toStrictEqual([0, 2, 4, 6, 8, 10]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters