Skip to content

Commit

Permalink
test: Adding tests to acheive 100% test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Neerajpathak07 committed Nov 9, 2024
1 parent 24107e6 commit 12b7c52
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {

Check failure on line 41 in lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/test/test.dnansumkbn2.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'opts' is not defined
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 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)', opts, function test( t ) {
var x;
var v;
Expand Down

0 comments on commit 12b7c52

Please sign in to comment.