Skip to content

Commit 26c9b6d

Browse files
authored
test: add NaN tests
Signed-off-by: Athan <[email protected]>
1 parent 3fe16d3 commit 26c9b6d

File tree

1 file changed

+16
-0
lines changed
  • lib/node_modules/@stdlib/lapack/base/dlapy2/test

1 file changed

+16
-0
lines changed

lib/node_modules/@stdlib/lapack/base/dlapy2/test/test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var abs = require( '@stdlib/math/base/special/abs' );
2727
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2828
var pow = require( '@stdlib/math/base/special/pow' );
2929
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
30+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
3031
var dlapy2 = require( './../lib' );
3132

3233

@@ -61,6 +62,21 @@ tape( 'the function returns `+0` if both arguments are `+-0`', function test( t
6162
t.end();
6263
});
6364

65+
tape( 'the function returns `NaN` if either argument is `NaN`', function test( t ) {
66+
var h;
67+
68+
h = dlapy2( NaN, 0.0 );
69+
t.strictEqual( isnan( h ), true, 'returns expected value' );
70+
71+
h = dlapy2( 0.0, NaN );
72+
t.strictEqual( isnan( h ), true, 'returns expected value' );
73+
74+
h = dlapy2( NaN, NaN );
75+
t.strictEqual( isnan( h ), true, 'returns expected value' );
76+
77+
t.end();
78+
});
79+
6480
tape( 'the function computes the hypotenuse', function test( t ) {
6581
var expected;
6682
var delta;

0 commit comments

Comments
 (0)