Skip to content

Commit 1fab79a

Browse files
committed
Auto-generated commit
1 parent 4893c7d commit 1fab79a

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+
- [`c95312a`](https://github.com/stdlib-js/stdlib/commit/c95312a79a73fb3424d20e2aa76a869304baa4d2) - **test:** add tests _(by Athan Reines)_
230231
- [`1d9b865`](https://github.com/stdlib-js/stdlib/commit/1d9b865020ea004692013ee403cbcc4580d9bbab) - **test:** add mutation tests _(by Athan Reines)_
231232
- [`53948cc`](https://github.com/stdlib-js/stdlib/commit/53948cc063bbf85d538b84ae678c1dc5117f864b) - **docs:** fix missing variable declaration _(by Athan Reines)_
232233
- [`cd23042`](https://github.com/stdlib-js/stdlib/commit/cd23042ad42089fb6b69783060bd67004d879ebe) - **feat:** add `zip2views` to namespace _(by Athan Reines)_

base/zip2views/test/test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,41 @@ tape( 'the function returns views on the input arrays (indexed)', function test(
331331

332332
t.end();
333333
});
334+
335+
tape( 'the function returns views on the input arrays (accessors)', function test( t ) {
336+
var expected;
337+
var actual;
338+
var labels;
339+
var x;
340+
var y;
341+
342+
labels = [ 'x', 'y' ];
343+
344+
x = [ 1, 2 ];
345+
y = [ 3, 4 ];
346+
347+
actual = zip2views( [ toAccessorArray( x ), toAccessorArray( y ) ], labels ); // eslint-disable-line max-len
348+
349+
t.strictEqual( actual[ 0 ].x, 1, 'returns expected value' );
350+
t.strictEqual( actual[ 0 ].y, 3, 'returns expected value' );
351+
352+
t.strictEqual( actual[ 1 ].x, 2, 'returns expected value' );
353+
t.strictEqual( actual[ 1 ].y, 4, 'returns expected value' );
354+
355+
actual[ 0 ].x = -99;
356+
actual[ 1 ].y = 99;
357+
358+
t.strictEqual( actual[ 0 ].x, -99, 'returns expected value' );
359+
t.strictEqual( actual[ 0 ].y, 3, 'returns expected value' );
360+
361+
t.strictEqual( actual[ 1 ].x, 2, 'returns expected value' );
362+
t.strictEqual( actual[ 1 ].y, 99, 'returns expected value' );
363+
364+
expected = [ -99, 2 ];
365+
t.deepEqual( x, expected, 'returns expected value' );
366+
367+
expected = [ 3, 99 ];
368+
t.deepEqual( y, expected, 'returns expected value' );
369+
370+
t.end();
371+
});

0 commit comments

Comments
 (0)