Skip to content

Commit d56b795

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 10377ad commit d56b795

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
@@ -121,6 +121,40 @@ tape( 'the function throws an error if provided a second argument which cannot b
121121
}
122122
});
123123

124+
tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) {
125+
var values;
126+
var x;
127+
var s;
128+
var i;
129+
130+
values = [
131+
'5',
132+
5,
133+
NaN,
134+
true,
135+
false,
136+
null,
137+
void 0,
138+
[],
139+
function noop() {}
140+
];
141+
x = scalar2ndarray( 0.0, {
142+
'dtype': 'float64'
143+
});
144+
s = new MultiSlice( null );
145+
146+
for ( i = 0; i < values.length; i++ ) {
147+
t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
148+
}
149+
t.end();
150+
151+
function badValue( value ) {
152+
return function badValue() {
153+
fillSlice( x, 10.0, s, value );
154+
};
155+
}
156+
});
157+
124158
tape( 'the function fills an input ndarray slice with a specified value (row-major, contiguous)', function test( t ) {
125159
var expected;
126160
var ord;

0 commit comments

Comments
 (0)