diff --git a/lib/node_modules/@stdlib/stats/chi2gof/test/test.js b/lib/node_modules/@stdlib/stats/chi2gof/test/test.js index d41c9a2a644b..7da19af3d586 100644 --- a/lib/node_modules/@stdlib/stats/chi2gof/test/test.js +++ b/lib/node_modules/@stdlib/stats/chi2gof/test/test.js @@ -23,8 +23,7 @@ var tape = require( 'tape' ); var contains = require( '@stdlib/assert/contains' ); var poisson = require( '@stdlib/random/base/poisson' ).factory; -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var zeros = require( '@stdlib/array/base/zeros' ); var chi2gof = require( './../lib' ); @@ -242,8 +241,6 @@ tape( 'the function throws an error if provided a significance level `alpha` out tape( 'the function correctly computes the chi-square goodness of fit test (when `y` is array of probabilities)', function test( t ) { var expected; - var delta; - var tol; var out; var x; var p; @@ -254,23 +251,17 @@ tape( 'the function correctly computes the chi-square goodness of fit test (when // Tested against R: expected = probs.pValue; - delta = abs( out.pValue - expected ); - tol = 4.0 * EPS * abs( expected ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. p: '+p+'. pValue: '+out.pValue+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValue( out.pValue, expected, 4 ), true, 'returns expected value' ); expected = probs.statistic; - delta = abs( out.statistic - expected ); - tol = 2.0 * EPS * abs( expected ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. p: '+p+'. statistic: '+out.statistic+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValue( out.statistic, expected, 2 ), true, 'returns expected value' ); t.end(); }); tape( 'the function correctly computes the chi-square goodness of fit test (when `y` is array of expected counts)', function test( t ) { var expected; - var delta; var out; - var tol; var x; var y; @@ -280,14 +271,10 @@ tape( 'the function correctly computes the chi-square goodness of fit test (when // Tested against R: expected = counts.pValue; - delta = abs( out.pValue - expected ); - tol = 4.0 * EPS * abs( expected ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. y: '+y+'. pValue: '+out.pValue+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValue( out.pValue, expected, 4 ), true, 'returns expected value' ); expected = counts.statistic; - delta = abs( out.statistic - expected ); - tol = 2.0 * EPS * abs( expected ); - t.ok( delta <= tol, 'within tolerance. x: '+x+'. y: '+y+'. statistic: '+out.statistic+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValue( out.statistic, expected, 2 ), true, 'returns expected value' ); t.end(); });