Skip to content

Commit 3448159

Browse files
committed
test: update tests
1 parent bd17893 commit 3448159

File tree

2 files changed

+54
-60
lines changed

2 files changed

+54
-60
lines changed

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

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,14 @@ var tape = require( 'tape' );
2626
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2727
var absf = require( '@stdlib/math/base/special/absf' );
2828
var EPS = require( '@stdlib/constants/float32/eps' );
29-
var FLOAT32_SMALLEST_NORMAL = require( '@stdlib/constants/float32/smallest-normal' );
29+
var PINF = require( '@stdlib/constants/float32/pinf' );
30+
var NINF = require( '@stdlib/constants/float32/ninf' );
3031
var Complex64 = require( '@stdlib/complex/float32/ctor' );
3132
var real = require( '@stdlib/complex/float32/real' );
3233
var imag = require( '@stdlib/complex/float32/imag' );
3334
var cinvf = require( './../lib' );
3435

3536

36-
// VARIABLES //
37-
38-
var HUGE = 1.0e37;
39-
var TINY = -1.0e37;
40-
41-
4237
// FIXTURES //
4338

4439
var data = require( './fixtures/julia/data.json' );
@@ -393,40 +388,40 @@ tape( 'the function computes a complex inverse (tiny positive real components)',
393388
t.end();
394389
});
395390

396-
tape( 'the function may produce very large values for very small inputs', function test( t ) {
391+
tape( 'the function may overflow', function test( t ) {
397392
var v;
398393

399-
v = cinvf( new Complex64( FLOAT32_SMALLEST_NORMAL, FLOAT32_SMALLEST_NORMAL ) ); // eslint-disable-line max-len
400-
t.ok( real( v ) > HUGE, 'returns expected value.' );
401-
t.ok( imag( v ) < TINY, 'returns expected value.' );
394+
v = cinvf( new Complex64( 1.4e-45, 1.4e-45 ) );
395+
t.strictEqual( real( v ), PINF, 'returns expected value' );
396+
t.strictEqual( imag( v ), NINF, 'returns expected value' );
402397

403-
v = cinvf( new Complex64( -FLOAT32_SMALLEST_NORMAL, FLOAT32_SMALLEST_NORMAL ) ); // eslint-disable-line max-len
404-
t.ok( real( v ) < TINY, 'returns expected value.' );
405-
t.ok( imag( v ) < TINY, 'returns expected value.' );
398+
v = cinvf( new Complex64( -1.4e-45, 1.4e-45 ) );
399+
t.strictEqual( real( v ), NINF, 'returns expected value' );
400+
t.strictEqual( imag( v ), NINF, 'returns expected value' );
406401

407-
v = cinvf( new Complex64( -FLOAT32_SMALLEST_NORMAL, -FLOAT32_SMALLEST_NORMAL ) ); // eslint-disable-line max-len
408-
t.ok( real( v ) < TINY, 'returns expected value.' );
409-
t.ok( imag( v ) > HUGE, 'returns expected value.' );
402+
v = cinvf( new Complex64( -1.4e-45, -1.4e-45 ) );
403+
t.strictEqual( real( v ), NINF, 'returns expected value' );
404+
t.strictEqual( imag( v ), PINF, 'returns expected value' );
410405

411-
v = cinvf( new Complex64( FLOAT32_SMALLEST_NORMAL, -FLOAT32_SMALLEST_NORMAL ) ); // eslint-disable-line max-len
412-
t.ok( real( v ) > HUGE, 'returns expected value.' );
413-
t.ok( imag( v ) > HUGE, 'returns expected value.' );
406+
v = cinvf( new Complex64( 1.4e-45, -1.4e-45 ) );
407+
t.strictEqual( real( v ), PINF, 'returns expected value' );
408+
t.strictEqual( imag( v ), PINF, 'returns expected value' );
414409

415-
v = cinvf( new Complex64( 0.0, FLOAT32_SMALLEST_NORMAL ) );
416-
t.strictEqual( real( v ), 0.0, 'returns expected value.' );
417-
t.ok( imag( v ) < TINY, 'returns expected value.' );
410+
v = cinvf( new Complex64( 0.0, 1.4e-45 ) );
411+
t.strictEqual( real( v ), 0.0, 'returns expected value' );
412+
t.strictEqual( imag( v ), NINF, 'returns expected value' );
418413

419-
v = cinvf( new Complex64( 0.0, -FLOAT32_SMALLEST_NORMAL ) );
420-
t.strictEqual( real( v ), 0.0, 'returns expected value.' );
421-
t.ok( imag( v ) > HUGE, 'returns expected value.' );
414+
v = cinvf( new Complex64( 0.0, -1.4e-45 ) );
415+
t.strictEqual( real( v ), 0.0, 'returns expected value' );
416+
t.strictEqual( imag( v ), PINF, 'returns expected value' );
422417

423-
v = cinvf( new Complex64( FLOAT32_SMALLEST_NORMAL, 0.0 ) );
424-
t.ok( real( v ) > HUGE, 'returns expected value.' );
425-
t.strictEqual( imag( v ), 0.0, 'returns expected value.' );
418+
v = cinvf( new Complex64( 1.4e-45, 0.0 ) );
419+
t.strictEqual( real( v ), PINF, 'returns expected value' );
420+
t.strictEqual( imag( v ), 0.0, 'returns expected value' );
426421

427-
v = cinvf( new Complex64( -FLOAT32_SMALLEST_NORMAL, 0.0 ) );
428-
t.ok( real( v ) < TINY, 'returns expected value.' );
429-
t.strictEqual( imag( v ), 0.0, 'returns expected value.' );
422+
v = cinvf( new Complex64( -1.4e-45, 0.0 ) );
423+
t.strictEqual( real( v ), NINF, 'returns expected value' );
424+
t.strictEqual( imag( v ), 0.0, 'returns expected value' );
430425

431426
t.end();
432427
});

lib/node_modules/@stdlib/math/base/special/cinvf/test/test.native.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ var tape = require( 'tape' );
2727
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2828
var absf = require( '@stdlib/math/base/special/absf' );
2929
var EPS = require( '@stdlib/constants/float32/eps' );
30-
var FLOAT32_SMALLEST_NORMAL = require( '@stdlib/constants/float32/smallest-normal' );
30+
var PINF = require( '@stdlib/constants/float32/pinf' );
31+
var NINF = require( '@stdlib/constants/float32/ninf' );
3132
var Complex64 = require( '@stdlib/complex/float32/ctor' );
3233
var real = require( '@stdlib/complex/float32/real' );
3334
var imag = require( '@stdlib/complex/float32/imag' );
@@ -40,8 +41,6 @@ var cinvf = tryRequire( resolve( __dirname, './../lib/native.js' ) );
4041
var opts = {
4142
'skip': ( cinvf instanceof Error )
4243
};
43-
var HUGE = 1.0e37;
44-
var TINY = -1.0e37;
4544

4645

4746
// FIXTURES //
@@ -398,40 +397,40 @@ tape( 'the function computes a complex inverse (tiny positive real components)',
398397
t.end();
399398
});
400399

401-
tape( 'the function may produce very large values for very small inputs', opts, function test( t ) {
400+
tape( 'the function may overflow', opts, function test( t ) {
402401
var v;
403402

404-
v = cinvf( new Complex64( FLOAT32_SMALLEST_NORMAL, FLOAT32_SMALLEST_NORMAL ) ); // eslint-disable-line max-len
405-
t.ok( real( v ) > HUGE, 'returns expected value.' );
406-
t.ok( imag( v ) < TINY, 'returns expected value.' );
403+
v = cinvf( new Complex64( 1.4e-45, 1.4e-45 ) );
404+
t.strictEqual( real( v ), PINF, 'returns expected value' );
405+
t.strictEqual( imag( v ), NINF, 'returns expected value' );
407406

408-
v = cinvf( new Complex64( -FLOAT32_SMALLEST_NORMAL, FLOAT32_SMALLEST_NORMAL ) ); // eslint-disable-line max-len
409-
t.ok( real( v ) < TINY, 'returns expected value.' );
410-
t.ok( imag( v ) < TINY, 'returns expected value.' );
407+
v = cinvf( new Complex64( -1.4e-45, 1.4e-45 ) );
408+
t.strictEqual( real( v ), NINF, 'returns expected value' );
409+
t.strictEqual( imag( v ), NINF, 'returns expected value' );
411410

412-
v = cinvf( new Complex64( -FLOAT32_SMALLEST_NORMAL, -FLOAT32_SMALLEST_NORMAL ) ); // eslint-disable-line max-len
413-
t.ok( real( v ) < TINY, 'returns expected value.' );
414-
t.ok( imag( v ) > HUGE, 'returns expected value.' );
411+
v = cinvf( new Complex64( -1.4e-45, -1.4e-45 ) );
412+
t.strictEqual( real( v ), NINF, 'returns expected value' );
413+
t.strictEqual( imag( v ), PINF, 'returns expected value' );
415414

416-
v = cinvf( new Complex64( FLOAT32_SMALLEST_NORMAL, -FLOAT32_SMALLEST_NORMAL ) ); // eslint-disable-line max-len
417-
t.ok( real( v ) > HUGE, 'returns expected value.' );
418-
t.ok( imag( v ) > HUGE, 'returns expected value.' );
415+
v = cinvf( new Complex64( 1.4e-45, -1.4e-45 ) );
416+
t.strictEqual( real( v ), PINF, 'returns expected value' );
417+
t.strictEqual( imag( v ), PINF, 'returns expected value' );
419418

420-
v = cinvf( new Complex64( 0.0, FLOAT32_SMALLEST_NORMAL ) );
421-
t.strictEqual( real( v ), 0.0, 'returns expected value.' );
422-
t.ok( imag( v ) < TINY, 'returns expected value.' );
419+
v = cinvf( new Complex64( 0.0, 1.4e-45 ) );
420+
t.strictEqual( real( v ), 0.0, 'returns expected value' );
421+
t.strictEqual( imag( v ), NINF, 'returns expected value' );
423422

424-
v = cinvf( new Complex64( 0.0, -FLOAT32_SMALLEST_NORMAL ) );
425-
t.strictEqual( real( v ), 0.0, 'returns expected value.' );
426-
t.ok( imag( v ) > HUGE, 'returns expected value.' );
423+
v = cinvf( new Complex64( 0.0, -1.4e-45 ) );
424+
t.strictEqual( real( v ), 0.0, 'returns expected value' );
425+
t.strictEqual( imag( v ), PINF, 'returns expected value' );
427426

428-
v = cinvf( new Complex64( FLOAT32_SMALLEST_NORMAL, 0.0 ) );
429-
t.ok( real( v ) > HUGE, 'returns expected value.' );
430-
t.strictEqual( imag( v ), 0.0, 'returns expected value.' );
427+
v = cinvf( new Complex64( 1.4e-45, 0.0 ) );
428+
t.strictEqual( real( v ), PINF, 'returns expected value' );
429+
t.strictEqual( imag( v ), 0.0, 'returns expected value' );
431430

432-
v = cinvf( new Complex64( -FLOAT32_SMALLEST_NORMAL, 0.0 ) );
433-
t.ok( real( v ) < TINY, 'returns expected value.' );
434-
t.strictEqual( imag( v ), 0.0, 'returns expected value.' );
431+
v = cinvf( new Complex64( -1.4e-45, 0.0 ) );
432+
t.strictEqual( real( v ), NINF, 'returns expected value' );
433+
t.strictEqual( imag( v ), 0.0, 'returns expected value' );
435434

436435
t.end();
437436
});

0 commit comments

Comments
 (0)