From ddc38cfda401562e71decae7160d491ff492156a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 20 Sep 2026 22:13:48 +0000 Subject: [PATCH] test: migrate `stats/levene-test` to ULP-based assertions Replace relative tolerance comparisons with `isAlmostSameValue` ULP difference assertions, using the minimum required ULP value for each test case. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01LdEDYG8BKCsQjS5dDNJszp --- 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 --- --- .../@stdlib/stats/levene-test/test/test.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/levene-test/test/test.js b/lib/node_modules/@stdlib/stats/levene-test/test/test.js index 2274b74306aa..b3c999f3fefa 100644 --- a/lib/node_modules/@stdlib/stats/levene-test/test/test.js +++ b/lib/node_modules/@stdlib/stats/levene-test/test/test.js @@ -21,9 +21,8 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var contains = require( '@stdlib/assert/contains' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var leveneTest = require( './../lib' ); @@ -162,8 +161,6 @@ tape( 'the function throws an error if the `groups` option array does not contai tape( 'the function correctly computes Levene\'s test for homogeneity of variance', function test( t ) { var expected; - var delta; - var tol; var out; out = leveneTest( fixtures.x, { @@ -172,14 +169,10 @@ tape( 'the function correctly computes Levene\'s test for homogeneity of varianc // Tested against R: expected = fixtures.pValue; - delta = abs( out.pValue - expected ); - tol = 2.0 * EPS * abs( expected ); - t.ok( delta <= tol, 'within tolerance. p-value: '+out.pValue+'. E: '+expected+' Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValue( out.pValue, expected, 2 ), true, 'returns expected value' ); expected = fixtures.statistic; - delta = abs( out.statistic - expected ); - tol = 2.0 * EPS * abs( expected ); - t.ok( delta <= tol, 'within tolerance. test statistic: '+out.statistic+'. E: '+expected+' Δ: '+delta+'. tol: '+tol ); + t.strictEqual( isAlmostSameValue( out.statistic, expected, 1 ), true, 'returns expected value' ); t.end(); });