You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/ndarray/fill-slice/test/test.js
+22-55Lines changed: 22 additions & 55 deletions
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ tape( 'the function throws an error if provided a first argument which is not an
68
68
69
69
functionbadValue(value){
70
70
returnfunctionbadValue(){
71
-
fillSlice(value,newMultiSlice(null,null),10.0);
71
+
fillSlice(value,10.0,newMultiSlice(null,null));
72
72
};
73
73
}
74
74
});
@@ -83,45 +83,12 @@ tape( 'the function throws an error if provided a first argument which is a read
83
83
84
84
functionbadValue(value){
85
85
returnfunctionbadValue(){
86
-
fillSlice(value,newMultiSlice(null,null),10.0);
86
+
fillSlice(value,10.0,newMultiSlice(null,null));
87
87
};
88
88
}
89
89
});
90
90
91
-
tape('the function throws an error if provided a second argument which is not a `MultiSlice` instance',functiontest(t){
92
-
varvalues;
93
-
vari;
94
-
varx;
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
-
void0,
108
-
[],
109
-
{},
110
-
functionnoop(){}
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
-
functionbadValue(value){
118
-
returnfunctionbadValue(){
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',functiontest(t){
91
+
tape('the function throws an error if provided a second argument which cannot be safely cast to the input ndarray data type',functiontest(t){
125
92
varvalues;
126
93
varx;
127
94
vari;
@@ -149,12 +116,12 @@ tape( 'the function throws an error if provided a third argument which cannot be
149
116
150
117
functionbadValue(value){
151
118
returnfunctionbadValue(){
152
-
fillSlice(x,newMultiSlice(null,null),value);
119
+
fillSlice(x,value,newMultiSlice(null,null));
153
120
};
154
121
}
155
122
});
156
123
157
-
tape('the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, contiguous)',functiontest(t){
124
+
tape('the function fills an input ndarray slice with a specified value (row-major, contiguous)',functiontest(t){
158
125
varexpected;
159
126
varord;
160
127
varsh;
@@ -179,7 +146,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
179
146
s2=newSlice(null,null);
180
147
s=newMultiSlice(s0,s1,s2);
181
148
182
-
fillSlice(x,s,10.0);
149
+
fillSlice(x,10.0,s);
183
150
184
151
expected=newFloat64Array([
185
152
10.0,
@@ -194,7 +161,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
194
161
t.end();
195
162
});
196
163
197
-
tape('the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, contiguous, accessors)',functiontest(t){
164
+
tape('the function fills an input ndarray slice with a specified value (row-major, contiguous, accessors)',functiontest(t){
198
165
varexpected;
199
166
varord;
200
167
varsh;
@@ -219,7 +186,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
219
186
s2=newSlice(null,null);
220
187
s=newMultiSlice(s0,s1,s2);
221
188
222
-
fillSlice(x,s,10.0);
189
+
fillSlice(x,10.0,s);
223
190
224
191
expected=newComplex128Array([
225
192
10.0,
@@ -238,7 +205,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
@@ -259,7 +226,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
259
226
t.end();
260
227
});
261
228
262
-
tape('the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (column-major, contiguous)',functiontest(t){
229
+
tape('the function fills an input ndarray slice with a specified value (column-major, contiguous)',functiontest(t){
263
230
varexpected;
264
231
varord;
265
232
varsh;
@@ -284,7 +251,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
284
251
s2=newSlice(null,null);
285
252
s=newMultiSlice(s0,s1,s2);
286
253
287
-
fillSlice(x,s,10.0);
254
+
fillSlice(x,10.0,s);
288
255
289
256
expected=newFloat64Array([
290
257
10.0,
@@ -299,7 +266,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
299
266
t.end();
300
267
});
301
268
302
-
tape('the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (column-major, contiguous, accessors)',functiontest(t){
269
+
tape('the function fills an input ndarray slice with a specified value (column-major, contiguous, accessors)',functiontest(t){
303
270
varexpected;
304
271
varord;
305
272
varsh;
@@ -324,7 +291,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
324
291
s2=newSlice(null,null);
325
292
s=newMultiSlice(s0,s1,s2);
326
293
327
-
fillSlice(x,s,10.0);
294
+
fillSlice(x,newComplex128(10.0,0.0),s);
328
295
329
296
expected=newComplex128Array([
330
297
10.0,
@@ -343,7 +310,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
@@ -364,7 +331,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
364
331
t.end();
365
332
});
366
333
367
-
tape('the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, non-contiguous)',functiontest(t){
334
+
tape('the function fills an input ndarray slice with a specified value (row-major, non-contiguous)',functiontest(t){
368
335
varexpected;
369
336
varord;
370
337
varsh;
@@ -389,7 +356,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
389
356
s2=newSlice(null,null);
390
357
s=newMultiSlice(s0,s1,s2);
391
358
392
-
fillSlice(x,s,10.0);
359
+
fillSlice(x,10.0,s);
393
360
394
361
expected=newFloat64Array([
395
362
0.0,
@@ -410,7 +377,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
410
377
t.end();
411
378
});
412
379
413
-
tape('the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, non-contiguous, accessors)',functiontest(t){
380
+
tape('the function fills an input ndarray slice with a specified value (row-major, non-contiguous, accessors)',functiontest(t){
414
381
varexpected;
415
382
varord;
416
383
varsh;
@@ -435,7 +402,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
435
402
s2=newSlice(null,null);
436
403
s=newMultiSlice(s0,s1,s2);
437
404
438
-
fillSlice(x,s,10.0);
405
+
fillSlice(x,newComplex128(10.0,0.0),s);
439
406
440
407
expected=newComplex128Array([
441
408
0.0,
@@ -468,7 +435,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
468
435
t.end();
469
436
});
470
437
471
-
tape('the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (column-major, non-contiguous)',functiontest(t){
438
+
tape('the function fills an input ndarray slice with a specified value (column-major, non-contiguous)',functiontest(t){
472
439
varexpected;
473
440
varord;
474
441
varsh;
@@ -493,7 +460,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
493
460
s2=newSlice(null,null);
494
461
s=newMultiSlice(s0,s1,s2);
495
462
496
-
fillSlice(x,s,10.0);
463
+
fillSlice(x,10.0,s);
497
464
498
465
expected=newFloat64Array([
499
466
0.0,
@@ -514,7 +481,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
514
481
t.end();
515
482
});
516
483
517
-
tape('the function fills an input ndarray with a specified value in a region defined by a `MultiSlice` (row-major, non-contiguous, accessors)',functiontest(t){
484
+
tape('the function fills an input ndarray slice with a specified value (column-major, non-contiguous, accessors)',functiontest(t){
518
485
varexpected;
519
486
varord;
520
487
varsh;
@@ -539,7 +506,7 @@ tape( 'the function fills an input ndarray with a specified value in a region de
0 commit comments