diff --git a/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.factory.js index b516ec3dd85d..0fa04ab19bd5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.factory.js @@ -22,10 +22,9 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var factory = require( './../lib/factory.js' ); @@ -153,8 +152,6 @@ tape( 'if `p` is equal to the inflection point `( c - a ) / ( b - a )`, the crea tape( 'the created function evaluates the quantile for `p` given a small range `b - a`', function test( t ) { var expected; var quantile; - var delta; - var tol; var a; var b; var c; @@ -170,13 +167,7 @@ tape( 'the created function evaluates the quantile for `p` given a small range ` for ( i = 0; i < p.length; i++ ) { quantile = factory( a[i], b[i], c[i] ); y = quantile( p[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' ); } t.end(); }); @@ -184,8 +175,6 @@ tape( 'the created function evaluates the quantile for `p` given a small range ` tape( 'the created function evaluates the quantile for `p` given a medium range `b - a`', function test( t ) { var expected; var quantile; - var delta; - var tol; var a; var b; var c; @@ -201,13 +190,7 @@ tape( 'the created function evaluates the quantile for `p` given a medium range for ( i = 0; i < p.length; i++ ) { quantile = factory( a[i], b[i], c[i] ); y = quantile( p[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' ); } t.end(); }); @@ -215,8 +198,6 @@ tape( 'the created function evaluates the quantile for `p` given a medium range tape( 'the created function evaluates the quantile for `p` given a large range `b - a`', function test( t ) { var expected; var quantile; - var delta; - var tol; var a; var b; var c; @@ -232,13 +213,7 @@ tape( 'the created function evaluates the quantile for `p` given a large range ` for ( i = 0; i < p.length; i++ ) { quantile = factory( a[i], b[i], c[i] ); y = quantile( p[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+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/stats/base/dists/triangular/quantile/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.native.js index b288716b540a..9fb14594adcd 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.native.js @@ -24,10 +24,9 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var tryRequire = require( '@stdlib/utils/try-require' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); // FIXTURES // @@ -117,8 +116,6 @@ tape( 'if `p` is equal to the inflection point `( c - a ) / ( b - a )`, the func tape( 'the function evaluates the quantile for `x` given a small range `b - a`', opts, function test( t ) { var expected; - var delta; - var tol; var a; var b; var c; @@ -133,21 +130,13 @@ tape( 'the function evaluates the quantile for `x` given a small range `b - a`', c = smallRange.c; for ( i = 0; i < p.length; i++ ) { y = quantile( p[i], a[i], b[i], c[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+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 quantile for `x` given a medium range `b - a`', opts, function test( t ) { var expected; - var delta; - var tol; var a; var b; var c; @@ -162,21 +151,13 @@ tape( 'the function evaluates the quantile for `x` given a medium range `b - a`' c = mediumRange.c; for ( i = 0; i < p.length; i++ ) { y = quantile( p[i], a[i], b[i], c[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+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 quantile for `x` given a large range `b - a`', opts, function test( t ) { var expected; - var delta; - var tol; var a; var b; var c; @@ -191,13 +172,7 @@ tape( 'the function evaluates the quantile for `x` given a large range `b - a`', c = largeRange.c; for ( i = 0; i < p.length; i++ ) { y = quantile( p[i], a[i], b[i], c[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+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/stats/base/dists/triangular/quantile/test/test.quantile.js b/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.quantile.js index d4fdb053d004..f4ec462a87f0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.quantile.js +++ b/lib/node_modules/@stdlib/stats/base/dists/triangular/quantile/test/test.quantile.js @@ -22,10 +22,9 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var quantile = require( './../lib' ); @@ -108,8 +107,6 @@ tape( 'if `p` is equal to the inflection point `( c - a ) / ( b - a )`, the func tape( 'the function evaluates the quantile for `x` given a small range `b - a`', function test( t ) { var expected; - var delta; - var tol; var a; var b; var c; @@ -124,21 +121,13 @@ tape( 'the function evaluates the quantile for `x` given a small range `b - a`', c = smallRange.c; for ( i = 0; i < p.length; i++ ) { y = quantile( p[i], a[i], b[i], c[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+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 quantile for `x` given a medium range `b - a`', function test( t ) { var expected; - var delta; - var tol; var a; var b; var c; @@ -153,21 +142,13 @@ tape( 'the function evaluates the quantile for `x` given a medium range `b - a`' c = mediumRange.c; for ( i = 0; i < p.length; i++ ) { y = quantile( p[i], a[i], b[i], c[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+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 quantile for `x` given a large range `b - a`', function test( t ) { var expected; - var delta; - var tol; var a; var b; var c; @@ -182,13 +163,7 @@ tape( 'the function evaluates the quantile for `x` given a large range `b - a`', c = largeRange.c; for ( i = 0; i < p.length; i++ ) { y = quantile( p[i], a[i], b[i], c[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'p: '+p[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'returns expected value' ); } t.end(); });