Skip to content

Commit 670cfe2

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

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ 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 = new Array( 5 ).fill( undefined ); // sparse array
79+
x = [];
80+
x.length = 5; // sparse array
8081
v = nanmaxBy( x.length, x, 1, accessor );
8182
t.strictEqual( isnan( v ), true, 'returns expected value' );
8283

@@ -112,7 +113,8 @@ tape( 'the function calculates the maximum value of a strided array via a callba
112113
v = nanmaxBy( x.length, toAccessorArray( x ), 1, accessor );
113114
t.strictEqual( isnan( v ), true, 'returns expected value' );
114115

115-
x = Array( 5 ).fill( undefined ); // sparse array
116+
x = []; // Sparse array
117+
x.length = 5;
116118
v = nanmaxBy( x.length, toAccessorArray( x ), 1, accessor );
117119
t.strictEqual( isnan( v ), true, 'returns expected value' );
118120

@@ -163,7 +165,8 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first
163165
v = nanmaxBy( 1, x, 1, accessor );
164166
t.strictEqual( v, 2.0, 'returns expected value' );
165167

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

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

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

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

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

0 commit comments

Comments
 (0)