diff --git a/lib/node_modules/@stdlib/simulate/iter/triangle-wave/test/test.js b/lib/node_modules/@stdlib/simulate/iter/triangle-wave/test/test.js index 462c364b61c6..6514292f6897 100644 --- a/lib/node_modules/@stdlib/simulate/iter/triangle-wave/test/test.js +++ b/lib/node_modules/@stdlib/simulate/iter/triangle-wave/test/test.js @@ -22,11 +22,10 @@ var tape = require( 'tape' ); var proxyquire = require( 'proxyquire' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var iteratorSymbol = require( '@stdlib/symbol/iterator' ); var sinpi = require( '@stdlib/math/base/special/sinpi' ); var asin = require( '@stdlib/math/base/special/asin' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var HALF_PI = require( '@stdlib/constants/float64/half-pi' ); var iterTriangleWave = require( './../lib' ); @@ -102,8 +101,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 triangle wave', function test( t ) { var expected; var actual; - var delta; - var tol; var it; var i; @@ -164,13 +161,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(); }); @@ -178,9 +169,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; @@ -244,13 +233,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(); }); @@ -258,9 +241,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; @@ -325,13 +306,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(); }); @@ -339,9 +314,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; @@ -406,13 +379,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(); }); @@ -420,9 +387,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; @@ -487,13 +452,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(); }); @@ -501,9 +460,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; @@ -568,13 +525,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(); }); @@ -582,9 +533,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; @@ -649,13 +598,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(); }); @@ -663,9 +606,7 @@ tape( 'the function supports specifying the phase offset (right shift; mod)', fu tape( 'the function supports limiting the number of iterations', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var it; var i; @@ -701,13 +642,7 @@ tape( 'the function supports limiting the number of iterations', function test( 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(); });