Skip to content

Commit 6f1a565

Browse files
committed
fix: add missing option
--- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent b3ea47d commit 6f1a565

2 files changed

Lines changed: 173 additions & 7 deletions

File tree

lib/node_modules/@stdlib/ndarray/find/test/test.assign.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,78 @@ tape( 'the function supports specifying the sentinel value (row-major)', functio
738738
t.end();
739739
});
740740

741+
tape( 'the function supports specifying the sentinel value (column-major)', function test( t ) {
742+
var expected;
743+
var actual;
744+
var opts;
745+
var out;
746+
var x;
747+
748+
x = new ndarray( 'float64', new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ), [ 2, 4 ], [ 4, 1 ], 0, 'column-major' );
749+
750+
opts = {
751+
'dims': [ 0 ],
752+
'sentinel': -999
753+
};
754+
out = empty( [ 4 ], {
755+
'dtype': 'float64'
756+
});
757+
758+
actual = find( x, out, opts, clbk );
759+
expected = [ 1.0, -999, 3.0, -999 ];
760+
761+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
762+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
763+
t.strictEqual( out, actual, 'returns expected value' );
764+
765+
opts = {
766+
'dims': [ 1 ],
767+
'sentinel': -999
768+
};
769+
out = empty( [ 2 ], {
770+
'dtype': 'float64'
771+
});
772+
773+
actual = find( x, out, opts, clbk );
774+
expected = [ 1.0, 5.0 ];
775+
776+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
777+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
778+
t.strictEqual( out, actual, 'returns expected value' );
779+
780+
opts = {
781+
'dims': [ 0, 1 ],
782+
'sentinel': -999
783+
};
784+
out = empty( [], {
785+
'dtype': 'float64'
786+
});
787+
788+
actual = find( x, out, opts, clbk );
789+
expected = 1.0;
790+
791+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
792+
t.deepEqual( actual.get(), expected, 'returns expected value' );
793+
t.strictEqual( out, actual, 'returns expected value' );
794+
795+
opts = {
796+
'dims': [],
797+
'sentinel': -999
798+
};
799+
out = empty( [ 2, 4 ], {
800+
'dtype': 'float64'
801+
});
802+
803+
actual = find( x, out, opts, clbk );
804+
expected = [ [ 1.0, -999, 3.0, -999 ], [ 5.0, -999, 7.0, -999 ] ];
805+
806+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
807+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
808+
t.strictEqual( out, actual, 'returns expected value' );
809+
810+
t.end();
811+
});
812+
741813
tape( 'the function supports providing an execution context', function test( t ) {
742814
var expected;
743815
var indices;

lib/node_modules/@stdlib/ndarray/find/test/test.main.js

Lines changed: 101 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,15 +639,17 @@ tape( 'the function supports specifying the sentinel value (row-major)', functio
639639

640640
opts = {
641641
'dims': [ 0 ],
642-
'keepdims': true
642+
'keepdims': true,
643+
'sentinel': -999
643644
};
644645
actual = find( x, opts, clbk );
645646
expected = [ [ 1.0, -999, 3.0, -999 ] ];
646647
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
647648
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
648649

649650
opts = {
650-
'dims': [ 1 ]
651+
'dims': [ 1 ],
652+
'sentinel': -999
651653
};
652654
actual = find( x, opts, clbk );
653655
expected = [ 1.0, 5.0 ];
@@ -656,15 +658,17 @@ tape( 'the function supports specifying the sentinel value (row-major)', functio
656658

657659
opts = {
658660
'dims': [ 1 ],
659-
'keepdims': true
661+
'keepdims': true,
662+
'sentinel': -999
660663
};
661664
actual = find( x, opts, clbk );
662665
expected = [ [ 1.0 ], [ 5.0 ] ];
663666
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
664667
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
665668

666669
opts = {
667-
'dims': [ 0, 1 ]
670+
'dims': [ 0, 1 ],
671+
'sentinel': -999
668672
};
669673
actual = find( x, opts, clbk );
670674
expected = 1.0;
@@ -673,15 +677,17 @@ tape( 'the function supports specifying the sentinel value (row-major)', functio
673677

674678
opts = {
675679
'dims': [ 0, 1 ],
676-
'keepdims': true
680+
'keepdims': true,
681+
'sentinel': -999
677682
};
678683
actual = find( x, opts, clbk );
679684
expected = [ [ 1.0 ] ];
680685
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
681686
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
682687

683688
opts = {
684-
'dims': []
689+
'dims': [],
690+
'sentinel': -999
685691
};
686692
actual = find( x, opts, clbk );
687693
expected = [ [ 1.0, -999, 3.0, -999 ], [ 5.0, -999, 7.0, -999 ] ];
@@ -690,7 +696,95 @@ tape( 'the function supports specifying the sentinel value (row-major)', functio
690696

691697
opts = {
692698
'dims': [],
693-
'keepdims': true
699+
'keepdims': true,
700+
'sentinel': -999
701+
};
702+
actual = find( x, opts, clbk );
703+
expected = [ [ 1.0, -999, 3.0, -999 ], [ 5.0, -999, 7.0, -999 ] ];
704+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
705+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
706+
707+
t.end();
708+
});
709+
710+
tape( 'the function supports specifying the sentinel value (column-major)', function test( t ) {
711+
var expected;
712+
var actual;
713+
var opts;
714+
var x;
715+
716+
x = new ndarray( 'float64', new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ), [ 2, 4 ], [ 4, 1 ], 0, 'column-major' );
717+
718+
opts = {
719+
'dims': [ 0 ],
720+
'sentinel': -999
721+
};
722+
actual = find( x, opts, clbk );
723+
expected = [ 1.0, -999, 3.0, -999 ];
724+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
725+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
726+
727+
opts = {
728+
'dims': [ 0 ],
729+
'keepdims': true,
730+
'sentinel': -999
731+
};
732+
actual = find( x, opts, clbk );
733+
expected = [ [ 1.0, -999, 3.0, -999 ] ];
734+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
735+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
736+
737+
opts = {
738+
'dims': [ 1 ],
739+
'sentinel': -999
740+
};
741+
actual = find( x, opts, clbk );
742+
expected = [ 1.0, 5.0 ];
743+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
744+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
745+
746+
opts = {
747+
'dims': [ 1 ],
748+
'keepdims': true,
749+
'sentinel': -999
750+
};
751+
actual = find( x, opts, clbk );
752+
expected = [ [ 1.0 ], [ 5.0 ] ];
753+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
754+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
755+
756+
opts = {
757+
'dims': [ 0, 1 ],
758+
'sentinel': -999
759+
};
760+
actual = find( x, opts, clbk );
761+
expected = 1.0;
762+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
763+
t.deepEqual( actual.get(), expected, 'returns expected value' );
764+
765+
opts = {
766+
'dims': [ 0, 1 ],
767+
'keepdims': true,
768+
'sentinel': -999
769+
};
770+
actual = find( x, opts, clbk );
771+
expected = [ [ 1.0 ] ];
772+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
773+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
774+
775+
opts = {
776+
'dims': [],
777+
'sentinel': -999
778+
};
779+
actual = find( x, opts, clbk );
780+
expected = [ [ 1.0, -999, 3.0, -999 ], [ 5.0, -999, 7.0, -999 ] ];
781+
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
782+
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
783+
784+
opts = {
785+
'dims': [],
786+
'keepdims': true,
787+
'sentinel': -999
694788
};
695789
actual = find( x, opts, clbk );
696790
expected = [ [ 1.0, -999, 3.0, -999 ], [ 5.0, -999, 7.0, -999 ] ];

0 commit comments

Comments
 (0)