From 42800741653742eb14416ccd6bfda9da138ab7a6 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 11 Aug 2026 06:34:30 +0000 Subject: [PATCH] test: migrate `stats/base/dists/kumaraswamy/mean` to ULP-based assertions Replaces the relative-tolerance (EPS-scaled) fixture assertions with ULP-based assertions using `@stdlib/assert/is-almost-same-value`. The ULP bound (23) is the measured minimum over the full fixture set for both the JavaScript and C implementations. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_011kRFyjEkPrJBc266uFCr7p --- .../stats/base/dists/kumaraswamy/mean/test/test.js | 13 ++----------- .../base/dists/kumaraswamy/mean/test/test.native.js | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/test/test.js index 7d3ad4c0b717..6a58dfa0d743 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/test/test.js @@ -21,11 +21,10 @@ // MODULES // 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 PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var mean = require( './../lib' ); @@ -105,8 +104,6 @@ tape( 'if provided `b <= 0`, the function returns `NaN`', function test( t ) { tape( 'the function returns the expected value of a Kumaraswamy\'s double bounded distribution', function test( t ) { var expected; - var delta; - var tol; var a; var b; var i; @@ -118,13 +115,7 @@ tape( 'the function returns the expected value of a Kumaraswamy\'s double bounde for ( i = 0; i < expected.length; i++ ) { y = mean( a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 15.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i]+', Δ: '+delta+', tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 23 ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/test/test.native.js index 11b3908a983f..64e79c79c185 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/mean/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 // @@ -117,8 +116,6 @@ tape( 'if provided `b <= 0`, the function returns `NaN`', opts, function test( t tape( 'the function returns the expected value of a Kumaraswamy\'s double bounded distribution', opts, function test( t ) { var expected; - var delta; - var tol; var a; var b; var i; @@ -130,13 +127,7 @@ tape( 'the function returns the expected value of a Kumaraswamy\'s double bounde for ( i = 0; i < expected.length; i++ ) { y = mean( a[i], b[i] ); - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = 15.0 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. a: '+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i]+', Δ: '+delta+', tol: '+tol ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 23 ), true, 'returns expected value' ); } t.end(); });