Skip to content
Draft
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
33 changes: 4 additions & 29 deletions lib/node_modules/@stdlib/math/base/special/logit/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 logit = require( './../lib' );


Expand Down Expand Up @@ -72,8 +71,6 @@ tape( 'the function returns `+Infinity` when provided `1`', function test( t ) {

tape( 'the function evaluates the logit of `x` for the interval `(0,0.25]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -82,21 +79,13 @@ tape( 'the function evaluates the logit of `x` for the interval `(0,0.25]`', fun
x = small.x;
for ( i = 0; i < x.length; i++ ) {
y = logit( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the logit of `x` for the interval `[0.25,0.75]`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -105,21 +94,13 @@ tape( 'the function evaluates the logit of `x` for the interval `[0.25,0.75]`',
x = medium.x;
for ( i = 0; i < x.length; i++ ) {
y = logit( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the logit of `x` for the interval `[0.75,1)`', function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -128,13 +109,7 @@ tape( 'the function evaluates the logit of `x` for the interval `[0.75,1)`', fun
x = large.x;
for ( i = 0; i < x.length; i++ ) {
y = logit( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});
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 tryRequire = require( '@stdlib/utils/try-require' );


Expand Down Expand Up @@ -81,8 +80,6 @@ tape( 'the function returns `+Infinity` when provided `1`', opts, function test(

tape( 'the function evaluates the logit of `x` for the interval `(0,0.25]`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -91,21 +88,13 @@ tape( 'the function evaluates the logit of `x` for the interval `(0,0.25]`', opt
x = small.x;
for ( i = 0; i < x.length; i++ ) {
y = logit( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the logit of `x` for the interval `[0.25,0.75]`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -114,21 +103,13 @@ tape( 'the function evaluates the logit of `x` for the interval `[0.25,0.75]`',
x = medium.x;
for ( i = 0; i < x.length; i++ ) {
y = logit( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function evaluates the logit of `x` for the interval `[0.75,1)`', opts, function test( t ) {
var expected;
var delta;
var tol;
var x;
var y;
var i;
Expand All @@ -137,13 +118,7 @@ tape( 'the function evaluates the logit of `x` for the interval `[0.75,1)`', opt
x = large.x;
for ( i = 0; i < x.length; i++ ) {
y = logit( x[i] );
if ( y === expected[i] ) {
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
} else {
delta = abs( y - expected[i] );
tol = EPS * abs( expected[i] );
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. v: '+y+'. E: '+expected[i]+' Δ: '+delta+'. tol: '+tol );
}
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
}
t.end();
});