Skip to content

Commit 1edafb0

Browse files
committed
test: add test case
--- 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 8f377e4 commit 1edafb0

File tree

1 file changed

+29
-0
lines changed
  • lib/node_modules/@stdlib/ndarray/fill-slice/test

1 file changed

+29
-0
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,35 @@ tape( 'the function throws an error if provided a `strict` option which is not a
189189
}
190190
});
191191

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+
192221
tape( 'the function fills an input ndarray slice with a specified value (row-major, contiguous)', function test( t ) {
193222
var expected;
194223
var ord;

0 commit comments

Comments
 (0)