diff --git a/lib/node_modules/@stdlib/math/base/special/logit/test/test.js b/lib/node_modules/@stdlib/math/base/special/logit/test/test.js index 24a6974fb823..5472ce779c2a 100644 --- a/lib/node_modules/@stdlib/math/base/special/logit/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/logit/test/test.js @@ -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' ); @@ -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; @@ -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; @@ -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; @@ -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(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/logit/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/logit/test/test.native.js index 6b038dfca35b..d387547b339e 100644 --- a/lib/node_modules/@stdlib/math/base/special/logit/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/logit/test/test.native.js @@ -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' ); @@ -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; @@ -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; @@ -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; @@ -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(); });