Skip to content

Commit dbaf2f2

Browse files
complete dnanasum
1 parent f20f73a commit dbaf2f2

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,17 @@ tape('if provided a `stride` parameter equal to `0`, the function returns the su
159159
v = dnanasum(x.length, x, 0);
160160
t.strictEqual(v, 5.0, 'returns expected value');
161161

162-
x = new Float64Array([7.0, -2.0, NaN, 3.0, 5.0]);
162+
t.end();
163+
});
164+
165+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test(t) {
166+
var x;
167+
var v;
168+
169+
x = new Float64Array([NaN, -2.0, -4.0, 5.0, 3.0]);
170+
163171
v = dnanasum(x.length, x, 0);
164-
t.strictEqual(v, 7.0, 'returns expected value');
172+
t.strictEqual(v, 0.0, 'returns expected value');
165173

166174
t.end();
167175
});

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,17 @@ tape('if provided a `stride` parameter equal to `0`, the function returns the su
250250
v = dnanasum(x.length, x, 0);
251251
t.strictEqual(v, 5.0, 'returns expected value');
252252

253-
x = new Float64Array([1.0, NaN, 3.0]);
254-
v = dnanasum(x.length, x, 1);
255-
t.strictEqual(v, 4.0, 'returns expected sum ignoring NaNs');
253+
t.end();
254+
});
255+
256+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test(t) {
257+
var x;
258+
var v;
259+
260+
x = new Float64Array([NaN, -2.0, -4.0, 5.0, 3.0]);
261+
262+
v = dnanasum(x.length, x, 0);
263+
t.strictEqual(v, 0.0, 'returns expected value');
256264

257265
t.end();
258266
});

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
162162
t.end();
163163
});
164164

165+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test(t) {
166+
var x;
167+
var v;
168+
169+
x = new Float64Array([NaN, -2.0, -4.0, 5.0, 3.0]);
170+
171+
v = dnanasum(x.length, x, 0, 0);
172+
t.strictEqual(v, 0.0, 'returns expected value');
173+
174+
t.end();
175+
});
176+
165177
tape( 'the function supports an `offset` parameter', function test( t ) {
166178
var x;
167179
var v;

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,18 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
171171
t.end();
172172
});
173173

174+
tape('if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test(t) {
175+
var x;
176+
var v;
177+
178+
x = new Float64Array([NaN, -2.0, -4.0, 5.0, 3.0]);
179+
180+
v = dnanasum(x.length, x, 0, 0);
181+
t.strictEqual(v, 0.0, 'returns expected value');
182+
183+
t.end();
184+
});
185+
174186
tape( 'the function supports an `offset` parameter', opts, function test( t ) {
175187
var x;
176188
var v;

0 commit comments

Comments
 (0)