From f12759c954c190fddb331b873b0acb9ce1ddda68 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 3 Apr 2026 21:53:19 +0530 Subject: [PATCH 1/3] test: migrate to ULP base testing --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/cosh/test/test.js | 33 ++---------- .../base/special/cosh/test/test.native.js | 51 +++++++------------ 2 files changed, 23 insertions(+), 61 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.js b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.js index 5c4ea7d5ab3b..308daea12051 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.js @@ -24,8 +24,7 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); 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 cosh = require( './../lib' ); @@ -46,8 +45,6 @@ tape( 'main export is a function', function test( t ) { tape( 'the function computes the hyperbolic cosine', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -57,21 +54,13 @@ tape( 'the function computes the hyperbolic cosine', function test( t ) { for ( i = 0; i < x.length; i++ ) { y = cosh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic cosine (tiny values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -81,21 +70,13 @@ tape( 'the function computes the hyperbolic cosine (tiny values)', function test for ( i = 0; i < x.length; i++ ) { y = cosh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); tape( 'the function computes the hyperbolic cosine (large values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -105,13 +86,7 @@ tape( 'the function computes the hyperbolic cosine (large values)', function tes for ( i = 0; i < x.length; i++ ) { y = cosh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js index 8debda0decde..be74d907c08f 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js @@ -25,8 +25,7 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); 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' ); @@ -53,10 +52,8 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); -tape( 'the function computes the hyperbolic cosine', opts, function test( t ) { +tape( 'the function computes the hyperbolic cosine', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -66,21 +63,13 @@ tape( 'the function computes the hyperbolic cosine', opts, function test( t ) { for ( i = 0; i < x.length; i++ ) { y = cosh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); -tape( 'the function computes the hyperbolic cosine (tiny values)', opts, function test( t ) { +tape( 'the function computes the hyperbolic cosine (tiny values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -90,21 +79,13 @@ tape( 'the function computes the hyperbolic cosine (tiny values)', opts, functio for ( i = 0; i < x.length; i++ ) { y = cosh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); -tape( 'the function computes the hyperbolic cosine (large values)', opts, function test( t ) { +tape( 'the function computes the hyperbolic cosine (large values)', function test( t ) { var expected; - var delta; - var tol; var x; var y; var i; @@ -114,17 +95,23 @@ tape( 'the function computes the hyperbolic cosine (large values)', opts, functi for ( i = 0; i < x.length; i++ ) { y = cosh( x[i] ); - if ( y === expected[ i ] ) { - t.strictEqual( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. Value: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); +tape( 'the function returns `1` if provided `+-0`', function test( t ) { + var v; + + v = cosh( -0.0 ); + t.strictEqual( v, 1.0, 'returns expected value' ); + + v = cosh( +0.0 ); + t.strictEqual( v, 1.0, 'returns expected value' ); + + t.end(); +}); + tape( 'the function returns `1` if provided `+-0`', opts, function test( t ) { var v; From 1b7dbbb8d6c56ecce57f01db05eee702c2eaa014 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 3 Apr 2026 22:21:21 +0530 Subject: [PATCH 2/3] test: migrate `math/base/special/cosh` to ULP base testing --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/cosh/test/test.native.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js index be74d907c08f..ae5d259d7be0 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js @@ -52,7 +52,7 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); -tape( 'the function computes the hyperbolic cosine', function test( t ) { +tape( 'the function computes the hyperbolic cosine', opts, function test( t ) { var expected; var x; var y; @@ -68,7 +68,7 @@ tape( 'the function computes the hyperbolic cosine', function test( t ) { t.end(); }); -tape( 'the function computes the hyperbolic cosine (tiny values)', function test( t ) { +tape( 'the function computes the hyperbolic cosine (tiny values)', opts, function test( t ) { var expected; var x; var y; @@ -84,7 +84,7 @@ tape( 'the function computes the hyperbolic cosine (tiny values)', function test t.end(); }); -tape( 'the function computes the hyperbolic cosine (large values)', function test( t ) { +tape( 'the function computes the hyperbolic cosine (large values)', opts, function test( t ) { var expected; var x; var y; From 57c5686162537b8cbd2662bbab7429acf6ebd199 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 3 Apr 2026 22:25:43 +0530 Subject: [PATCH 3/3] remove duplicate test Signed-off-by: Shubham --- .../math/base/special/cosh/test/test.native.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js index ae5d259d7be0..c84d74dfc19c 100644 --- a/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cosh/test/test.native.js @@ -100,18 +100,6 @@ tape( 'the function computes the hyperbolic cosine (large values)', opts, functi t.end(); }); -tape( 'the function returns `1` if provided `+-0`', function test( t ) { - var v; - - v = cosh( -0.0 ); - t.strictEqual( v, 1.0, 'returns expected value' ); - - v = cosh( +0.0 ); - t.strictEqual( v, 1.0, 'returns expected value' ); - - t.end(); -}); - tape( 'the function returns `1` if provided `+-0`', opts, function test( t ) { var v;