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
43 changes: 5 additions & 38 deletions lib/node_modules/@stdlib/math/base/special/fresnels/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ var tape = require( 'tape' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var randu = require( '@stdlib/random/base/randu' );
var fresnels = require( './../lib' );

Expand All @@ -47,8 +46,6 @@ tape( 'main export is a function', function test( t ) {
});

tape( 'the function computes the S(x) term of the Fresnel integral (small positive values)', function test( t ) {
var delta;
var tol;
var S;
var x;
var y;
Expand All @@ -59,20 +56,12 @@ tape( 'the function computes the S(x) term of the Fresnel integral (small positi

for ( i = 0; i < x.length; i++ ) {
y = fresnels( x[i] );
if ( y === S[ i ] ) {
t.strictEqual( y, S[ i ], 'x: '+x[i]+'. Expected: '+S[i] );
} else {
delta = abs( y - S[i] );
tol = 4.0 * EPS * abs( S[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+S[i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, S[ i ], 4 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the S(x) term of the Fresnel integral (medium positive values)', function test( t ) {
var delta;
var tol;
var S;
var x;
var y;
Expand All @@ -83,20 +72,12 @@ tape( 'the function computes the S(x) term of the Fresnel integral (medium posit

for ( i = 0; i < x.length; i++ ) {
y = fresnels( x[i] );
if ( y === S[ i ] ) {
t.strictEqual( y, S[ i ], 'x: '+x[i]+'. Expected: '+S[i] );
} else {
delta = abs( y - S[i] );
tol = 1.5 * EPS * abs( S[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+S[i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, S[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the S(x) term of the Fresnel integral (large positive values)', function test( t ) {
var delta;
var tol;
var S;
var x;
var y;
Expand All @@ -107,20 +88,12 @@ tape( 'the function computes the S(x) term of the Fresnel integral (large positi

for ( i = 0; i < x.length; i++ ) {
y = fresnels( x[i] );
if ( y === S[ i ] ) {
t.strictEqual( y, S[ i ], 'x: '+x[i]+'. Expected: '+S[i] );
} else {
delta = abs( y - S[i] );
tol = 1.5 * EPS * abs( S[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+S[i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, S[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the S(x) term of the Fresnel integral (very large positive values)', function test( t ) {
var delta;
var tol;
var S;
var x;
var y;
Expand All @@ -131,13 +104,7 @@ tape( 'the function computes the S(x) term of the Fresnel integral (very large p

for ( i = 0; i < x.length; i++ ) {
y = fresnels( x[i] );
if ( y === S[ i ] ) {
t.strictEqual( y, S[ i ], 'x: '+x[i]+'. Expected: '+S[i] );
} else {
delta = abs( y - S[i] );
tol = 1.5 * EPS * abs( S[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+S[i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, S[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ var tape = require( 'tape' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var randu = require( '@stdlib/random/base/randu' );
var tryRequire = require( '@stdlib/utils/try-require' );

Expand Down Expand Up @@ -56,8 +55,6 @@ tape( 'main export is a function', opts, function test( t ) {
});

tape( 'the function computes the S(x) term of the Fresnel integral (small positive values)', opts, function test( t ) {
var delta;
var tol;
var S;
var x;
var y;
Expand All @@ -68,20 +65,12 @@ tape( 'the function computes the S(x) term of the Fresnel integral (small positi

for ( i = 0; i < x.length; i++ ) {
y = fresnels( x[i] );
if ( y === S[ i ] ) {
t.strictEqual( y, S[ i ], 'x: '+x[i]+'. Expected: '+S[i] );
} else {
delta = abs( y - S[i] );
tol = 4.0 * EPS * abs( S[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+S[i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, S[ i ], 4 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the S(x) term of the Fresnel integral (medium positive values)', opts, function test( t ) {
var delta;
var tol;
var S;
var x;
var y;
Expand All @@ -92,20 +81,12 @@ tape( 'the function computes the S(x) term of the Fresnel integral (medium posit

for ( i = 0; i < x.length; i++ ) {
y = fresnels( x[i] );
if ( y === S[ i ] ) {
t.strictEqual( y, S[ i ], 'x: '+x[i]+'. Expected: '+S[i] );
} else {
delta = abs( y - S[i] );
tol = 1.5 * EPS * abs( S[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+S[i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, S[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the S(x) term of the Fresnel integral (large positive values)', opts, function test( t ) {
var delta;
var tol;
var S;
var x;
var y;
Expand All @@ -116,20 +97,12 @@ tape( 'the function computes the S(x) term of the Fresnel integral (large positi

for ( i = 0; i < x.length; i++ ) {
y = fresnels( x[i] );
if ( y === S[ i ] ) {
t.strictEqual( y, S[ i ], 'x: '+x[i]+'. Expected: '+S[i] );
} else {
delta = abs( y - S[i] );
tol = 1.5 * EPS * abs( S[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+S[i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, S[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function computes the S(x) term of the Fresnel integral (very large positive values)', opts, function test( t ) {
var delta;
var tol;
var S;
var x;
var y;
Expand All @@ -140,13 +113,7 @@ tape( 'the function computes the S(x) term of the Fresnel integral (very large p

for ( i = 0; i < x.length; i++ ) {
y = fresnels( x[i] );
if ( y === S[ i ] ) {
t.strictEqual( y, S[ i ], 'x: '+x[i]+'. Expected: '+S[i] );
} else {
delta = abs( y - S[i] );
tol = 1.5 * EPS * abs( S[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+S[i]+'. tol: '+tol+'. delta: '+delta+'.' );
}
t.strictEqual( isAlmostSameValue( y, S[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
Expand Down