Skip to content

Commit

Permalink
test: add tests to blas/ext/base/dnanasum
Browse files Browse the repository at this point in the history
PR-URL: stdlib-js#3056
Co-authored-by: Athan Reines <[email protected]>
Reviewed-by: Athan Reines <[email protected]> 
Signed-off-by: Athan Reines <[email protected]>
Co-authored-by: stdlib-bot <[email protected]>
  • Loading branch information
3 people authored Nov 19, 2024
1 parent 14b8f08 commit 7f76495
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 @@ -162,6 +162,18 @@ 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', function test( t ) {
var x;
var v;

x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );

v = dnanasum( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected value' );

t.end();
});

tape( 'the function supports view offsets', function test( t ) {
var x0;
var x1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ 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', opts, function test( t ) {
var x;
var v;

x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );

v = dnanasum( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected value' );

t.end();
});

tape( 'the function supports view offsets', opts, function test( t ) {
var x0;
var x1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@ 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', function test( t ) {
var x;
var v;

x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );

v = dnanasum( x.length, x, 0, 0 );
t.strictEqual( v, 0.0, 'returns expected value' );

t.end();
});

tape( 'the function supports an `offset` parameter', function test( t ) {
var x;
var v;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ 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', opts, function test( t ) {
var x;
var v;

x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );

v = dnanasum( x.length, x, 0, 0 );
t.strictEqual( v, 0.0, 'returns expected value' );

t.end();
});

tape( 'the function supports an `offset` parameter', opts, function test( t ) {
var x;
var v;
Expand Down

0 comments on commit 7f76495

Please sign in to comment.