From 9995932e5ed41fdd8246f379ea261b2fa508a433 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 15 Sep 2026 10:18:02 +0000 Subject: [PATCH] test: migrate `stats/base/dists/hypergeometric/mean` to ULP-based assertions Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01RYRomVwa3KVswQ1745T3N7 --- 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: skipped - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - 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 --- --- .../base/dists/hypergeometric/mean/test/test.js | 13 ++----------- .../dists/hypergeometric/mean/test/test.native.js | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/mean/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/mean/test/test.js index 570fb518ff27..49ce8aa5b985 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/mean/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/mean/test/test.js @@ -21,10 +21,9 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); var PINF = require( '@stdlib/constants/float64/pinf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var mean = require( './../lib' ); @@ -119,8 +118,6 @@ tape( 'if provided an `n` which is not a nonnegative integer, the function retur tape( 'the function returns the mean of a hypergeometric distribution', function test( t ) { var expected; - var delta; - var tol; var N; var K; var n; @@ -133,13 +130,7 @@ tape( 'the function returns the mean of a hypergeometric distribution', function n = data.n; for ( i = 0; i < n.length; i++ ) { y = mean( N[i], K[i], n[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'N: '+N[i]+', K: '+K[i]+', n: '+n[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. N: '+N[i]+'. K: '+K[i]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/mean/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/mean/test/test.native.js index 7c5c23db5e65..8e656de25e70 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/mean/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/hypergeometric/mean/test/test.native.js @@ -23,9 +23,8 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var tryRequire = require( '@stdlib/utils/try-require' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); // FIXTURES // @@ -87,8 +86,6 @@ tape( 'if provided an `n` which is not a nonnegative integer, the function retur tape( 'the function returns the mean of a hypergeometric distribution', opts, function test( t ) { var expected; - var delta; - var tol; var N; var K; var n; @@ -101,13 +98,7 @@ tape( 'the function returns the mean of a hypergeometric distribution', opts, fu n = data.n; for ( i = 0; i < n.length; i++ ) { y = mean( N[i], K[i], n[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'N: '+N[i]+', K: '+K[i]+', n: '+n[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 1.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. N: '+N[i]+'. K: '+K[i]+'. n: '+n[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' ); } t.end(); });