File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
lib/node_modules/@stdlib/ndarray/with/test Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,33 @@ tape( 'the function throws an error if provided a second argument with out-of-bo
121
121
}
122
122
} ) ;
123
123
124
+ tape ( 'the function throws an error if provided a second argument whose length does not match the number of dimensions' , function test ( t ) {
125
+ var values ;
126
+ var x ;
127
+ var i ;
128
+
129
+ x = zeros ( [ 3 , 3 , 3 ] , {
130
+ 'dtype' : 'float64'
131
+ } ) ;
132
+ values = [
133
+ [ ] ,
134
+ [ 0 ] ,
135
+ [ 0 , 0 ] ,
136
+ [ 0 , 0 , 0 , 0 ] ,
137
+ [ 0 , 0 , 0 , 0 , 0 ]
138
+ ] ;
139
+ for ( i = 0 ; i < values . length ; i ++ ) {
140
+ t . throws ( badValue ( values [ i ] ) , RangeError , 'throws an error when provided ' + values [ i ] ) ;
141
+ }
142
+ t . end ( ) ;
143
+
144
+ function badValue ( value ) {
145
+ return function badValue ( ) {
146
+ ndarrayWith ( x , value , 5 ) ;
147
+ } ;
148
+ }
149
+ } ) ;
150
+
124
151
tape ( 'the function returns a new ndarray with the element at a specified index replaced by a provided value' , function test ( t ) {
125
152
var out ;
126
153
var x ;
You can’t perform that action at this time.
0 commit comments