From 39b7b6ceac3234d078b8e1e2fd5ac21959c7d2d3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 22:30:30 +0000 Subject: [PATCH] test: migrate `stats/incr/mae` to ULP-based assertions Migrate the tests for `stats/incr/mae` from relative tolerance testing to ULP difference testing. Ref: https://github.com/stdlib-js/stdlib/issues/11352 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Tori6qPj6kcxrapfHdxQ6k --- lib/node_modules/@stdlib/stats/incr/mae/test/test.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/incr/mae/test/test.js b/lib/node_modules/@stdlib/stats/incr/mae/test/test.js index abbf2d3a32eb..f92844fd0c41 100644 --- a/lib/node_modules/@stdlib/stats/incr/mae/test/test.js +++ b/lib/node_modules/@stdlib/stats/incr/mae/test/test.js @@ -21,8 +21,8 @@ // MODULES // var tape = require( 'tape' ); +var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' ); var abs = require( '@stdlib/math/base/special/abs' ); -var EPS = require( '@stdlib/constants/float64/eps' ); var incrmae = require( './../lib' ); @@ -48,11 +48,9 @@ tape( 'the initial accumulated value is `null`', function test( t ) { tape( 'the accumulator function incrementally computes the mean absolute error', function test( t ) { var expected; var actual; - var delta; var data; var acc; var sum; - var tol; var N; var x; var y; @@ -77,13 +75,7 @@ tape( 'the accumulator function incrementally computes the mean absolute error', sum += abs( y-x ); expected = sum / (i+1); actual = acc( x, y ); - if ( actual === expected ) { - t.strictEqual( actual, expected, 'returns expected value' ); - } else { - delta = abs( expected - actual ); - tol = 1.0 * EPS * abs( expected ); - t.strictEqual( delta <= tol, true, 'within tolerance. Actual: '+actual+'. Expected: '+expected+'. Delta: '+delta+'. Tol: '+tol+'.' ); - } + t.strictEqual( isAlmostSameValue( actual, expected, 1 ), true, 'returns expected value' ); } t.end(); });