Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
t.end();
});

tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) {
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) {
var x;
var v;

Expand Down Expand Up @@ -160,6 +160,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 = dnanasumors( x.length, x, 0, 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 @@ -168,7 +168,7 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
t.end();
});

tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', opts, function test( t ) {
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) {
var x;
var v;

Expand Down 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 = dnanasumors( x.length, x, 0, 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 @@ -77,7 +77,7 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
t.end();
});

tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) {
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) {
var x;
var v;

Expand Down 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 indexed 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 = dnanasumors( 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 @@ -86,7 +86,7 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
t.end();
});

tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', opts, function test( t ) {
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) {
var x;
var v;

Expand Down 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 indexed 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 = dnanasumors( 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