Skip to content

Commit 893df7f

Browse files
test: full code coverage for blas/ext/base/dnansumkbn2
1 parent b8259d3 commit 893df7f

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
@@ -183,6 +183,18 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
183183
t.end();
184184
});
185185

186+
tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) {
187+
var x;
188+
var v;
189+
190+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
191+
192+
v = dnansumkbn2( x.length, x, 0 );
193+
t.strictEqual( v, 0.0, 'returns expected value' );
194+
195+
t.end();
196+
});
197+
186198
tape( 'if provided an `N` parameter equal to `1`, the function returns the first element', opts, function test( t ) {
187199
var x;
188200
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
@@ -104,6 +104,18 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
104104
t.end();
105105
});
106106

107+
tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ) {
108+
var x;
109+
var v;
110+
111+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
112+
113+
v = dnansumkbn2( x.length, x, 0, 0 );
114+
t.strictEqual( v, 0.0, 'returns expected value' );
115+
116+
t.end();
117+
});
118+
107119
tape( 'the function supports a `stride` parameter', function test( t ) {
108120
var x;
109121
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
@@ -101,6 +101,18 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
101101
t.end();
102102
});
103103

104+
tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) {
105+
var x;
106+
var v;
107+
108+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
109+
110+
v = dnansumkbn2( x.length, x, 0 );
111+
t.strictEqual( v, 0.0, 'returns expected value' );
112+
113+
t.end();
114+
});
115+
104116
tape( 'if provided an `N` parameter equal to `1`, the function returns the first indexed element', opts, function test( t ) {
105117
var x;
106118
var v;

0 commit comments

Comments
 (0)