Skip to content

Commit 6601689

Browse files
committed
fix: test-cases to cover 100%
--- 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed ---
1 parent ce5e2d7 commit 6601689

File tree

1 file changed

+39
-1
lines changed
  • lib/node_modules/@stdlib/ndarray/every/test

1 file changed

+39
-1
lines changed

lib/node_modules/@stdlib/ndarray/every/test/test.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ tape( 'the function throws an error if a callback argument which is not a functi
101101
}
102102
});
103103

104-
tape( 'the function checks every element in array according to a predicate function', function test( t ) {
104+
tape( 'the function checks every element in array according to a predicate function (row-major)', function test( t ) {
105105
var expected;
106106
var ord;
107107
var buf;
@@ -139,6 +139,44 @@ tape( 'the function checks every element in array according to a predicate funct
139139
}
140140
});
141141

142+
tape( 'the function checks every element in array according to a predicate function (column-major)', function test( t ) {
143+
var expected;
144+
var ord;
145+
var buf;
146+
var sh;
147+
var st;
148+
var dt;
149+
var o;
150+
var x;
151+
var y;
152+
153+
dt = 'float64';
154+
ord = 'column-major';
155+
sh = [ 2, 1, 2 ];
156+
st = shape2strides( sh, ord );
157+
o = strides2offset( sh, st );
158+
159+
buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
160+
x = ndarray( dt, buf, sh, st, o, ord );
161+
y = every( x, predicate );
162+
163+
expected = true;
164+
t.strictEqual( y, expected, 'returns expected value' );
165+
166+
buf = new Float64Array( [ 1.0, -2.0, 3.0, -4.0 ] );
167+
x = ndarray( dt, buf, sh, st, o, ord );
168+
y = every( x, predicate );
169+
170+
expected = false;
171+
t.strictEqual( y, expected, 'returns expected value' );
172+
173+
t.end();
174+
175+
function predicate( z ) {
176+
return ( z > 0.0 );
177+
}
178+
});
179+
142180
tape( 'the function supports providing a callback execution context', function test( t ) {
143181
var expected;
144182
var ctx;

0 commit comments

Comments
 (0)