Skip to content

Commit 921a9fe

Browse files
committed
test: add boolean array tests
1 parent 756afa3 commit 921a9fe

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

lib/node_modules/@stdlib/array/base/without/test/test.assign.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ var tape = require( 'tape' );
2424
var Int32Array = require( '@stdlib/array/int32' );
2525
var Float64Array = require( '@stdlib/array/float64' );
2626
var Complex128Array = require( '@stdlib/array/complex128' );
27+
var BooleanArray = require( '@stdlib/array/bool' );
2728
var AccessorArray = require( '@stdlib/array/base/accessor' );
2829
var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' );
30+
var isSameBooleanArray = require( '@stdlib/assert/is-same-booleanarray' );
2931
var zeros = require( '@stdlib/array/zeros' );
3032
var without = require( './../lib/assign.js' );
3133

@@ -350,6 +352,38 @@ tape( 'the function copies elements to another array and sets an element at a sp
350352
t.end();
351353
});
352354

355+
tape( 'the function copies elements to another array and sets an element at a specified index to a provided value (bool)', function test( t ) {
356+
var expected;
357+
var actual;
358+
var out;
359+
var x;
360+
361+
x = new BooleanArray( [ 1, 1, 1, 1 ] );
362+
363+
out = new BooleanArray( x.length-1 );
364+
expected = new BooleanArray( [ 1, 1, 1 ] );
365+
actual = without( x, 0, out, 1, 0 );
366+
367+
t.strictEqual( actual, out, 'returns expected value' );
368+
t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' );
369+
370+
out = new BooleanArray( (x.length-1)*2 );
371+
expected = new BooleanArray( [ 1, 0, 1, 0, 1, 0 ] );
372+
actual = without( x, 1, out, 2, 0 );
373+
374+
t.strictEqual( actual, out, 'returns expected value' );
375+
t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' );
376+
377+
out = new BooleanArray( (x.length-1)*2 );
378+
expected = new BooleanArray( [ 0, 1, 0, 1, 0, 1 ] );
379+
actual = without( x, 2, out, -2, out.length-1 );
380+
381+
t.strictEqual( actual, out, 'returns expected value' );
382+
t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' );
383+
384+
t.end();
385+
});
386+
353387
tape( 'the function copies elements to another array and sets an element at a specified index to a provided value (accessors)', function test( t ) {
354388
var expected;
355389
var actual;

0 commit comments

Comments
 (0)