Skip to content

Commit a119302

Browse files
saurabhraghuvanshiiPlaneshifter
authored andcommitted
test: add tests to blas/ext/base/dnannsumbn2
PR-URL: stdlib-js#3205 Closes: stdlib-js#3186 Co-authored-by: Philipp Burckhardt <[email protected]> Reviewed-by: Philipp Burckhardt <[email protected]> Signed-off-by: Philipp Burckhardt <[email protected]>
1 parent 2f489d0 commit a119302

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
231231
t.end();
232232
});
233233

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

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
240240
t.end();
241241
});
242242

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

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
231231
t.end();
232232
});
233233

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

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
240240
t.end();
241241
});
242242

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

0 commit comments

Comments
 (0)