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
21 changes: 4 additions & 17 deletions lib/node_modules/@stdlib/math/base/special/cphase/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
// MODULES //

var tape = require( 'tape' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
var abs = require( '@stdlib/math/base/special/abs' );
var EPS = require( '@stdlib/constants/float64/eps' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var PI = require( '@stdlib/constants/float64/pi' );
Expand Down Expand Up @@ -161,8 +160,6 @@ tape( 'the function returns `-PI/2` if provided a negative `im` and `re=0`', fun
tape( 'the function computes the argument of a complex number (when `re` and `im` are positive)', function test( t ) {
var expected;
var actual;
var delta;
var tol;
var re;
var im;
var i;
Expand All @@ -172,18 +169,14 @@ tape( 'the function computes the argument of a complex number (when `re` and `im
expected = positivePositive.expected;
for ( i = 0; i < re.length; i++ ) {
actual = cphase( new Complex128( re[i], im[i] ) );
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
t.strictEqual( isAlmostSameValue( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the argument of a complex number (when `re` is negative and `im` is positive)', function test( t ) {
var expected;
var actual;
var delta;
var tol;
var re;
var im;
var i;
Expand All @@ -193,18 +186,14 @@ tape( 'the function computes the argument of a complex number (when `re` is nega
expected = negativePositive.expected;
for ( i = 0; i < re.length; i++ ) {
actual = cphase( new Complex128( re[i], im[i] ) );
delta = abs( actual - expected[i] );
tol = 2.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
t.strictEqual( isAlmostSameValue( actual, expected[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the argument of a complex number (when `re` and `im` are negative)', function test( t ) {
var expected;
var actual;
var delta;
var tol;
var re;
var im;
var i;
Expand All @@ -214,9 +203,7 @@ tape( 'the function computes the argument of a complex number (when `re` and `im
expected = negativeNegative.expected;
for ( i = 0; i < re.length; i++ ) {
actual = cphase( new Complex128( re[i], im[i] ) );
delta = abs( actual - expected[i] );
tol = 2.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
t.strictEqual( isAlmostSameValue( actual, expected[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@

var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
var abs = require( '@stdlib/math/base/special/abs' );
var EPS = require( '@stdlib/constants/float64/eps' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var PI = require( '@stdlib/constants/float64/pi' );
Expand Down Expand Up @@ -170,8 +169,6 @@ tape( 'the function returns `-PI/2` if provided a negative `im` and `re=0`', opt
tape( 'the function computes the argument of a complex number (when `re` and `im` are positive)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var re;
var im;
var i;
Expand All @@ -181,18 +178,14 @@ tape( 'the function computes the argument of a complex number (when `re` and `im
expected = positivePositive.expected;
for ( i = 0; i < re.length; i++ ) {
actual = cphase( new Complex128( re[i], im[i] ) );
delta = abs( actual - expected[i] );
tol = EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
t.strictEqual( isAlmostSameValue( actual, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the argument of a complex number (when `re` is negative and `im` is positive)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var re;
var im;
var i;
Expand All @@ -202,18 +195,14 @@ tape( 'the function computes the argument of a complex number (when `re` is nega
expected = negativePositive.expected;
for ( i = 0; i < re.length; i++ ) {
actual = cphase( new Complex128( re[i], im[i] ) );
delta = abs( actual - expected[i] );
tol = 2.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
t.strictEqual( isAlmostSameValue( actual, expected[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the argument of a complex number (when `re` and `im` are negative)', opts, function test( t ) {
var expected;
var actual;
var delta;
var tol;
var re;
var im;
var i;
Expand All @@ -223,9 +212,7 @@ tape( 'the function computes the argument of a complex number (when `re` and `im
expected = negativeNegative.expected;
for ( i = 0; i < re.length; i++ ) {
actual = cphase( new Complex128( re[i], im[i] ) );
delta = abs( actual - expected[i] );
tol = 2.0 * EPS * abs( expected[i] );
t.strictEqual( delta <= tol, true, 'within tolerance. re: '+re[i]+'. im: '+im[i]+'. Actual: '+actual+'. Expected: '+expected[i]+'. tol: '+tol+'. delta: '+delta+'.' );
t.strictEqual( isAlmostSameValue( actual, expected[ i ], 2 ), true, 'returns expected value' );
}
t.end();
});