File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
lib/node_modules/@stdlib/ndarray/fill-slice/test Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,35 @@ tape( 'the function throws an error if provided a `strict` option which is not a
189
189
}
190
190
} ) ;
191
191
192
+ tape ( 'the function throws an error if provided an invalid slice argument' , function test ( t ) {
193
+ var values ;
194
+ var x ;
195
+ var s ;
196
+ var i ;
197
+
198
+ values = [
199
+ '5' ,
200
+ NaN ,
201
+ [ ] ,
202
+ function noop ( ) { }
203
+ ] ;
204
+ x = scalar2ndarray ( 0.0 , {
205
+ 'dtype' : 'float64'
206
+ } ) ;
207
+ s = null ;
208
+
209
+ for ( i = 0 ; i < values . length ; i ++ ) {
210
+ t . throws ( badValue ( values [ i ] ) , TypeError , 'throws an error when provided ' + values [ i ] ) ;
211
+ }
212
+ t . end ( ) ;
213
+
214
+ function badValue ( value ) {
215
+ return function badValue ( ) {
216
+ fillSlice ( x , 10.0 , s , value ) ;
217
+ } ;
218
+ }
219
+ } ) ;
220
+
192
221
tape ( 'the function fills an input ndarray slice with a specified value (row-major, contiguous)' , function test ( t ) {
193
222
var expected ;
194
223
var ord ;
You can’t perform that action at this time.
0 commit comments