diff --git a/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.cdf.js b/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.cdf.js index 448c67e259c6..0062bf47f5e3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.cdf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.cdf.js @@ -21,11 +21,10 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var cdf = require( './../lib' ); @@ -88,8 +87,6 @@ tape( 'if provided `a > b`, the function returns `NaN`', function test( t ) { tape( 'the function evaluates the cdf for `x` given a small range `b - a`', function test( t ) { var expected; - var delta; - var tol; var x; var a; var b; @@ -102,21 +99,13 @@ tape( 'the function evaluates the cdf for `x` given a small range `b - a`', func b = smallRange.b; for ( i = 0; i < x.length; i++ ) { y = cdf( x[i], a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[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 cdf for `x` given a medium range `b - a`', function test( t ) { var expected; - var delta; - var tol; var x; var a; var b; @@ -129,21 +118,13 @@ tape( 'the function evaluates the cdf for `x` given a medium range `b - a`', fun b = mediumRange.b; for ( i = 0; i < x.length; i++ ) { y = cdf( x[i], a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[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 cdf for `x` given a large range `b - a`', function test( t ) { var expected; - var delta; - var tol; var x; var a; var b; @@ -156,13 +137,7 @@ tape( 'the function evaluates the cdf for `x` given a large range `b - a`', func b = largeRange.b; for ( i = 0; i < x.length; i++ ) { y = cdf( x[i], a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[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/discrete-uniform/cdf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.factory.js index 964403308b97..b936a742bf01 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.factory.js @@ -21,11 +21,10 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); 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' ); @@ -136,9 +135,7 @@ tape( 'if provided a `a > b`, the created function always returns `NaN`', functi tape( 'the created function evaluates the cdf for `x` given a small range `b - a`', function test( t ) { var expected; - var delta; var cdf; - var tol; var a; var b; var i; @@ -152,22 +149,14 @@ tape( 'the created function evaluates the cdf for `x` given a small range `b - a for ( i = 0; i < x.length; i++ ) { cdf = factory( a[i], b[i] ); y = cdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the created function evaluates the cdf for `x` given a medium range `b - a`', function test( t ) { var expected; - var delta; var cdf; - var tol; var a; var b; var i; @@ -181,22 +170,14 @@ tape( 'the created function evaluates the cdf for `x` given a medium range `b - for ( i = 0; i < x.length; i++ ) { cdf = factory( a[i], b[i] ); y = cdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the created function evaluates the cdf for `x` given a large range `b - a`', function test( t ) { var expected; - var delta; var cdf; - var tol; var a; var b; var i; @@ -210,13 +191,7 @@ tape( 'the created function evaluates the cdf for `x` given a large range `b - a for ( i = 0; i < x.length; i++ ) { cdf = factory( a[i], b[i] ); y = cdf( x[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[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/discrete-uniform/cdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.native.js index 3235895f449b..b8cfc6acae94 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/cdf/test/test.native.js @@ -22,11 +22,10 @@ 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 abs = require( '@stdlib/math/base/special/abs' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -79,8 +78,6 @@ tape( 'if provided `a > b`, the function returns `NaN`', opts, function test( t tape( 'the function evaluates the cdf for `x` given a small range `b - a`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var a; var b; @@ -93,21 +90,13 @@ tape( 'the function evaluates the cdf for `x` given a small range `b - a`', opts b = smallRange.b; for ( i = 0; i < x.length; i++ ) { y = cdf( x[i], a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[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 cdf for `x` given a medium range `b - a`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var a; var b; @@ -120,21 +109,13 @@ tape( 'the function evaluates the cdf for `x` given a medium range `b - a`', opt b = mediumRange.b; for ( i = 0; i < x.length; i++ ) { y = cdf( x[i], a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[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 cdf for `x` given a large range `b - a`', opts, function test( t ) { var expected; - var delta; - var tol; var x; var a; var b; @@ -147,13 +128,7 @@ tape( 'the function evaluates the cdf for `x` given a large range `b - a`', opts b = largeRange.b; for ( i = 0; i < x.length; i++ ) { y = cdf( x[i], a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[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. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); });