@@ -26,6 +26,7 @@ var Float64Array = require( '@stdlib/array/float64' );
26
26
var Uint8Array = require ( '@stdlib/array/uint8' ) ;
27
27
var Complex64Array = require ( '@stdlib/array/complex64' ) ;
28
28
var Complex128Array = require ( '@stdlib/array/complex128' ) ;
29
+ var BooleanArray = require ( '@stdlib/array/bool' ) ;
29
30
var Complex64 = require ( '@stdlib/complex/float32/ctor' ) ;
30
31
var Complex128 = require ( '@stdlib/complex/float64/ctor' ) ;
31
32
var hasOwnProp = require ( '@stdlib/assert/has-own-property' ) ;
@@ -3445,6 +3446,37 @@ tape( 'an ndarray has a custom `toString()` method (complex type)', function tes
3445
3446
t . end ( ) ;
3446
3447
} ) ;
3447
3448
3449
+ tape ( 'an ndarray has a custom `toString()` method (boolean type)' , function test ( t ) {
3450
+ var expected ;
3451
+ var strides ;
3452
+ var actual ;
3453
+ var buffer ;
3454
+ var offset ;
3455
+ var dtype ;
3456
+ var order ;
3457
+ var shape ;
3458
+ var arr ;
3459
+
3460
+ dtype = 'bool' ;
3461
+ buffer = new BooleanArray ( [ true , false , true , false ] ) ;
3462
+ shape = [ 2 , 2 ] ;
3463
+ order = 'row-major' ;
3464
+ strides = [ 2 , 1 ] ;
3465
+ offset = 0 ;
3466
+
3467
+ arr = ndarray ( dtype , buffer , shape , strides , offset , order ) ;
3468
+
3469
+ t . strictEqual ( hasOwnProp ( arr , 'toString' ) , false , 'does not have own property' ) ;
3470
+ t . strictEqual ( hasProp ( arr , 'toString' ) , true , 'has property' ) ;
3471
+ t . strictEqual ( isFunction ( arr . toString ) , true , 'has method' ) ;
3472
+
3473
+ expected = 'ndarray( \'bool\', new BooleanArray( [ true, false, true, false ] ), [ 2, 2 ], [ 2, 1 ], 0, \'row-major\' )' ;
3474
+ actual = arr . toString ( ) ;
3475
+ t . strictEqual ( actual , expected , 'returns expected value' ) ;
3476
+
3477
+ t . end ( ) ;
3478
+ } ) ;
3479
+
3448
3480
tape ( 'an ndarray has a custom `toString()` method (complex type)' , function test ( t ) {
3449
3481
var expected ;
3450
3482
var strides ;
0 commit comments