From 9b21c2528bc74623cf7a23b8a682c520183a2b5b Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Wed, 6 Nov 2024 22:37:20 +0530 Subject: [PATCH 1/2] test: acheving 100% test coverage --- .../blas/ext/base/dnansumkbn/test/test.dnansumkbn.js | 11 +++++++++++ .../base/dnansumkbn/test/test.dnansumkbn.native.js | 10 ++++++++++ .../blas/ext/base/dnansumkbn/test/test.ndarray.js | 11 +++++++++++ .../ext/base/dnansumkbn/test/test.ndarray.native.js | 11 +++++++++++ 4 files changed, 43 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.js index e538d9c967c..3158cfbc395 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.js @@ -38,6 +38,17 @@ tape( 'the function has an arity of 3', function test( t ) { t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0, 4.0 ] ); + + v = dnansumkbn( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected Value' ); + t.end(); +}); + tape( 'the function calculates the sum of strided array elements (ignoring NaN values)', function test( t ) { var x; var v; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.native.js index f2f3f5d1db2..fb7affa5999 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.native.js @@ -47,6 +47,16 @@ tape( 'the function has an arity of 3', opts, function test( t ) { t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0, 4.0 ] ); + + v = dnansumkbn( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected Value' ); + t.end(); +}); tape( 'the functions throws an error if provided a first argument which is not a number', opts, function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.ndarray.js index abda894269d..1d18eecf3a8 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.ndarray.js @@ -38,6 +38,17 @@ tape( 'the function has an arity of 4', function test( t ) { t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0, 4.0 ] ); + + v = dnansumkbn( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected Value' ); + t.end(); +}); + tape( 'the function calculates the sum of strided array elements (ignoring NaN values)', function test( t ) { var x; var v; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.ndarray.native.js index ae940922013..8c9351c0ce5 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.ndarray.native.js @@ -47,6 +47,17 @@ tape( 'the function has an arity of 4', opts, function test( t ) { t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0, 4.0 ] ); + + v = dnansumkbn( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected Value' ); + t.end(); +}); + tape( 'the function calculates the sum of strided array elements (ignoring NaN values)', opts, function test( t ) { var x; var v; From d45f090da01bf707441604aceeb7d28eaaa0ecf7 Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Sat, 9 Nov 2024 18:56:58 +0530 Subject: [PATCH 2/2] test: adding tests to acheive 100% test coverage --- .../ext/base/dnansumkbn2/test/test.dnansumkbn2.js | 11 +++++++++++ .../base/dnansumkbn2/test/test.dnansumkbn2.native.js | 11 +++++++++++ .../blas/ext/base/dnansumkbn2/test/test.ndarray.js | 11 +++++++++++ .../ext/base/dnansumkbn2/test/test.ndarray.native.js | 11 +++++++++++ 4 files changed, 44 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.js index 25571e885b9..93e5060023d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.js @@ -38,6 +38,17 @@ tape( 'the function has an arity of 3', function test( t ) { t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0, 4.0 ] ); + + v = dnansumkbn2( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected Value' ); + t.end(); +}); + tape( 'the function calculates the sum of strided array elements (ignoring NaN values)', function test( t ) { var x; var v; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.native.js index 48453c89aae..f7f088d79d2 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.native.js @@ -47,6 +47,17 @@ tape( 'the function has an arity of 3', opts, function test( t ) { t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0, 4.0 ] ); + + v = dnansumkbn2( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected Value' ); + t.end(); +}); + tape( 'the functions throws an error if provided a first argument which is not a number', opts, function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.ndarray.js index baab443c589..9835e9122a8 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.ndarray.js @@ -33,6 +33,17 @@ tape( 'main export is a function', function test( t ) { t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0, 4.0 ] ); + + v = dnansumkbn2( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected Value' ); + t.end(); +}); + tape( 'the function has an arity of 4', function test( t ) { t.strictEqual( dnansumkbn2.length, 4, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.ndarray.native.js index 1f1db138798..d186bc980b3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.ndarray.native.js @@ -42,6 +42,17 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', opts, function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, 1.0, 2.0, 3.0, 4.0 ] ); + + v = dnansumkbn2( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected Value' ); + t.end(); +}); + tape( 'the function has an arity of 4', opts, function test( t ) { t.strictEqual( dnansumkbn2.length, 4, 'returns expected value' ); t.end();