Skip to content

Commit 56cbbc5

Browse files
authored
test: add NaN tests
Signed-off-by: Athan <[email protected]>
1 parent 0ba1291 commit 56cbbc5

File tree

1 file changed

+29
-1
lines changed
  • lib/node_modules/@stdlib/lapack/base/dlapy3/test

1 file changed

+29
-1
lines changed

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

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var PINF = require( '@stdlib/constants/float64/pinf' );
2525
var sqrt = require( '@stdlib/math/base/special/sqrt' );
2626
var pow = require( '@stdlib/math/base/special/pow' );
2727
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
28+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2829
var dlapy3 = require( './../lib' );
2930

3031

@@ -36,7 +37,7 @@ tape( 'main export is a function', function test( t ) {
3637
t.end();
3738
});
3839

39-
tape( 'the function returns `+0` if both arguments are `+-0`', function test( t ) {
40+
tape( 'the function returns `+0` if all arguments are `+-0`', function test( t ) {
4041
var h;
4142

4243
h = dlapy3( +0.0, +0.0, +0.0 );
@@ -54,6 +55,33 @@ tape( 'the function returns `+0` if both arguments are `+-0`', function test( t
5455
t.end();
5556
});
5657

58+
tape( 'the function returns `NaN` if one or more arguments is `NaN`', function test( t ) {
59+
var h;
60+
61+
h = dlapy3( NaN, 0.0, 0.0 );
62+
t.strictEqual( isnan( h ), true, 'returns expected value' );
63+
64+
h = dlapy3( 0.0, NaN, 0.0 );
65+
t.strictEqual( isnan( h ), true, 'returns expected value' );
66+
67+
h = dlapy3( 0.0, 0.0, NaN );
68+
t.strictEqual( isnan( h ), true, 'returns expected value' );
69+
70+
h = dlapy3( NaN, NaN, 0.0 );
71+
t.strictEqual( isnan( h ), true, 'returns expected value' );
72+
73+
h = dlapy3( NaN, 0.0, NaN );
74+
t.strictEqual( isnan( h ), true, 'returns expected value' );
75+
76+
h = dlapy3( 0.0, NaN, NaN );
77+
t.strictEqual( isnan( h ), true, 'returns expected value' );
78+
79+
h = dlapy3( NaN, NaN, NaN );
80+
t.strictEqual( isnan( h ), true, 'returns expected value' );
81+
82+
t.end();
83+
});
84+
5785
tape( 'the function computes the euclidian norm', function test( t ) {
5886
var h;
5987

0 commit comments

Comments
 (0)