diff --git a/lib/node_modules/@stdlib/stats/incr/nanmcv/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanmcv/test/test.js index 122963bc347a..9b07a7464cf4 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanmcv/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/nanmcv/test/test.js @@ -22,8 +22,7 @@ var tape = require( 'tape' ); var randu = require( '@stdlib/random/base/randu' ); -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 sqrt = require( '@stdlib/math/base/special/sqrt' ); var zeros = require( '@stdlib/array/base/zeros' ); var incrnanmcv = require( './../lib' ); @@ -196,9 +195,7 @@ tape( 'the accumulator function computes a moving coefficient of variation incre tape( 'if not provided an input value, the accumulator function returns the current accumulated value', function test( t ) { var expected; var actual; - var delta; var data; - var tol; var acc; var i; @@ -213,19 +210,15 @@ tape( 'if not provided an input value, the accumulator function returns the curr expected = sqrt( 19.0 )/5.0; actual = acc(); - delta = abs( actual - expected ); - tol = EPS * expected; - t.strictEqual( delta < tol, true, 'expected: '+expected+'. actual: '+actual+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 0 ), true, 'returns expected value' ); t.end(); }); tape( 'if not provided an input value, the accumulator function returns the current accumulated value (known mean)', function test( t ) { var expected; var actual; - var delta; var data; - var tol; var acc; var i; @@ -240,10 +233,8 @@ tape( 'if not provided an input value, the accumulator function returns the curr expected = sqrt( 12.666666666666666 )/5.0; actual = acc(); - delta = abs( actual - expected ); - tol = EPS * expected; - t.strictEqual( delta < tol, true, 'expected: '+expected+'. actual: '+actual+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 0 ), true, 'returns expected value' ); t.end(); }); @@ -302,10 +293,8 @@ tape( 'if the window size is `1` and the mean is known, the accumulator function tape( 'if provided `NaN`, the value is ignored (unknown mean)', function test( t ) { var expected; var actual; - var delta; var data; var acc; - var tol; var i; acc = incrnanmcv( 3 ); @@ -360,9 +349,7 @@ tape( 'if provided `NaN`, the value is ignored (unknown mean)', function test( t t.strictEqual( actual, null, 'returns expected value for window '+i ); t.strictEqual( acc(), null, 'returns expected value for window '+i ); } else { - delta = abs( actual - expected[ i ] ); - tol = EPS * expected[ i ]; - t.strictEqual( delta <= tol, true, 'expected: '+expected[i]+'. actual: '+actual+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 0 ), true, 'returns expected value for window '+i ); t.strictEqual( acc(), actual, 'returns expected value for window '+i ); } } @@ -372,10 +359,8 @@ tape( 'if provided `NaN`, the value is ignored (unknown mean)', function test( t tape( 'if provided `NaN`, the value is ignored (known mean)', function test( t ) { var expected; var actual; - var delta; var data; var acc; - var tol; var i; acc = incrnanmcv( 3, 3.14 ); @@ -430,9 +415,7 @@ tape( 'if provided `NaN`, the value is ignored (known mean)', function test( t ) t.strictEqual( actual, null, 'returns expected value for window '+i ); t.strictEqual( acc(), null, 'returns expected value for window '+i ); } else { - delta = abs( actual - expected[ i ] ); - tol = EPS * expected[ i ]; - t.strictEqual( delta <= tol, true, 'expected: '+expected[i]+'. actual: '+actual+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 0 ), true, 'returns expected value for window '+i ); t.strictEqual( acc(), actual, 'returns expected value for window '+i ); } } @@ -508,10 +491,8 @@ tape( 'if provided `NaN`, the value is ignored (unknown mean, W=1)', function te tape( 'if provided `NaN`, the value is ignored (known mean, W=1)', function test( t ) { var expected; var actual; - var delta; var data; var acc; - var tol; var i; acc = incrnanmcv( 1, 3.14 ); @@ -566,9 +547,7 @@ tape( 'if provided `NaN`, the value is ignored (known mean, W=1)', function test t.strictEqual( actual, null, 'returns expected value for window '+i ); t.strictEqual( acc(), null, 'returns expected value for window '+i ); } else { - delta = abs( actual - expected[ i ] ); - tol = EPS * expected[ i ]; - t.strictEqual( delta <= tol, true, 'expected: '+expected[i]+'. actual: '+actual+'. tol: '+tol+'. delta: '+delta+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected[ i ], 0 ), true, 'returns expected value for window '+i ); t.strictEqual( acc(), actual, 'returns expected value for window '+i ); } }