Skip to content

Commit eb145bf

Browse files
test: full code coverage for blas/ext/base/dnanasumors
1 parent b999805 commit eb145bf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/node_modules/@stdlib/blas/ext/base/dnanasumors/test/test.ndarray.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
5858
v = dnanasumors( x.length, x, 1, 0 );
5959
t.strictEqual( v, 4.0, 'returns expected value' );
6060

61+
x = new Float64Array( [ NaN, -4.0 ] );
62+
v = dnanasumors( x.length, x, 0, 0 );
63+
t.strictEqual( v, 0.0, 'returns expected value' );
64+
6165
x = new Float64Array( [ NaN, NaN ] );
6266
v = dnanasumors( x.length, x, 1, 0 );
6367
t.strictEqual( v, 0.0, 'returns expected value' );
@@ -92,6 +96,18 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
9296
t.end();
9397
});
9498

99+
tape( 'if provided a `stride` and `offset` parameter equal to `0` and the first element is NaN, the function returns `0`', function test( t ) {
100+
var x;
101+
var v;
102+
103+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
104+
105+
v = dnanasumors( x.length, x, 0, 0 );
106+
t.strictEqual( v, 0.0, 'returns expected value' );
107+
108+
t.end();
109+
});
110+
95111
tape( 'if provided an `N` parameter equal to `1`, the function returns the first indexed element', function test( t ) {
96112
var x;
97113
var v;

0 commit comments

Comments
 (0)