From fe52e0dedbe63824c761b831b71a536a943be6bd Mon Sep 17 00:00:00 2001 From: Neerajpathak07 Date: Tue, 12 Nov 2024 23:36:32 +0530 Subject: [PATCH] test: full code coverage for blas/ext/base/dnansumkbn2 --- .../ext/base/dnansumkbn2/test/test.dnansumkbn2.js | 12 ++++++++++++ .../base/dnansumkbn2/test/test.dnansumkbn2.native.js | 12 ++++++++++++ .../blas/ext/base/dnansumkbn2/test/test.ndarray.js | 12 ++++++++++++ .../ext/base/dnansumkbn2/test/test.ndarray.native.js | 12 ++++++++++++ 4 files changed, 48 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 74b611671bf..8d2a050f586 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 @@ -77,6 +77,18 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] ); + + v = dnansumkbn2( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + t.end(); +}); + tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', 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 3ac27f39c02..d9b2c422899 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 @@ -168,6 +168,18 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v 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, -2.0, -4.0, 5.0, 3.0 ] ); + + v = dnansumkbn2( x.length, x, 0 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + t.end(); +}); + tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', opts, function test( t ) { var x; var v; 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 cd0ffaf0e2f..92ea75a95a1 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 @@ -77,6 +77,18 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v t.end(); }); +tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns 0', function test( t ) { + var x; + var v; + + x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] ); + + v = dnansumkbn2( x.length, x, 0, 0 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + t.end(); +}); + tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) { var x; var v; 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 4d6f82d79de..ae4b0ecd7a4 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 @@ -86,6 +86,18 @@ tape( 'the function calculates the sum of strided array elements (ignoring NaN v 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, -2.0, -4.0, 5.0, 3.0 ] ); + + v = dnansumkbn2( x.length, x, 0, 0 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + t.end(); +}); + tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', opts, function test( t ) { var x; var v;