Skip to content

Commit a0ac1ad

Browse files
committed
test: add 4d tests
--- 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 98dd5fd commit a0ac1ad

File tree

2 files changed

+1771
-0
lines changed

2 files changed

+1771
-0
lines changed

lib/node_modules/@stdlib/ndarray/base/find/test/test.3d.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,47 @@ tape( 'the function returns the first element in a 3-dimensional ndarray which p
489489
}
490490
});
491491

492+
tape( 'the function returns the first element in a 3-dimensional ndarray which passes a test implemented by a predicate function (row-major, non-contiguous, large arrays)', function test( t ) {
493+
var actual;
494+
var bsize;
495+
var ord;
496+
var sh;
497+
var st;
498+
var dt;
499+
var sv;
500+
var o;
501+
var x;
502+
503+
dt = 'float64';
504+
ord = 'row-major';
505+
506+
bsize = blockSize( dt );
507+
sh = [ 2, 1, bsize*2 ];
508+
st = [ bsize*4, -bsize*4, 2 ];
509+
o = strides2offset( sh, st );
510+
511+
x = ndarray( dt, oneTo( numel( sh )*2, dt ), sh, st, o, ord );
512+
sv = scalar2ndarray( NaN, {
513+
'dtype': 'float64'
514+
});
515+
516+
actual = find( [ x, sv ], clbk1 );
517+
t.strictEqual( actual, 17.0, 'returns expected value' );
518+
519+
actual = find( [ x, sv ], clbk2 );
520+
t.strictEqual( isSameValue( actual, NaN ), true, 'returns expected value' );
521+
522+
t.end();
523+
524+
function clbk1( v ) {
525+
return v % 2.0 !== 0.0;
526+
}
527+
528+
function clbk2( v ) {
529+
return v < 0.0;
530+
}
531+
});
532+
492533
tape( 'the function returns the first element in a 3-dimensional ndarray which passes a test implemented by a predicate function (row-major, contiguous, accessors)', function test( t ) {
493534
var actual;
494535
var ord;

0 commit comments

Comments
 (0)