Skip to content

Commit 9d47d0e

Browse files
test: add tests to blas/ext/base/dnannsumors
PR-URL: #3266 Closes: #3253 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]> Signed-off-by: Athan Reines <[email protected]>
1 parent e3a09c9 commit 9d47d0e

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum
232232
t.end();
233233
});
234234

235+
tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', function test( t ) {
236+
var expected;
237+
var out;
238+
var x;
239+
var v;
240+
241+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
242+
243+
out = new Float64Array( 2 );
244+
v = dnannsumors( x.length, x, 0, out, 1 );
245+
246+
expected = new Float64Array( [ 0.0, 0.0 ] );
247+
t.deepEqual( v, expected, 'returns expected value' );
248+
249+
t.end();
250+
});
251+
235252
tape( 'the function supports view offsets', function test( t ) {
236253
var expected0;
237254
var expected1;

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum
241241
t.end();
242242
});
243243

244+
tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', opts, function test( t ) {
245+
var expected;
246+
var out;
247+
var x;
248+
var v;
249+
250+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
251+
252+
out = new Float64Array( 2 );
253+
v = dnannsumors( x.length, x, 0, out, 1 );
254+
255+
expected = new Float64Array( [ 0.0, 0.0 ] );
256+
t.deepEqual( v, expected, 'returns expected value' );
257+
258+
t.end();
259+
});
260+
244261
tape( 'the function supports view offsets', opts, function test( t ) {
245262
var expected0;
246263
var expected1;

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum
232232
t.end();
233233
});
234234

235+
tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', function test( t ) {
236+
var expected;
237+
var out;
238+
var x;
239+
var v;
240+
241+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
242+
243+
out = new Float64Array( 2 );
244+
v = dnannsumors( x.length, x, 0, 0, out, 1, 0 );
245+
246+
expected = new Float64Array( [ 0.0, 0.0 ] );
247+
t.deepEqual( v, expected, 'returns expected value' );
248+
249+
t.end();
250+
});
251+
235252
tape( 'the function supports `offset` parameters', function test( t ) {
236253
var expected;
237254
var out;

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum
241241
t.end();
242242
});
243243

244+
tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', opts, function test( t ) {
245+
var expected;
246+
var out;
247+
var x;
248+
var v;
249+
250+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
251+
252+
out = new Float64Array( 2 );
253+
v = dnannsumors( x.length, x, 0, 0, out, 1, 0 );
254+
255+
expected = new Float64Array( [ 0.0, 0.0 ] );
256+
t.deepEqual( v, expected, 'returns expected value' );
257+
258+
t.end();
259+
});
260+
244261
tape( 'the function supports `offset` parameters', opts, function test( t ) {
245262
var expected;
246263
var out;

0 commit comments

Comments
 (0)