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/blas/dswap/test/test.js
+56Lines changed: 56 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,34 @@ tape( 'the function throws an error if provided a first argument which is not a
109
109
}
110
110
});
111
111
112
+
tape('the function throws an error if provided a first argument which is a read-only ndarray',functiontest(t){
113
+
varvalues;
114
+
varopts;
115
+
vari;
116
+
117
+
opts={
118
+
'readonly': true
119
+
};
120
+
121
+
values=[
122
+
array(newFloat64Array(10),opts),
123
+
array(newFloat64Array(5),opts)
124
+
];
125
+
126
+
for(i=0;i<values.length;i++){
127
+
t.throws(badValue(values[i]),Error,'throws an error when provided '+values[i]);
128
+
}
129
+
t.end();
130
+
131
+
functionbadValue(value){
132
+
vary=array(newFloat64Array(value.length));
133
+
134
+
returnfunctionbadValue(){
135
+
dswap(value,y);
136
+
};
137
+
}
138
+
});
139
+
112
140
tape('the function throws an error if provided a second argument which is not a non-zero-dimensional ndarray containing double-precision floating-point numbers',functiontest(t){
113
141
varvalues;
114
142
vari;
@@ -175,6 +203,34 @@ tape( 'the function throws an error if provided a second argument which is not a
175
203
}
176
204
});
177
205
206
+
tape('the function throws an error if provided a second argument which is a read-only ndarray',functiontest(t){
207
+
varvalues;
208
+
varopts;
209
+
vari;
210
+
211
+
opts={
212
+
'readonly': true
213
+
};
214
+
215
+
values=[
216
+
array(newFloat64Array(10),opts),
217
+
array(newFloat64Array(5),opts)
218
+
];
219
+
220
+
for(i=0;i<values.length;i++){
221
+
t.throws(badValue(values[i]),Error,'throws an error when provided '+values[i]);
222
+
}
223
+
t.end();
224
+
225
+
functionbadValue(value){
226
+
varx=array(newFloat64Array(value.length));
227
+
228
+
returnfunctionbadValue(){
229
+
dswap(x,value);
230
+
};
231
+
}
232
+
});
233
+
178
234
tape('the function throws an error if provided a third argument which is not a negative integer (vectors)',functiontest(t){
0 commit comments