Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: adding tests to achieve 100% coverage for blas/ext/base/dnansumkbn #3066

Closed
Closed
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 @@ -38,6 +38,17 @@
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 ) {

Check failure on line 41 in lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'opts' is not defined
var x;
var v;

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

Check failure on line 46 in lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/test/test.dnansumkbn.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Trailing spaces not allowed
v = dnansumkbn( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected Value' );
t.end();
});

tape( 'the function calculates the sum of strided array elements (ignoring NaN values)', function test( t ) {
var x;
var v;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ tape( 'the function has an arity of 3', opts, function test( t ) {
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, 1.0, 2.0, 3.0, 4.0 ] );

v = dnansumkbn( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected Value' );
t.end();
});
tape( 'the functions throws an error if provided a first argument which is not a number', opts, function test( t ) {
var values;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ tape( 'the function has an arity of 4', function test( t ) {
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, 1.0, 2.0, 3.0, 4.0 ] );

v = dnansumkbn( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected Value' );
t.end();
});

tape( 'the function calculates the sum of strided array elements (ignoring NaN values)', function test( t ) {
var x;
var v;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ tape( 'the function has an arity of 4', opts, function test( t ) {
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, 1.0, 2.0, 3.0, 4.0 ] );

v = dnansumkbn( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected Value' );
t.end();
});

tape( 'the function calculates the sum of strided array elements (ignoring NaN values)', opts, function test( t ) {
var x;
var v;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ tape( 'the function has an arity of 3', function test( t ) {
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, 1.0, 2.0, 3.0, 4.0 ] );

v = dnansumkbn2( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected Value' );
t.end();
});

tape( 'the function calculates the sum of strided array elements (ignoring NaN values)', function test( t ) {
var x;
var v;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ tape( 'the function has an arity of 3', opts, function test( t ) {
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, 1.0, 2.0, 3.0, 4.0 ] );

v = dnansumkbn2( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected Value' );
t.end();
});

tape( 'the functions throws an error if provided a first argument which is not a number', opts, function test( t ) {
var values;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ tape( 'main export is a function', function test( t ) {
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, 1.0, 2.0, 3.0, 4.0 ] );

v = dnansumkbn2( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected Value' );
t.end();
});

tape( 'the function has an arity of 4', function test( t ) {
t.strictEqual( dnansumkbn2.length, 4, 'returns expected value' );
t.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ tape( 'main export is a function', opts, function test( t ) {
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, 1.0, 2.0, 3.0, 4.0 ] );

v = dnansumkbn2( x.length, x, 0 );
t.strictEqual( v, 0.0, 'returns expected Value' );
t.end();
});

tape( 'the function has an arity of 4', opts, function test( t ) {
t.strictEqual( dnansumkbn2.length, 4, 'returns expected value' );
t.end();
Expand Down
Loading