Skip to content

Commit 243fe3d

Browse files
test: add tests to blas/ext/base/dnannsumkbn
PR-URL: #3218 Closes: #3201 Reviewed-by: Athan Reines <[email protected]>
1 parent 7e2c16b commit 243fe3d

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

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

+17
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
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 = dnannsumkbn( 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/dnannsumkbn/test/test.dnannsumkbn.native.js

+17
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
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 = dnannsumkbn( 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/dnannsumkbn/test/test.ndarray.js

+17
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
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 = dnannsumkbn( 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/dnannsumkbn/test/test.ndarray.native.js

+17
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
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 = dnannsumkbn( 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)