Skip to content

Commit 1f2836f

Browse files
committed
test: add tests for 0d input arrays
--- 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 1eb5a82 commit 1f2836f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

lib/node_modules/@stdlib/blas/ext/index-of/test/test.assign.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,35 @@ tape( 'the function throws an error if provided a first argument which is not an
460460
}
461461
});
462462

463+
tape( 'the function throws an error if provided a first argument which is a zero-dimensional ndarray', function test( t ) {
464+
var values;
465+
var opts;
466+
var i;
467+
var y;
468+
469+
opts = {
470+
'dtype': 'generic'
471+
};
472+
473+
y = zeros( [], opts );
474+
475+
values = [
476+
scalar2ndarray( 10.0 ),
477+
scalar2ndarray( -3.0 ),
478+
scalar2ndarray( 0.0 )
479+
];
480+
for ( i = 0; i < values.length; i++ ) {
481+
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
482+
}
483+
t.end();
484+
485+
function badValue( value ) {
486+
return function badValue() {
487+
indexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, opts ), y, {} ); // eslint-disable-line max-len
488+
};
489+
}
490+
});
491+
463492
tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, an integer, or an object', function test( t ) {
464493
var values;
465494
var i;

0 commit comments

Comments
 (0)