Skip to content

Commit

Permalink
test: achieve 100% test coverage for blas/ext/base/dnansumkbn2
Browse files Browse the repository at this point in the history
PR-URL: #3105
Closes: #3074

Reviewed-by: Philipp Burckhardt <[email protected]>
  • Loading branch information
Neerajpathak07 authored Nov 16, 2024
1 parent 767cb3a commit fca01a0
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

1 comment on commit fca01a0

@stdlib-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/dnansumkbn2 $\color{green}406/406$
$\color{green}+100.00\%$
$\color{green}25/25$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}406/406$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.