Skip to content

Commit f275965

Browse files
committed
test: add tests to achieve full coverage in binomcoeff
--- 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 fa34e20 commit f275965

File tree

1 file changed

+16
-0
lines changed
  • lib/node_modules/@stdlib/math/base/special/binomcoeff/test

1 file changed

+16
-0
lines changed

lib/node_modules/@stdlib/math/base/special/binomcoeff/test/test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var tape = require( 'tape' );
2424
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2525
var absf = require( '@stdlib/math/base/special/absf' );
26+
var PINF = require( '@stdlib/constants/float32/pinf' );
2627
var EPS = require( '@stdlib/constants/float32/eps' );
2728
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
2829
var binomcoeff = require( './../lib' );
@@ -128,3 +129,18 @@ tape( 'the function returns `0` when `k` is greater than `n`', function test( t
128129
t.strictEqual( v, 0.0, 'returns expected value' );
129130
t.end();
130131
});
132+
133+
tape( 'the function returns `+infinity` for large binomial coefficients that overflow', function test( t ) {
134+
var v;
135+
136+
v = binomcoeff( 140, 70 );
137+
t.strictEqual( v, PINF, 'returns expected value' );
138+
139+
v = binomcoeff( 150, 75 );
140+
t.strictEqual( v, PINF, 'returns expected value' );
141+
142+
v = binomcoeff( 200, 100 );
143+
t.strictEqual( v, PINF, 'returns expected value' );
144+
145+
t.end();
146+
});

0 commit comments

Comments
 (0)