From 6cbdf6511879804eb26fddbef8fb5d27460a669e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 9 Sep 2026 09:13:57 +0000 Subject: [PATCH] test: migrate `stats/base/dists/frechet/median` to ULP-based assertions Migrates from EPS-based relative tolerance assertions to `@stdlib/assert/is-almost-same-value` ULP difference assertions. The implementation matches the fixture expectations exactly (0 ULP) across the full 100-case fixture set, so the fixture-loop assertion now uses `isAlmostSameValue( y, expected[ i ], 0 )`. Applied identically to test.native.js. Ref: #11352 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01RrzhCVu95Ue4a7iDFzbw3d --- 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 --- --- .../stats/base/dists/frechet/median/test/test.js | 13 ++----------- .../base/dists/frechet/median/test/test.native.js | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/frechet/median/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/frechet/median/test/test.js index 6fd02e5b2e2b..79b968768914 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/frechet/median/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/frechet/median/test/test.js @@ -21,11 +21,10 @@ // 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 NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var median = require( './../lib' ); @@ -97,8 +96,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test tape( 'the function returns the median of a Fréchet distribution', function test( t ) { var expected; var alpha; - var delta; - var tol; var s; var y; var i; @@ -109,13 +106,7 @@ tape( 'the function returns the median of a Fréchet distribution', function tes for ( i = 0; i < alpha.length; i++ ) { y = median( alpha[i], s[i], 0.0 ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'alpha:'+alpha[i]+', s: '+s[i]+', m: 0, y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 2.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. alpha: '+alpha[i]+'. s: '+s[i]+'. m: 0. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' ); } } t.end(); diff --git a/lib/node_modules/@stdlib/stats/base/dists/frechet/median/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/frechet/median/test/test.native.js index 82fec7362784..c7657784956d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/frechet/median/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/frechet/median/test/test.native.js @@ -22,12 +22,11 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); // FIXTURES // @@ -112,8 +111,6 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', opts, functio tape( 'the function returns the median of a Fréchet distribution', opts, function test( t ) { var expected; var alpha; - var delta; - var tol; var s; var y; var i; @@ -124,13 +121,7 @@ tape( 'the function returns the median of a Fréchet distribution', opts, functi for ( i = 0; i < alpha.length; i++ ) { y = median( alpha[i], s[i], 0.0 ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'alpha:'+alpha[i]+', s: '+s[i]+', m: 0, y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[ i ] ); - tol = 2.0 * EPS * abs( expected[ i ] ); - t.ok( delta <= tol, 'within tolerance. alpha: '+alpha[i]+'. s: '+s[i]+'. m: 0. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 0 ), true, 'returns expected value' ); } } t.end();