diff --git a/lib/node_modules/@stdlib/simulate/iter/bartlett-pulse/test/test.js b/lib/node_modules/@stdlib/simulate/iter/bartlett-pulse/test/test.js index e0b30a9efe6d..f92cf4650a51 100644 --- a/lib/node_modules/@stdlib/simulate/iter/bartlett-pulse/test/test.js +++ b/lib/node_modules/@stdlib/simulate/iter/bartlett-pulse/test/test.js @@ -22,9 +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 abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var iterBartlettPulse = require( './../lib' ); @@ -158,8 +158,6 @@ tape( 'the function throws an error if provided a pulse duration which is less t tape( 'the function returns an iterator protocol-compliant object which generates a "Bartlett" pulse waveform', function test( t ) { var expected; var actual; - var delta; - var tol; var phi; var tau; var it; @@ -188,13 +186,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(); }); @@ -202,9 +194,7 @@ tape( 'the function returns an iterator protocol-compliant object which generate tape( 'the function supports specifying the pulse period', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var phi; var tau; var it; @@ -236,13 +226,7 @@ tape( 'the function supports specifying the pulse 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(); }); @@ -250,9 +234,7 @@ tape( 'the function supports specifying the pulse period', function test( t ) { tape( 'the function supports specifying the pulse duration', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var phi; var tau; var it; @@ -292,13 +274,7 @@ tape( 'the function supports specifying the pulse duration', 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(); }); @@ -306,9 +282,7 @@ tape( 'the function supports specifying the pulse duration', function test( t ) tape( 'the function supports specifying the waveform amplitude', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var phi; var tau; var it; @@ -349,13 +323,7 @@ tape( 'the function supports specifying the waveform amplitude', 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(); }); @@ -363,9 +331,7 @@ tape( 'the function supports specifying the waveform amplitude', function test( tape( 'the function supports specifying the phase offset (left shift)', function test( t ) { var expected; var actual; - var delta; var opts; - var tol; var phi; var tau; var it; @@ -406,13 +372,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 +380,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 phi; var tau; var it; @@ -466,13 +424,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(); }); @@ -480,9 +432,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 phi; var tau; var it; @@ -526,13 +476,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(); }); @@ -540,9 +484,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 phi; var tau; var it; @@ -586,13 +528,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(); }); @@ -600,9 +536,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 tau; var it; var A; @@ -631,13 +565,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' ); } actual = it.next(); t.strictEqual( actual.value, void 0, 'returns expected value' );