Skip to content

Commit fca01a0

Browse files
test: achieve 100% test coverage for blas/ext/base/dnansumkbn2
PR-URL: #3105 Closes: #3074 Reviewed-by: Philipp Burckhardt <[email protected]>
1 parent 767cb3a commit fca01a0

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v
7777
t.end();
7878
});
7979

80+
tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ) {
81+
var x;
82+
var v;
83+
84+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
85+
86+
v = dnansumkbn2( x.length, x, 0 );
87+
t.strictEqual( v, 0.0, 'returns expected value' );
88+
89+
t.end();
90+
});
91+
8092
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) {
8193
var x;
8294
var v;

lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.native.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v
168168
t.end();
169169
});
170170

171+
tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) {
172+
var x;
173+
var v;
174+
175+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
176+
177+
v = dnansumkbn2( x.length, x, 0 );
178+
t.strictEqual( v, 0.0, 'returns expected value' );
179+
180+
t.end();
181+
});
182+
171183
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', opts, function test( t ) {
172184
var x;
173185
var v;

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v
7777
t.end();
7878
});
7979

80+
tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ) {
81+
var x;
82+
var v;
83+
84+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
85+
86+
v = dnansumkbn2( x.length, x, 0, 0 );
87+
t.strictEqual( v, 0.0, 'returns expected value' );
88+
89+
t.end();
90+
});
91+
8092
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) {
8193
var x;
8294
var v;

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v
8686
t.end();
8787
});
8888

89+
tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) {
90+
var x;
91+
var v;
92+
93+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
94+
95+
v = dnansumkbn2( x.length, x, 0, 0 );
96+
t.strictEqual( v, 0.0, 'returns expected value' );
97+
98+
t.end();
99+
});
100+
89101
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', opts, function test( t ) {
90102
var x;
91103
var v;

0 commit comments

Comments
 (0)