diff --git a/lib/node_modules/@stdlib/math/base/special/sinh/test/test.js b/lib/node_modules/@stdlib/math/base/special/sinh/test/test.js index ac0a950fb12a..7ed36172df10 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/sinh/test/test.js @@ -27,8 +27,7 @@ var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var sinh = require( './../lib' ); @@ -51,8 +50,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the hyperbolic sine', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -62,21 +59,13 @@ tape( 'the function computes the hyperbolic sine', function test( t ) { for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic sine (large negative)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -86,21 +75,13 @@ tape( 'the function computes the hyperbolic sine (large negative)', function tes for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( y, expected[ i ], 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic sine (large positive)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -110,21 +91,13 @@ tape( 'the function computes the hyperbolic sine (large positive)', function tes for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic sine (tiny negative)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -134,21 +107,13 @@ tape( 'the function computes the hyperbolic sine (tiny negative)', function test for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( y, expected[ i ], 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic sine (tiny positive)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -158,13 +123,7 @@ tape( 'the function computes the hyperbolic sine (tiny positive)', function test for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( y, expected[ i ], 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/sinh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/sinh/test/test.native.js index fa3edacac969..c7a729084325 100644 --- a/lib/node_modules/@stdlib/math/base/special/sinh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/sinh/test/test.native.js @@ -28,8 +28,7 @@ var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -60,8 +59,6 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'the function computes the hyperbolic sine', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -71,21 +68,13 @@ tape( 'the function computes the hyperbolic sine', opts, function test( t ) { for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic sine (large negative)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -95,21 +84,13 @@ tape( 'the function computes the hyperbolic sine (large negative)', opts, functi for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( y, expected[ i ], 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic sine (large positive)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -119,21 +100,13 @@ tape( 'the function computes the hyperbolic sine (large positive)', opts, functi for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic sine (tiny negative)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -143,21 +116,13 @@ tape( 'the function computes the hyperbolic sine (tiny negative)', opts, functio for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( y, expected[ i ], 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic sine (tiny positive)', opts, function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -167,13 +132,7 @@ tape( 'the function computes the hyperbolic sine (tiny positive)', opts, functio for ( i = 0; i < x.length; i++ ) { y = sinh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. Expected: '+expected[i]+'. Tolerance: '+tol+'.' ); - } + t.strictEqual( y, expected[ i ], 'returns expected value' ); } t.end(); });