Skip to content

Commit 3bdf9dc

Browse files
Neerajpathak07kgrytestdlib-bot
authored
test: add tests to blas/ext/base/dnanasumors
PR-URL: #3104 Closes: #3073 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]> Co-authored-by: stdlib-bot <[email protected]>
1 parent 7f76495 commit 3bdf9dc

File tree

4 files changed

+52
-4
lines changed

4 files changed

+52
-4
lines changed

lib/node_modules/@stdlib/blas/ext/base/dnanasumors/test/test.dnanasumors.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
7777
t.end();
7878
});
7979

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

@@ -160,6 +160,18 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
160160
t.end();
161161
});
162162

163+
tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0`', function test( t ) {
164+
var x;
165+
var v;
166+
167+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
168+
169+
v = dnanasumors( x.length, x, 0, 0 );
170+
t.strictEqual( v, 0.0, 'returns expected value' );
171+
172+
t.end();
173+
});
174+
163175
tape( 'the function supports view offsets', function test( t ) {
164176
var x0;
165177
var x1;

lib/node_modules/@stdlib/blas/ext/base/dnanasumors/test/test.dnanasumors.native.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
168168
t.end();
169169
});
170170

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

@@ -253,6 +253,18 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
253253
t.end();
254254
});
255255

256+
tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns `0`', opts, function test( t ) {
257+
var x;
258+
var v;
259+
260+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
261+
262+
v = dnanasumors( x.length, x, 0, 0 );
263+
t.strictEqual( v, 0.0, 'returns expected value' );
264+
265+
t.end();
266+
});
267+
256268
tape( 'the function supports view offsets', opts, function test( t ) {
257269
var x0;
258270
var x1;

lib/node_modules/@stdlib/blas/ext/base/dnanasumors/test/test.ndarray.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
7777
t.end();
7878
});
7979

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

@@ -162,6 +162,18 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
162162
t.end();
163163
});
164164

165+
tape( 'if provided a `stride` parameter equal to `0` and the first indexed element is `NaN`, the function returns `0`', function test( t ) {
166+
var x;
167+
var v;
168+
169+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
170+
171+
v = dnanasumors( x.length, x, 0, 0 );
172+
t.strictEqual( v, 0.0, 'returns expected value' );
173+
174+
t.end();
175+
});
176+
165177
tape( 'the function supports an `offset` parameter', function test( t ) {
166178
var x;
167179
var v;

lib/node_modules/@stdlib/blas/ext/base/dnanasumors/test/test.ndarray.native.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ tape( 'the function calculates the sum of absolute values (ignoring NaN values)'
8686
t.end();
8787
});
8888

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

@@ -171,6 +171,18 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
171171
t.end();
172172
});
173173

174+
tape( 'if provided a `stride` parameter equal to `0` and the first indexed element is `NaN`, the function returns `0`', opts, function test( t ) {
175+
var x;
176+
var v;
177+
178+
x = new Float64Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
179+
180+
v = dnanasumors( x.length, x, 0, 0 );
181+
t.strictEqual( v, 0.0, 'returns expected value' );
182+
183+
t.end();
184+
});
185+
174186
tape( 'the function supports an `offset` parameter', opts, function test( t ) {
175187
var x;
176188
var v;

0 commit comments

Comments
 (0)