Skip to content

Commit

Permalink
test: add tests to blas/ext/base/dnannsumors
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhraghuvanshii committed Nov 26, 2024
1 parent 7e2c16b commit bde4bfd
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum
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 expected;
var out;
var x;
var v;

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

out = new Float64Array( 2 );
v = dnannsumors( 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 @@ -241,6 +241,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum
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 expected;
var out;
var x;
var v;

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

out = new Float64Array( 2 );
v = dnannsumors( 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 @@ -232,6 +232,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum
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 expected;
var out;
var x;
var v;

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

out = new Float64Array( 2 );
v = dnannsumors( 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 @@ -241,6 +241,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns a sum
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 expected;
var out;
var x;
var v;

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

out = new Float64Array( 2 );
v = dnannsumors( 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

0 comments on commit bde4bfd

Please sign in to comment.