Skip to content

Commit a637c5c

Browse files
test: adding coverage for blas/ext/base/dnansumkbn stdlib-js#3046
1 parent 243f857 commit a637c5c

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,17 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v
119119
t.end();
120120
});
121121

122+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ){
123+
var x;
124+
var v;
125+
126+
x =new Float64Array([NaN , 1.0,2.0,3.0,4.0]);
127+
128+
v =dnannsumkbn(x.length, x ,0);
129+
t.strictEqual(v,0.0, 'returns expected Value');
130+
t.end();
131+
});
132+
122133
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns a sum equal to `0.0`', function test( t ) {
123134
var expected;
124135
var out;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,17 @@ tape( 'the function supports negative `stride` parameters', opts, function test(
224224
t.end();
225225
});
226226

227+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ){
228+
var x;
229+
var v;
230+
231+
x =new Float64Array([NaN , 1.0,2.0,3.0,4.0]);
232+
233+
v =dnannsumkbn(x.length, x ,0);
234+
t.strictEqual(v,0.0, 'returns expected Value');
235+
t.end();
236+
});
237+
227238
tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum equal to the first element', opts, function test( t ) {
228239
var expected;
229240
var out;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ tape( 'if a native implementation is available, the main export is the native im
6363
}
6464
});
6565

66+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ){
67+
var x;
68+
var v;
69+
70+
x =new Float64Array([NaN , 1.0,2.0,3.0,4.0]);
71+
72+
v =dnannsumkbn(x.length, x ,0);
73+
t.strictEqual(v,0.0, 'returns expected Value');
74+
t.end();
75+
});
76+
6677
tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) {
6778
var dnannsumkbn;
6879
var main;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
159159
t.end();
160160
});
161161

162+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ){
163+
var x;
164+
var v;
165+
166+
x =new Float64Array([NaN , 1.0,2.0,3.0,4.0]);
167+
168+
v =dnannsumkbn(x.length, x ,0);
169+
t.strictEqual(v,0.0, 'returns expected Value');
170+
t.end();
171+
});
172+
162173
tape( 'the function supports a `stride` parameter', function test( t ) {
163174
var expected;
164175
var out;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v
128128
t.end();
129129
});
130130

131+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ){
132+
var x;
133+
var v;
134+
135+
x =new Float64Array([NaN , 1.0,2.0,3.0,4.0]);
136+
137+
v =dnannsumkbn(x.length, x ,0);
138+
t.strictEqual(v,0.0, 'returns expected Value');
139+
t.end();
140+
});
141+
131142
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', opts, function test( t ) {
132143
var expected;
133144
var out;

0 commit comments

Comments
 (0)