Skip to content

Commit 8f377e4

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 d56b795 commit 8f377e4

File tree

1 file changed

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

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,40 @@ tape( 'the function throws an error if provided an options argument which is not
155155
}
156156
});
157157

158+
tape( 'the function throws an error if provided a `strict` option which is not a boolean (multislice)', function test( t ) {
159+
var values;
160+
var x;
161+
var s;
162+
var i;
163+
164+
values = [
165+
'5',
166+
5,
167+
NaN,
168+
null,
169+
void 0,
170+
[],
171+
function noop() {}
172+
];
173+
x = scalar2ndarray( 0.0, {
174+
'dtype': 'float64'
175+
});
176+
s = new MultiSlice( null );
177+
178+
for ( i = 0; i < values.length; i++ ) {
179+
t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
180+
}
181+
t.end();
182+
183+
function badValue( value ) {
184+
return function badValue() {
185+
fillSlice( x, 10.0, s, {
186+
'strict': value
187+
});
188+
};
189+
}
190+
});
191+
158192
tape( 'the function fills an input ndarray slice with a specified value (row-major, contiguous)', function test( t ) {
159193
var expected;
160194
var ord;

0 commit comments

Comments
 (0)