Skip to content

Commit 4893c7d

Browse files
committed
Auto-generated commit
1 parent 6098f33 commit 4893c7d

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ A total of 32 issues were closed in this release:
227227

228228
<details>
229229

230+
- [`1d9b865`](https://github.com/stdlib-js/stdlib/commit/1d9b865020ea004692013ee403cbcc4580d9bbab) - **test:** add mutation tests _(by Athan Reines)_
230231
- [`53948cc`](https://github.com/stdlib-js/stdlib/commit/53948cc063bbf85d538b84ae678c1dc5117f864b) - **docs:** fix missing variable declaration _(by Athan Reines)_
231232
- [`cd23042`](https://github.com/stdlib-js/stdlib/commit/cd23042ad42089fb6b69783060bd67004d879ebe) - **feat:** add `zip2views` to namespace _(by Athan Reines)_
232233
- [`4a651c7`](https://github.com/stdlib-js/stdlib/commit/4a651c7b6d1ea9a814ac420a91c0d94de3956917) - **feat:** add `array/base/zip2views` _(by Athan Reines)_

base/zip2views/test/test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,41 @@ tape( 'the function zips three arrays to an array of objects (accessors)', funct
293293

294294
t.end();
295295
});
296+
297+
tape( 'the function returns views on the input arrays (indexed)', function test( t ) {
298+
var expected;
299+
var actual;
300+
var labels;
301+
var x;
302+
var y;
303+
304+
labels = [ 'x', 'y' ];
305+
306+
x = [ 1, 2 ];
307+
y = [ 3, 4 ];
308+
309+
actual = zip2views( [ x, y ], labels );
310+
311+
t.strictEqual( actual[ 0 ].x, 1, 'returns expected value' );
312+
t.strictEqual( actual[ 0 ].y, 3, 'returns expected value' );
313+
314+
t.strictEqual( actual[ 1 ].x, 2, 'returns expected value' );
315+
t.strictEqual( actual[ 1 ].y, 4, 'returns expected value' );
316+
317+
actual[ 0 ].x = -99;
318+
actual[ 1 ].y = 99;
319+
320+
t.strictEqual( actual[ 0 ].x, -99, 'returns expected value' );
321+
t.strictEqual( actual[ 0 ].y, 3, 'returns expected value' );
322+
323+
t.strictEqual( actual[ 1 ].x, 2, 'returns expected value' );
324+
t.strictEqual( actual[ 1 ].y, 99, 'returns expected value' );
325+
326+
expected = [ -99, 2 ];
327+
t.deepEqual( x, expected, 'returns expected value' );
328+
329+
expected = [ 3, 99 ];
330+
t.deepEqual( y, expected, 'returns expected value' );
331+
332+
t.end();
333+
});

0 commit comments

Comments
 (0)