diff --git a/lib/node_modules/@stdlib/simulate/iter/cosine-wave/test/test.js b/lib/node_modules/@stdlib/simulate/iter/cosine-wave/test/test.js index be5ccb5cd171..0ef509910239 100644 --- a/lib/node_modules/@stdlib/simulate/iter/cosine-wave/test/test.js +++ b/lib/node_modules/@stdlib/simulate/iter/cosine-wave/test/test.js @@ -22,10 +22,9 @@ var tape = require( 'tape' ); var proxyquire = require( 'proxyquire' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var iteratorSymbol = require( '@stdlib/symbol/iterator' ); var cospi = require( '@stdlib/math/base/special/cospi' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var iterCosineWave = require( './../lib' ); @@ -100,8 +99,6 @@ tape( 'the function throws an error if provided an invalid option', function tes tape( 'the function returns an iterator protocol-compliant object which generates a cosine wave', function test( t ) { var expected; var actual; - var delta; - var tol; var it; var i; @@ -162,13 +159,7 @@ tape( 'the function returns an iterator protocol-compliant object which generate for ( i = 0; i < expected.length; i++ ) { actual = it.next(); t.strictEqual( actual.done, expected[ i ].done, 'returns expected value' ); - if ( actual.value === expected[ i ].value ) { - t.strictEqual( actual.value, expected[ i ].value, 'returns expected value' ); - } else { - delta = abs( actual.value - expected[ i ].value ); - tol = 1.0 * EPS * abs( expected[ i ].value ); - t.strictEqual( delta <= tol, true, 'within tolerance. i: '+i+'. actual: '+actual.value+'. expected: '+expected[ i ].value+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' ); } t.end(); }); @@ -176,9 +167,7 @@ tape( 'the function returns an iterator protocol-compliant object which generate tape( 'the function supports specifying the waveform period', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var it; var i; @@ -242,13 +231,7 @@ tape( 'the function supports specifying the waveform period', function test( t ) for ( i = 0; i < expected.length; i++ ) { actual = it.next(); t.strictEqual( actual.done, expected[ i ].done, 'returns expected value' ); - if ( actual.value === expected[ i ].value ) { - t.strictEqual( actual.value, expected[ i ].value, 'returns expected value' ); - } else { - delta = abs( actual.value - expected[ i ].value ); - tol = 1.0 * EPS * abs( expected[ i ].value ); - t.strictEqual( delta <= tol, true, 'within tolerance. i: '+i+'. actual: '+actual.value+'. expected: '+expected[ i ].value+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' ); } t.end(); }); @@ -256,9 +239,7 @@ tape( 'the function supports specifying the waveform period', function test( t ) tape( 'the function supports specifying the wave amplitude', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var it; var i; @@ -323,13 +304,7 @@ tape( 'the function supports specifying the wave amplitude', function test( t ) for ( i = 0; i < expected.length; i++ ) { actual = it.next(); t.strictEqual( actual.done, expected[ i ].done, 'returns expected value' ); - if ( actual.value === expected[ i ].value ) { - t.strictEqual( actual.value, expected[ i ].value, 'returns expected value' ); - } else { - delta = abs( actual.value - expected[ i ].value ); - tol = 1.0 * EPS * abs( expected[ i ].value ); - t.strictEqual( delta <= tol, true, 'within tolerance. i: '+i+'. actual: '+actual.value+'. expected: '+expected[ i ].value+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' ); } t.end(); }); @@ -337,9 +312,7 @@ tape( 'the function supports specifying the wave amplitude', function test( t ) tape( 'the function supports specifying the phase offset (left shift)', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var it; var i; @@ -404,13 +377,7 @@ tape( 'the function supports specifying the phase offset (left shift)', function for ( i = 0; i < expected.length; i++ ) { actual = it.next(); t.strictEqual( actual.done, expected[ i ].done, 'returns expected value' ); - if ( actual.value === expected[ i ].value ) { - t.strictEqual( actual.value, expected[ i ].value, 'returns expected value' ); - } else { - delta = abs( actual.value - expected[ i ].value ); - tol = 1.0 * EPS * abs( expected[ i ].value ); - t.strictEqual( delta <= tol, true, 'within tolerance. i: '+i+'. actual: '+actual.value+'. expected: '+expected[ i ].value+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' ); } t.end(); }); @@ -418,9 +385,7 @@ tape( 'the function supports specifying the phase offset (left shift)', function tape( 'the function supports specifying the phase offset (left shift; mod)', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var it; var i; @@ -485,13 +450,7 @@ tape( 'the function supports specifying the phase offset (left shift; mod)', fun for ( i = 0; i < expected.length; i++ ) { actual = it.next(); t.strictEqual( actual.done, expected[ i ].done, 'returns expected value' ); - if ( actual.value === expected[ i ].value ) { - t.strictEqual( actual.value, expected[ i ].value, 'returns expected value' ); - } else { - delta = abs( actual.value - expected[ i ].value ); - tol = 1.0 * EPS * abs( expected[ i ].value ); - t.strictEqual( delta <= tol, true, 'within tolerance. i: '+i+'. actual: '+actual.value+'. expected: '+expected[ i ].value+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' ); } t.end(); }); @@ -499,9 +458,7 @@ tape( 'the function supports specifying the phase offset (left shift; mod)', fun tape( 'the function supports specifying the phase offset (right shift)', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var it; var i; @@ -566,13 +523,7 @@ tape( 'the function supports specifying the phase offset (right shift)', functio for ( i = 0; i < expected.length; i++ ) { actual = it.next(); t.strictEqual( actual.done, expected[ i ].done, 'returns expected value' ); - if ( actual.value === expected[ i ].value ) { - t.strictEqual( actual.value, expected[ i ].value, 'returns expected value' ); - } else { - delta = abs( actual.value - expected[ i ].value ); - tol = 1.0 * EPS * abs( expected[ i ].value ); - t.strictEqual( delta <= tol, true, 'within tolerance. i: '+i+'. actual: '+actual.value+'. expected: '+expected[ i ].value+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' ); } t.end(); }); @@ -580,9 +531,7 @@ tape( 'the function supports specifying the phase offset (right shift)', functio tape( 'the function supports specifying the phase offset (right shift; mod)', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var it; var i; @@ -647,13 +596,7 @@ tape( 'the function supports specifying the phase offset (right shift; mod)', fu for ( i = 0; i < expected.length; i++ ) { actual = it.next(); t.strictEqual( actual.done, expected[ i ].done, 'returns expected value' ); - if ( actual.value === expected[ i ].value ) { - t.strictEqual( actual.value, expected[ i ].value, 'returns expected value' ); - } else { - delta = abs( actual.value - expected[ i ].value ); - tol = 1.0 * EPS * abs( expected[ i ].value ); - t.strictEqual( delta <= tol, true, 'within tolerance. i: '+i+'. actual: '+actual.value+'. expected: '+expected[ i ].value+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual.value, expected[ i ].value, 0 ), true, 'returns expected value' ); } t.end(); });