Skip to content

test: migrate stats/base/dists/frechet/mean to ULP-based assertions - #14651

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-frechet-mean
Aug 27, 2026
Merged

test: migrate stats/base/dists/frechet/mean to ULP-based assertions#14651
kgryte merged 1 commit into
developfrom
kgryte/ulp-frechet-mean

Conversation

@kgryte

@kgryte kgryte commented Aug 26, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for stats/base/dists/frechet/mean from relative-tolerance assertions (delta <= tol, with delta = abs( y - expected[ i ] ) and tol = 2.0 * EPS * abs( expected[ i ] )) to ULP-difference assertions using @stdlib/assert/is-almost-same-value.
  • applies the same migration to both test/test.js and test/test.native.js.
  • preserves all existing test cases and structure, including the non-tolerance assertions (NaN parameters, nonpositive alpha, and nonpositive s) and the expected[ i ] !== null fixture guard.

The ULP bound used is:

Test file Fixture block ULP
test/test.js fixtures/julia/data.json (81 non-null cases) 3
test/test.native.js fixtures/julia/data.json (81 non-null cases) 3

3 is the measured minimum: starting from N = 64 and tightening, N = 3 passes over the full fixture set while N = 2 fails (one fixture entry, alpha = 3.988247436421993, s = 2.814258823431831, differs from the Julia expected value by exactly 3 ULP). The suite was run twice at the final N to confirm deterministic passing (96 assertions, all passing on both runs).

Because the native add-on is not built in this environment, test/test.native.js is skipped locally and its bound could not be measured by running that file directly. Instead, the C implementation was compiled standalone against its resolved C dependency closure (math/base/special/gamma, math/base/assert/is-nan, constants/float64/pinf) and evaluated over all 100 fixture inputs: its results are bit-for-bit identical to the JavaScript implementation for every input, so the same bound of 3 applies to both files.

Linting was checked before and after the change and is unchanged (0 errors; the same 2 pre-existing @cspell/spellchecker warnings for "Fréchet" in the test descriptions, which this PR does not touch). The only files changed are the two test files.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance.

This PR was authored by Claude Code: the assistant mechanically converted the tolerance-based assertions to isAlmostSameValue, agentically searched for the minimum ULP bound, verified that the C implementation matches the JavaScript implementation bit-for-bit over the fixture set, confirmed determinism across two full runs, and ran the local lint and test suites before submitting.


@stdlib-js/reviewers


Generated by Claude Code

Migrate the tests for `stats/base/dists/frechet/mean` from relative
tolerance assertions to ULP difference assertions using
`@stdlib/assert/is-almost-same-value`.

Ref: #11352

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014VYisWJoAMK8fVxSCKwkg6
@stdlib-bot stdlib-bot added Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality. labels Aug 26, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Hello! 👋

We've noticed that you've been opening a number of PRs addressing good first issues. Thank you for your interest and enthusiasm!

Now that you've made a few contributions, we suggest no longer working on good first issues. Instead, we encourage you to prioritize cleaning up any PRs which have yet to be merged and then proceed to work on more involved tasks.

Not only does this ensure that other new contributors can work on things and get ramped up on all things stdlib, it also ensures that you can spend your time on more challenging problems. 🚀

For ideas for future PRs, feel free to search the codebase for TODOs and FIXMEs and be sure to check out other open issues on the issue tracker. Cheers!

@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/frechet/mean $\\color{green}193/193$
$\\color{green}+100.00\\%$
$\\color{green}13/13$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}193/193$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 27, 2026
@kgryte
kgryte marked this pull request as ready for review August 27, 2026 07:54
@kgryte
kgryte requested a review from a team August 27, 2026 07:54
@kgryte
kgryte merged commit 7415f92 into develop Aug 27, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-frechet-mean branch August 27, 2026 07:54
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Needs Review A pull request which needs code review. Statistics Issue or pull request related to statistical functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants