Skip to content

Commit

Permalink
test: add tests to blas/ext/base/dnannsumbn2
Browse files Browse the repository at this point in the history
PR-URL: #3205
Closes: #3186

Co-authored-by: Philipp Burckhardt <[email protected]>
Reviewed-by: Philipp Burckhardt <[email protected]>
Signed-off-by: Philipp Burckhardt <[email protected]>
  • Loading branch information
saurabhraghuvanshii and Planeshifter authored Nov 21, 2024
1 parent 65ff8cc commit 297cdff
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
t.end();
});

tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', function test( t ) {
var expected;
var out;
var x;
var v;

x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
out = new Float64Array( 2 );
v = dnannsumkbn2( x.length, x, 0, out, 1 );

expected = new Float64Array( [ 0.0, 0.0 ] );
t.deepEqual( v, expected, 'returns expected value' );

t.end();
});

tape( 'the function supports view offsets', function test( t ) {
var expected0;
var expected1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
t.end();
});

tape( 'if provided a `stride` parameter equal to `0` and the first element is NaN, the function returns `0.0`', opts, function test( t ) {
var expected;
var out;
var x;
var v;

x = new Float64Array( [ NaN, 1.0, 2.0, 3.0 ] );
out = new Float64Array( 2 );
v = dnannsumkbn2( x.length, x, 0, out, 1 );

expected = new Float64Array( [ 0.0, 0.0 ] );
t.deepEqual( v, expected, 'returns expected value' );

t.end();
});

tape( 'the function supports view offsets', opts, function test( t ) {
var expected0;
var expected1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
t.end();
});

tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', function test( t ) {
var expected;
var out;
var x;
var v;

x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
out = new Float64Array( 2 );
v = dnannsumkbn2( x.length, x, 0, 0, out, 1, 0 );

expected = new Float64Array( [ 0.0, 0.0 ] );
t.deepEqual( v, expected, 'returns expected value' );

t.end();
});

tape( 'the function supports `offset` parameters', function test( t ) {
var expected;
var out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,22 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
t.end();
});

tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0.0`', opts, function test( t ) {
var expected;
var out;
var x;
var v;

x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
out = new Float64Array( 2 );
v = dnannsumkbn2( x.length, x, 0, 0, out, 1, 0 );

expected = new Float64Array( [ 0.0, 0.0 ] );
t.deepEqual( v, expected, 'returns expected value' );

t.end();
});

tape( 'the function supports `offset` parameters', opts, function test( t ) {
var expected;
var out;
Expand Down

1 comment on commit 297cdff

@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/dnannsumkbn2 $\color{green}442/442$
$\color{green}+100.00\%$
$\color{green}25/25$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}442/442$
$\color{green}+100.00\%$

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

Please sign in to comment.