Skip to content

Commit d7f61cd

Browse files
committed
test: add missing 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: passed - 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 3c48f50 commit d7f61cd

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

lib/node_modules/@stdlib/blas/ext/find-index/lib/main.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2424
var isFunction = require( '@stdlib/assert/is-function' );
2525
var isPlainObject = require( '@stdlib/assert/is-plain-object' );
2626
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
27-
var getShape = require( '@stdlib/ndarray/shape' );
2827
var format = require( '@stdlib/string/format' );
2928
var base = require( './base.js' );
3029

@@ -85,7 +84,6 @@ function findIndex( x ) {
8584
var opts;
8685
var ctx;
8786
var cb;
88-
var sh;
8987

9088
nargs = arguments.length;
9189
if ( !isndarrayLike( x ) ) {
@@ -150,11 +148,6 @@ function findIndex( x ) {
150148
opts.dtype = options.dtype;
151149
}
152150
}
153-
// Resolve the list of non-reduced dimensions:
154-
sh = getShape( x );
155-
if ( sh.length < 1 ) {
156-
throw new RangeError( 'invalid argument. First argument must have at least one dimension.' );
157-
}
158151
return base( x, opts, cb, ctx );
159152
}
160153

lib/node_modules/@stdlib/blas/ext/find-index/test/test.main.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,31 @@ tape( 'the function supports specifying the operation dimension (column-major)',
617617
t.end();
618618
});
619619

620+
tape( 'the function supports specifying the `keepdims` options property', function test( t ) {
621+
var expected;
622+
var actual;
623+
var xbuf;
624+
var opts;
625+
var x;
626+
627+
xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
628+
x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
629+
opts = {
630+
'keepdims': true
631+
};
632+
633+
actual = findIndex( x, opts, clbk );
634+
expected = [ [ 1 ], [ 1 ] ];
635+
636+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
637+
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
638+
t.deepEqual( getShape( actual ), [ 2, 1 ], 'returns expected value' );
639+
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
640+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
641+
642+
t.end();
643+
});
644+
620645
tape( 'the function supports specifying the output array data type', function test( t ) {
621646
var expected;
622647
var actual;

0 commit comments

Comments
 (0)