Skip to content

Commit 4b3c2bf

Browse files
committed
test: add edge case tests for csignumf.assign including infinities
--- 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 eac64a6 commit 4b3c2bf

File tree

1 file changed

+20
-0
lines changed
  • lib/node_modules/@stdlib/math/base/special/csignumf/test

1 file changed

+20
-0
lines changed

lib/node_modules/@stdlib/math/base/special/csignumf/test/test.assign.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
2727
var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
2828
var absf = require( '@stdlib/math/base/special/absf' );
2929
var EPS = require( '@stdlib/constants/float32/eps' );
30+
var PINF = require( '@stdlib/constants/float32/pinf' );
31+
var NINF = require( '@stdlib/constants/float32/ninf' );
3032
var csignumf = require( './../lib' );
3133

3234

@@ -113,3 +115,21 @@ tape( 'the function returns -0 if input is -0 -0i', function test( t ) {
113115
t.strictEqual( isNegativeZerof( outNegZero[ 1 ] ), true, 'imag is -0' );
114116
t.end();
115117
});
118+
119+
tape( 'the function returns NaNs if input is infinity', function test( t ) {
120+
var outInf = new Float32Array( 2 );
121+
csignumf.assign( PINF, PINF, outInf, 1, 0 );
122+
123+
t.strictEqual( isnanf( outInf[ 0 ] ), true, 'real is NaN' );
124+
t.strictEqual( isnanf( outInf[ 1 ] ), true, 'imag is NaN' );
125+
t.end();
126+
});
127+
128+
tape( 'the function returns NaNs if input is negative infinity', function test( t ) {
129+
var outNegInf = new Float32Array( 2 );
130+
csignumf.assign( NINF, NINF, outNegInf, 1, 0 );
131+
132+
t.strictEqual( isnanf( outNegInf[ 0 ] ), true, 'real is NaN' );
133+
t.strictEqual( isnanf( outNegInf[ 1 ] ), true, 'imag is NaN' );
134+
t.end();
135+
});

0 commit comments

Comments
 (0)