Skip to content

Commit da444a1

Browse files
committed
fix: fix tests
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent ad15302 commit da444a1

File tree

1 file changed

+22
-55
lines changed
  • lib/node_modules/@stdlib/ndarray/fill-slice/test

1 file changed

+22
-55
lines changed

lib/node_modules/@stdlib/ndarray/fill-slice/test/test.js

Lines changed: 22 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ tape( 'the function throws an error if provided a first argument which is not an
6868

6969
function badValue( value ) {
7070
return function badValue() {
71-
fillSlice( value, new MultiSlice( null, null ), 10.0 );
71+
fillSlice( value, 10.0, new MultiSlice( null, null ) );
7272
};
7373
}
7474
});
@@ -83,45 +83,12 @@ tape( 'the function throws an error if provided a first argument which is a read
8383

8484
function badValue( value ) {
8585
return function badValue() {
86-
fillSlice( value, new MultiSlice( null, null ), 10.0 );
86+
fillSlice( value, 10.0, new MultiSlice( null, null ) );
8787
};
8888
}
8989
});
9090

91-
tape( 'the function throws an error if provided a second argument which is not a `MultiSlice` instance', function test( t ) {
92-
var values;
93-
var i;
94-
var x;
95-
96-
x = scalar2ndarray( 0.0, {
97-
'dtype': 'float64'
98-
});
99-
100-
values = [
101-
'5',
102-
5,
103-
NaN,
104-
true,
105-
false,
106-
null,
107-
void 0,
108-
[],
109-
{},
110-
function noop() {}
111-
];
112-
for ( i = 0; i < values.length; i++ ) {
113-
t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
114-
}
115-
t.end();
116-
117-
function badValue( value ) {
118-
return function badValue() {
119-
fillSlice( x, value, 10.0 );
120-
};
121-
}
122-
});
123-
124-
tape( 'the function throws an error if provided a third argument which cannot be safely cast to the input ndarray data type', function test( t ) {
91+
tape( 'the function throws an error if provided a second argument which cannot be safely cast to the input ndarray data type', function test( t ) {
12592
var values;
12693
var x;
12794
var i;
@@ -149,12 +116,12 @@ tape( 'the function throws an error if provided a third argument which cannot be
149116

150117
function badValue( value ) {
151118
return function badValue() {
152-
fillSlice( x, new MultiSlice( null, null), value );
119+
fillSlice( x, value, new MultiSlice( null, null) );
153120
};
154121
}
155122
});
156123

157-
tape( 'the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, contiguous)', function test( t ) {
124+
tape( 'the function fills an input ndarray slice with a specified value (row-major, contiguous)', function test( t ) {
158125
var expected;
159126
var ord;
160127
var sh;
@@ -179,7 +146,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
179146
s2 = new Slice( null, null );
180147
s = new MultiSlice( s0, s1, s2 );
181148

182-
fillSlice( x, s, 10.0 );
149+
fillSlice( x, 10.0, s );
183150

184151
expected = new Float64Array([
185152
10.0,
@@ -194,7 +161,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
194161
t.end();
195162
});
196163

197-
tape( 'the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, contiguous, accessors)', function test( t ) {
164+
tape( 'the function fills an input ndarray slice with a specified value (row-major, contiguous, accessors)', function test( t ) {
198165
var expected;
199166
var ord;
200167
var sh;
@@ -219,7 +186,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
219186
s2 = new Slice( null, null );
220187
s = new MultiSlice( s0, s1, s2 );
221188

222-
fillSlice( x, s, 10.0 );
189+
fillSlice( x, 10.0, s );
223190

224191
expected = new Complex128Array([
225192
10.0,
@@ -238,7 +205,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
238205

239206
t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' );
240207

241-
fillSlice( x, s, new Complex128( -10.0, -20.0 ) );
208+
fillSlice( x, new Complex128( -10.0, -20.0 ), s );
242209

243210
expected = new Complex128Array([
244211
-10.0,
@@ -259,7 +226,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
259226
t.end();
260227
});
261228

262-
tape( 'the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (column-major, contiguous)', function test( t ) {
229+
tape( 'the function fills an input ndarray slice with a specified value (column-major, contiguous)', function test( t ) {
263230
var expected;
264231
var ord;
265232
var sh;
@@ -284,7 +251,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
284251
s2 = new Slice( null, null );
285252
s = new MultiSlice( s0, s1, s2 );
286253

287-
fillSlice( x, s, 10.0 );
254+
fillSlice( x, 10.0, s );
288255

289256
expected = new Float64Array([
290257
10.0,
@@ -299,7 +266,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
299266
t.end();
300267
});
301268

302-
tape( 'the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (column-major, contiguous, accessors)', function test( t ) {
269+
tape( 'the function fills an input ndarray slice with a specified value (column-major, contiguous, accessors)', function test( t ) {
303270
var expected;
304271
var ord;
305272
var sh;
@@ -324,7 +291,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
324291
s2 = new Slice( null, null );
325292
s = new MultiSlice( s0, s1, s2 );
326293

327-
fillSlice( x, s, 10.0 );
294+
fillSlice( x, new Complex128( 10.0, 0.0 ), s );
328295

329296
expected = new Complex128Array([
330297
10.0,
@@ -343,7 +310,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
343310

344311
t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' );
345312

346-
fillSlice( x, s, new Complex128( -10.0, -20.0 ) );
313+
fillSlice( x, new Complex128( -10.0, -20.0 ), s );
347314

348315
expected = new Complex128Array([
349316
-10.0,
@@ -364,7 +331,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
364331
t.end();
365332
});
366333

367-
tape( 'the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, non-contiguous)', function test( t ) {
334+
tape( 'the function fills an input ndarray slice with a specified value (row-major, non-contiguous)', function test( t ) {
368335
var expected;
369336
var ord;
370337
var sh;
@@ -389,7 +356,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
389356
s2 = new Slice( null, null );
390357
s = new MultiSlice( s0, s1, s2 );
391358

392-
fillSlice( x, s, 10.0 );
359+
fillSlice( x, 10.0, s );
393360

394361
expected = new Float64Array([
395362
0.0,
@@ -410,7 +377,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
410377
t.end();
411378
});
412379

413-
tape( 'the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, non-contiguous, accessors)', function test( t ) {
380+
tape( 'the function fills an input ndarray slice with a specified value (row-major, non-contiguous, accessors)', function test( t ) {
414381
var expected;
415382
var ord;
416383
var sh;
@@ -435,7 +402,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
435402
s2 = new Slice( null, null );
436403
s = new MultiSlice( s0, s1, s2 );
437404

438-
fillSlice( x, s, 10.0 );
405+
fillSlice( x, new Complex128( 10.0, 0.0 ), s );
439406

440407
expected = new Complex128Array([
441408
0.0,
@@ -468,7 +435,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
468435
t.end();
469436
});
470437

471-
tape( 'the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (column-major, non-contiguous)', function test( t ) {
438+
tape( 'the function fills an input ndarray slice with a specified value (column-major, non-contiguous)', function test( t ) {
472439
var expected;
473440
var ord;
474441
var sh;
@@ -493,7 +460,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
493460
s2 = new Slice( null, null );
494461
s = new MultiSlice( s0, s1, s2 );
495462

496-
fillSlice( x, s, 10.0 );
463+
fillSlice( x, 10.0, s );
497464

498465
expected = new Float64Array([
499466
0.0,
@@ -514,7 +481,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
514481
t.end();
515482
});
516483

517-
tape( 'the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, non-contiguous, accessors)', function test( t ) {
484+
tape( 'the function fills an input ndarray slice with a specified value (column-major, non-contiguous, accessors)', function test( t ) {
518485
var expected;
519486
var ord;
520487
var sh;
@@ -539,7 +506,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
539506
s2 = new Slice( null, null );
540507
s = new MultiSlice( s0, s1, s2 );
541508

542-
fillSlice( x, s, 10.0 );
509+
fillSlice( x, new Complex128( 10.0, 0.0 ), s );
543510

544511
expected = new Complex128Array([
545512
0.0,

0 commit comments

Comments
 (0)