Skip to content

Commit

Permalink
test: acheving 100% test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Neerajpathak07 committed Nov 6, 2024
1 parent 22b1ac8 commit 9b21c25
Show file tree
Hide file tree
Showing 4 changed files with 43 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 ) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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 = 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;
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 = 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;
Expand Down

0 comments on commit 9b21c25

Please sign in to comment.