Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions lib/node_modules/@stdlib/math/base/special/csignum/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
// MODULES //

var tape = require( 'tape' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
Expand All @@ -48,10 +47,8 @@ tape( 'main export is a function', function test( t ) {
});

tape( 'the function evaluates the signum function', function test( t ) {
var delta;
var ere;
var eim;
var tol;
var re;
var im;
var y;
Expand All @@ -64,18 +61,8 @@ tape( 'the function evaluates the signum function', function test( t ) {

for ( i = 0; i < re.length; i++ ) {
y = csignum( new Complex128( re[ i ], im[ i ] ) );
if ( real( y ) === ere[ i ] && imag( y ) === eim[ i ] ) {
t.strictEqual( real( y ), ere[ i ], 're: '+re[ i ]+'. Expected: '+ere[ i ] );
t.strictEqual( imag( y ), eim[ i ], 'im: '+im[ i ]+'. Expected: '+eim[ i ] );
} else {
delta = abs( real( y ) - ere[ i ] );
tol = EPS * abs( ere[ i ] );
t.ok( delta <= tol, 'within tolerance. re: '+re[ i ]+'. im: '+im[ i ]+'. Actual re: '+real( y )+'. Expected re: '+ere[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );

delta = abs( imag( y ) - eim[ i ] );
tol = EPS * abs( eim[ i ] );
t.ok( delta <= tol, 'within tolerance. re: '+re[ i ]+'. im: '+im[ i ]+'. Actual im: '+imag( y )+'. Expected im: '+eim[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( real( y ), ere[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( imag( y ), eim[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@

var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
Expand Down Expand Up @@ -57,10 +56,8 @@ tape( 'main export is a function', opts, function test( t ) {
});

tape( 'the function evaluates the signum function', opts, function test( t ) {
var delta;
var ere;
var eim;
var tol;
var re;
var im;
var y;
Expand All @@ -73,18 +70,8 @@ tape( 'the function evaluates the signum function', opts, function test( t ) {

for ( i = 0; i < re.length; i++ ) {
y = csignum( new Complex128( re[ i ], im[ i ] ) );
if ( real( y ) === ere[ i ] && imag( y ) === eim[ i ] ) {
t.strictEqual( real( y ), ere[ i ], 're: '+re[ i ]+'. Expected: '+ere[ i ] );
t.strictEqual( imag( y ), eim[ i ], 'im: '+im[ i ]+'. Expected: '+eim[ i ] );
} else {
delta = abs( real( y ) - ere[ i ] );
tol = EPS * abs( ere[ i ] );
t.ok( delta <= tol, 'within tolerance. re: '+re[ i ]+'. im: '+im[ i ]+'. Actual re: '+real( y )+'. Expected re: '+ere[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );

delta = abs( imag( y ) - eim[ i ] );
tol = EPS * abs( eim[ i ] );
t.ok( delta <= tol, 'within tolerance. re: '+re[ i ]+'. im: '+im[ i ]+'. Actual im: '+imag( y )+'. Expected im: '+eim[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( real( y ), ere[ i ], 0 ), true, 'returns expected value' );
t.strictEqual( isAlmostSameValue( imag( y ), eim[ i ], 0 ), true, 'returns expected value' );
}
t.end();
});
Expand Down