From 822bb84c3e297d5a8fe1043afaa99725c75c9a4d Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sat, 3 Oct 2026 22:24:00 +0000 Subject: [PATCH] test: migrate `stats/incr/nanme` to ULP-based assertions Migrate the test cases for `stats/incr/nanme` from relative tolerance assertions to ULP-based assertions using `@stdlib/assert/is-almost-same-value`. The ULP bounds were tightened to the minimum passing integer values: `0` for the incremental accumulation test case and `3` for the test case asserting the current accumulated value. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01HSMKAZJRGKSu3kBXT9hJYU --- 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/incr/nanme/test/test.js | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/nanme/test/test.js b/lib/node_modules/@stdlib/stats/incr/nanme/test/test.js index 2cab0268bbf4..9d4e09c6acb4 100644 --- a/lib/node_modules/@stdlib/stats/incr/nanme/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/nanme/test/test.js @@ -21,8 +21,7 @@ // MODULES // var tape = require( 'tape' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var incrnanme = require( './../lib' ); @@ -49,12 +48,10 @@ tape( 'the initial accumulated value is `null`', function test( t ) { tape( 'the accumulator function incrementally computes the mean error', function test( t ) { var expected; var actual; - var delta; var count; var data; var acc; var sum; - var tol; var N; var x; var y; @@ -84,13 +81,7 @@ tape( 'the accumulator function incrementally computes the mean error', function } expected = ( count > 0 ) ? sum / count : null; actual = acc( x, y ); - if ( actual === expected ) { - t.strictEqual( actual, expected, 'returns expected value' ); - } else { - delta = abs( expected - actual ); - tol = 6.0 * EPS * abs( expected ); - t.equal( delta <= tol, true, 'within tolerance. Actual: '+actual+'. Expected: '+expected+'. Delta: '+delta+'. Tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual, expected, 0 ), true, 'returns expected value' ); } t.end(); }); @@ -98,10 +89,8 @@ tape( 'the accumulator function incrementally computes the mean error', function tape( 'if not provided an input value, the accumulator function returns the current mean error', function test( t ) { var expected; var actual; - var delta; var data; var acc; - var tol; var i; data = [ @@ -117,9 +106,7 @@ tape( 'if not provided an input value, the accumulator function returns the curr } actual = acc(); expected = 2.0 / 3.0; - delta = abs( expected - actual ); - tol = 3.0 * EPS * abs( expected ); - t.equal( delta <= tol, true, 'within tolerance. Actual: '+actual+'. Expected: '+expected+'. Delta: '+delta+'. Tol: '+tol+'.' ); + t.strictEqual( isAlmostSameValue( actual, expected, 3 ), true, 'returns expected value' ); t.end(); });