22
22
23
23
var tape = require ( 'tape' ) ;
24
24
var isndarrayLike = require ( '@stdlib/assert/is-ndarray-like' ) ;
25
+ var isSameValue = require ( '@stdlib/assert/is-same-value' ) ;
25
26
var ndarray = require ( '@stdlib/ndarray/ctor' ) ;
26
27
var zeros = require ( '@stdlib/ndarray/zeros' ) ;
27
28
var empty = require ( '@stdlib/ndarray/empty' ) ;
@@ -518,7 +519,12 @@ tape( 'the function performs a reduction on an ndarray (no dimensions, row-major
518
519
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
519
520
t . deepEqual ( getShape ( actual ) , [ 2 , 2 ] , 'returns expected value' ) ;
520
521
t . strictEqual ( getOrder ( actual ) , getOrder ( x ) , 'returns expected value' ) ;
521
- t . deepEqual ( ndarray2array ( actual ) , expected , 'returns expected value' ) ;
522
+
523
+ actual = ndarray2array ( actual ) ;
524
+ t . strictEqual ( isSameValue ( actual [ 0 ] [ 0 ] , expected [ 0 ] [ 0 ] ) , true , 'returns expected value' ) ;
525
+ t . strictEqual ( isSameValue ( actual [ 0 ] [ 1 ] , expected [ 0 ] [ 1 ] ) , true , 'returns expected value' ) ;
526
+ t . strictEqual ( isSameValue ( actual [ 1 ] [ 0 ] , expected [ 1 ] [ 0 ] ) , true , 'returns expected value' ) ;
527
+ t . strictEqual ( isSameValue ( actual [ 1 ] [ 1 ] , expected [ 1 ] [ 1 ] ) , true , 'returns expected value' ) ;
522
528
523
529
xbuf = [ - 1.0 , 2.0 , NaN , 4.0 ] ;
524
530
x = new ndarray ( 'generic' , xbuf , [ 2 , 2 ] , [ 2 , 1 ] , 0 , 'row-major' ) ;
@@ -533,7 +539,12 @@ tape( 'the function performs a reduction on an ndarray (no dimensions, row-major
533
539
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
534
540
t . deepEqual ( getShape ( actual ) , [ 2 , 2 ] , 'returns expected value' ) ;
535
541
t . strictEqual ( getOrder ( actual ) , getOrder ( x ) , 'returns expected value' ) ;
536
- t . deepEqual ( ndarray2array ( actual ) , expected , 'returns expected value' ) ;
542
+
543
+ actual = ndarray2array ( actual ) ;
544
+ t . strictEqual ( isSameValue ( actual [ 0 ] [ 0 ] , expected [ 0 ] [ 0 ] ) , true , 'returns expected value' ) ;
545
+ t . strictEqual ( isSameValue ( actual [ 0 ] [ 1 ] , expected [ 0 ] [ 1 ] ) , true , 'returns expected value' ) ;
546
+ t . strictEqual ( isSameValue ( actual [ 1 ] [ 0 ] , expected [ 1 ] [ 0 ] ) , true , 'returns expected value' ) ;
547
+ t . strictEqual ( isSameValue ( actual [ 1 ] [ 1 ] , expected [ 1 ] [ 1 ] ) , true , 'returns expected value' ) ;
537
548
538
549
t . end ( ) ;
539
550
} ) ;
@@ -557,7 +568,12 @@ tape( 'the function performs a reduction on an ndarray (no dimensions, column-ma
557
568
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
558
569
t . deepEqual ( getShape ( actual ) , [ 2 , 2 ] , 'returns expected value' ) ;
559
570
t . strictEqual ( getOrder ( actual ) , getOrder ( x ) , 'returns expected value' ) ;
560
- t . deepEqual ( ndarray2array ( actual ) , expected , 'returns expected value' ) ;
571
+
572
+ actual = ndarray2array ( actual ) ;
573
+ t . strictEqual ( isSameValue ( actual [ 0 ] [ 0 ] , expected [ 0 ] [ 0 ] ) , true , 'returns expected value' ) ;
574
+ t . strictEqual ( isSameValue ( actual [ 0 ] [ 1 ] , expected [ 0 ] [ 1 ] ) , true , 'returns expected value' ) ;
575
+ t . strictEqual ( isSameValue ( actual [ 1 ] [ 0 ] , expected [ 1 ] [ 0 ] ) , true , 'returns expected value' ) ;
576
+ t . strictEqual ( isSameValue ( actual [ 1 ] [ 1 ] , expected [ 1 ] [ 1 ] ) , true , 'returns expected value' ) ;
561
577
562
578
xbuf = [ - 1.0 , 2.0 , NaN , 4.0 ] ;
563
579
x = new ndarray ( 'generic' , xbuf , [ 2 , 2 ] , [ 1 , 2 ] , 0 , 'column-major' ) ;
@@ -572,7 +588,12 @@ tape( 'the function performs a reduction on an ndarray (no dimensions, column-ma
572
588
t . strictEqual ( getDType ( actual ) , 'generic' , 'returns expected value' ) ;
573
589
t . deepEqual ( getShape ( actual ) , [ 2 , 2 ] , 'returns expected value' ) ;
574
590
t . strictEqual ( getOrder ( actual ) , getOrder ( x ) , 'returns expected value' ) ;
575
- t . deepEqual ( ndarray2array ( actual ) , expected , 'returns expected value' ) ;
591
+
592
+ actual = ndarray2array ( actual ) ;
593
+ t . strictEqual ( isSameValue ( actual [ 0 ] [ 0 ] , expected [ 0 ] [ 0 ] ) , true , 'returns expected value' ) ;
594
+ t . strictEqual ( isSameValue ( actual [ 0 ] [ 1 ] , expected [ 0 ] [ 1 ] ) , true , 'returns expected value' ) ;
595
+ t . strictEqual ( isSameValue ( actual [ 1 ] [ 0 ] , expected [ 1 ] [ 0 ] ) , true , 'returns expected value' ) ;
596
+ t . strictEqual ( isSameValue ( actual [ 1 ] [ 1 ] , expected [ 1 ] [ 1 ] ) , true , 'returns expected value' ) ;
576
597
577
598
t . end ( ) ;
578
599
} ) ;
0 commit comments