From 72ad778633060e1f0757a2cc76dea8a6835c06b6 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Thu, 21 Nov 2024 01:13:53 +0530 Subject: [PATCH 1/2] test: add tests to blas/ext/base/dnannsumbn2 --- .../base/dnannsumkbn2/test/test.dnannsumkbn2.js | 16 ++++++++++++++++ .../test/test.dnannsumkbn2.native.js | 16 ++++++++++++++++ .../ext/base/dnannsumkbn2/test/test.ndarray.js | 16 ++++++++++++++++ .../dnannsumkbn2/test/test.ndarray.native.js | 16 ++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js index a2440f1e6684..090a344d2e88 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js @@ -231,6 +231,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns a sum of `0.0`', function test( t ) { + var expected; + var out; + var x; + var v; + + x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] ); + out = new Float64Array( 2 ); + v = dnannsumkbn2( x.length, x, 0, out, 1 ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.deepEqual( v, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports view offsets', function test( t ) { var expected0; var expected1; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js index 77f39cba8257..ad035015b357 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js @@ -240,6 +240,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns a sum of `0.0`', opts, function test( t ) { + var expected; + var out; + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0 ] ); + out = new Float64Array( 2 ); + v = dnannsumkbn2( x.length, x, 0, out, 1 ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.deepEqual( v, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports view offsets', opts, function test( t ) { var expected0; var expected1; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js index ac7034349bfa..fccfffd99d07 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js @@ -231,6 +231,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns a sum of `0.0`', function test( t ) { + var expected; + var out; + var x; + var v; + + x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] ); + out = new Float64Array( 2 ); + v = dnannsumkbn2( x.length, x, 0, 0, out, 1, 0 ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.deepEqual( v, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports `offset` parameters', function test( t ) { var expected; var out; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js index edc27ee55ece..bfb25dbb9621 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js @@ -240,6 +240,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns a sum of `0.0`', opts, function test( t ) { + var expected; + var out; + var x; + var v; + + x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] ); + out = new Float64Array( 2 ); + v = dnannsumkbn2( x.length, x, 0, 0, out, 1, 0 ); + + expected = new Float64Array( [ 0.0, 0.0 ] ); + t.deepEqual( v, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports `offset` parameters', opts, function test( t ) { var expected; var out; From 7c2d6a56f99ba157a6e7754af9e0a45b0698d62f Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Wed, 20 Nov 2024 21:32:05 -0500 Subject: [PATCH 2/2] chore: update test description Signed-off-by: Philipp Burckhardt --- .../blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js | 2 +- .../blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js | 2 +- .../@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js | 2 +- .../blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js index 090a344d2e88..12325cd3a4fa 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js @@ -231,7 +231,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s t.end(); }); -tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns a sum of `0.0`', function test( t ) { +tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', function test( t ) { var expected; var out; var x; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js index ad035015b357..295ce6bce924 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js @@ -240,7 +240,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s t.end(); }); -tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns a sum of `0.0`', opts, function test( t ) { +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns `0.0`', opts, function test( t ) { var expected; var out; var x; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js index fccfffd99d07..d1ba3f7a25d3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js @@ -231,7 +231,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s t.end(); }); -tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns a sum of `0.0`', function test( t ) { +tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', function test( t ) { var expected; var out; var x; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js index bfb25dbb9621..f0297a7b3d71 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js @@ -240,7 +240,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s t.end(); }); -tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns a sum of `0.0`', opts, function test( t ) { +tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', opts, function test( t ) { var expected; var out; var x;