Skip to content

Commit 02735b4

Browse files
test: achieve 100% test coverage for blas/ext/base/dnansumors
PR-URL: #3087 Closes: #3075 Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com> Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com> Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
1 parent 6556a46 commit 02735b4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v
7474
v = dnansumors( x.length, x, 1, 0 );
7575
t.strictEqual( v, 0.0, 'returns expected value' );
7676

77+
x = new Float64Array( [ NaN, -4.0 ] );
78+
v = dnansumors( x.length, x, 0, 0 );
79+
t.strictEqual( v, 0.0, 'returns expected value' );
80+
7781
t.end();
7882
});
7983

@@ -162,6 +166,18 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
162166
t.end();
163167
});
164168

169+
tape( 'if provided a `stride` and `offset` parameter equal to `0` and the first element is NaN, the function returns `0`', function test( t ) {
170+
var x;
171+
var v;
172+
173+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
174+
175+
v = dnansumors( x.length, x, 0, 0 );
176+
t.strictEqual( v, 0.0, 'returns expected value' );
177+
178+
t.end();
179+
});
180+
165181
tape( 'the function supports an `offset` parameter', function test( t ) {
166182
var x;
167183
var v;

0 commit comments

Comments
 (0)