Skip to content

Commit 27b7ac5

Browse files
authored
Update test.nanmax_by.js
Signed-off-by: Kaushikgtm <[email protected]>
1 parent 670cfe2 commit 27b7ac5

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/node_modules/@stdlib/stats/base/nanmax-by/test/test.nanmax_by.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ tape( 'the function calculates the maximum value of a strided array via a callba
7676
v = nanmaxBy( x.length, x, 1, accessor );
7777
t.strictEqual( isnan( v ), true, 'returns expected value' );
7878

79-
x = [];
80-
x.length = 5; // sparse array
79+
x = new Array( 5 ); // sparse array
8180
v = nanmaxBy( x.length, x, 1, accessor );
8281
t.strictEqual( isnan( v ), true, 'returns expected value' );
8382

@@ -113,12 +112,11 @@ tape( 'the function calculates the maximum value of a strided array via a callba
113112
v = nanmaxBy( x.length, toAccessorArray( x ), 1, accessor );
114113
t.strictEqual( isnan( v ), true, 'returns expected value' );
115114

116-
x = []; // Sparse array
117-
x.length = 5;
115+
x = new Array( 5 ); // sparse array
118116
v = nanmaxBy( x.length, toAccessorArray( x ), 1, accessor );
119117
t.strictEqual( isnan( v ), true, 'returns expected value' );
120118

121-
x = new Array( 5 ).fill( undefined ); // sparse array
119+
x = new Array( 5 ); // sparse array
122120
x[ 2 ] = 1.0;
123121
v = nanmaxBy( x.length, toAccessorArray( x ), 1, accessor );
124122
t.strictEqual( v, 2.0, 'returns expected value' );
@@ -165,8 +163,7 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
165163
v = nanmaxBy( 1, x, 1, accessor );
166164
t.strictEqual( v, 2.0, 'returns expected value' );
167165

168-
x = []; // Sparse array
169-
x.length = 5;
166+
x = new Array( 5 ); // sparse array;
170167
v = nanmaxBy( 1, x, 1, accessor );
171168
t.strictEqual( isnan( v ), true, 'returns expected value' );
172169

@@ -182,8 +179,7 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
182179
v = nanmaxBy( 1, toAccessorArray( x ), 1, accessor );
183180
t.strictEqual( v, 2.0, 'returns expected value' );
184181

185-
x = []; // Sparse array
186-
x.length = 5;
182+
x = new Array( 5 ); // sparse array
187183
v = nanmaxBy( 1, toAccessorArray( x ), 1, accessor );
188184
t.strictEqual( isnan( v ), true, 'returns expected value' );
189185

@@ -299,8 +295,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the f
299295
v = nanmaxBy( x.length, x, 0, accessor );
300296
t.strictEqual( v, 2.0, 'returns expected value' );
301297

302-
x = []; // Sparse array
303-
x.length = 5;
298+
x = new Array( 5 ); // sparse array
304299
v = nanmaxBy( 1, x, 0, accessor );
305300
t.strictEqual( isnan( v ), true, 'returns expected value' );
306301

0 commit comments

Comments
 (0)