From 05e9261c4b4c83471600ecdeb65cd79b436783d2 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 3 Sep 2026 18:19:57 +0000 Subject: [PATCH] test: migrate `stats/base/dists/gumbel/pdf` 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_01U5hkgpAq7yZHbDyNf71eS8 --- 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 --- --- .../dists/gumbel/pdf/test/test.factory.js | 33 +++---------------- .../base/dists/gumbel/pdf/test/test.native.js | 33 +++---------------- .../base/dists/gumbel/pdf/test/test.pdf.js | 33 +++---------------- 3 files changed, 12 insertions(+), 87 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.factory.js index f1630478738b..79bc8697e482 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.factory.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 factory = require( './../lib/factory.js' ); @@ -140,10 +139,8 @@ tape( 'if provided a nonpositive `beta`, the created function always returns `Na tape( 'the created function evaluates the pdf for `x` given positive `mu`', function test( t ) { var expected; - var delta; var beta; var pdf; - var tol; var mu; var x; var y; @@ -157,13 +154,7 @@ tape( 'the created function evaluates the pdf for `x` given positive `mu`', func pdf = factory( mu[i], beta[i] ); y = pdf( x[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu: '+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end(); @@ -171,10 +162,8 @@ tape( 'the created function evaluates the pdf for `x` given positive `mu`', func tape( 'the created function evaluates the pdf for `x` given negative `mu`', function test( t ) { var expected; - var delta; var beta; var pdf; - var tol; var mu; var x; var y; @@ -188,13 +177,7 @@ tape( 'the created function evaluates the pdf for `x` given negative `mu`', func pdf = factory( mu[i], beta[i] ); y = pdf( x[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu:'+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end(); @@ -202,10 +185,8 @@ tape( 'the created function evaluates the pdf for `x` given negative `mu`', func tape( 'the created function evaluates the pdf for `x` given large variance ( = large `beta`)', function test( t ) { var expected; - var delta; var beta; var pdf; - var tol; var mu; var x; var y; @@ -219,13 +200,7 @@ tape( 'the created function evaluates the pdf for `x` given large variance ( = l pdf = factory( mu[i], beta[i] ); y = pdf( x[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu: '+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[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/gumbel/pdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.native.js index d455279cb717..c5bf13a73e9e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.native.js @@ -23,11 +23,10 @@ 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 PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); -var EPS = require( '@stdlib/constants/float64/eps' ); // FIXTURES // @@ -107,9 +106,7 @@ tape( 'if provided a nonpositive `beta`, the function returns `NaN`', opts, func tape( 'the function evaluates the pdf for `x` given positive `mu`', opts, function test( t ) { var expected; - var delta; var beta; - var tol; var mu; var x; var y; @@ -122,13 +119,7 @@ tape( 'the function evaluates the pdf for `x` given positive `mu`', opts, functi for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], mu[i], beta[i] ); if ( expected[i] !== null) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu:'+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end(); @@ -136,9 +127,7 @@ tape( 'the function evaluates the pdf for `x` given positive `mu`', opts, functi tape( 'the function evaluates the pdf for `x` given negative `mu`', opts, function test( t ) { var expected; - var delta; var beta; - var tol; var mu; var x; var y; @@ -151,13 +140,7 @@ tape( 'the function evaluates the pdf for `x` given negative `mu`', opts, functi for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], mu[i], beta[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu:'+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end(); @@ -165,9 +148,7 @@ tape( 'the function evaluates the pdf for `x` given negative `mu`', opts, functi tape( 'the function evaluates the pdf for `x` given large variance ( = large `beta` )', opts, function test( t ) { var expected; - var delta; var beta; - var tol; var mu; var x; var y; @@ -180,13 +161,7 @@ tape( 'the function evaluates the pdf for `x` given large variance ( = large `be for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], mu[i], beta[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu:'+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[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/gumbel/pdf/test/test.pdf.js b/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.pdf.js index a4a4b125aeb3..5398e6b48b5d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.pdf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/gumbel/pdf/test/test.pdf.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 pdf = require( './../lib' ); @@ -98,9 +97,7 @@ tape( 'if provided a nonpositive `beta`, the function returns `NaN`', function t tape( 'the function evaluates the pdf for `x` given positive `mu`', function test( t ) { var expected; - var delta; var beta; - var tol; var mu; var x; var y; @@ -113,13 +110,7 @@ tape( 'the function evaluates the pdf for `x` given positive `mu`', function tes for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], mu[i], beta[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu:'+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end(); @@ -127,9 +118,7 @@ tape( 'the function evaluates the pdf for `x` given positive `mu`', function tes tape( 'the function evaluates the pdf for `x` given negative `mu`', function test( t ) { var expected; - var delta; var beta; - var tol; var mu; var x; var y; @@ -142,13 +131,7 @@ tape( 'the function evaluates the pdf for `x` given negative `mu`', function tes for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], mu[i], beta[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu:'+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end(); @@ -156,9 +139,7 @@ tape( 'the function evaluates the pdf for `x` given negative `mu`', function tes tape( 'the function evaluates the pdf for `x` given large variance ( = large `beta` )', function test( t ) { var expected; - var delta; var beta; - var tol; var mu; var x; var y; @@ -171,13 +152,7 @@ tape( 'the function evaluates the pdf for `x` given large variance ( = large `be for ( i = 0; i < x.length; i++ ) { y = pdf( x[i], mu[i], beta[i] ); if ( expected[i] !== null ) { - if ( y === expected[i] ) { - t.strictEqual( y, expected[i], 'x: '+x[i]+', mu:'+mu[i]+', beta: '+beta[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. x: '+x[ i ]+'. mu: '+mu[i]+'. beta: '+beta[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' ); } } t.end();