Skip to content

test: migrate stats/incr/nanmpe to ULP-based assertions - #15969

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-incr-nanmpe
Oct 11, 2026
Merged

kgryte merged 1 commit into
developfrom
kgryte/ulp-stats-incr-nanmpe

Conversation

@kgryte

@kgryte kgryte commented Oct 7, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Two test cases were migrated, and, in each case, the ULP bound was tightened to the minimum passing integer value:

Test case Previous tolerance ULP bound
the accumulator function incrementally computes the mean percentage error, ignoring NaN values 10.0 * EPS * abs( expected ) 1
if not provided an input value, the accumulator function returns the current mean percentage error 1.0 * EPS * abs( expected ) 1

The bounds were determined by starting from a high ULP allowance (64) and lowering the value until the minimum passing integer was found. For both test cases, lowering the bound to 0 causes that test case to fail, and thus 1 is minimal in each case. The test suite was run twice at the final bounds in order to confirm determinism (11/11 assertions passing in each run).

Notes:

  • In the first test case, the previous actual === expected branch is no longer necessary, as isAlmostSameValue short-circuits on strict equality and thus already handles the iterations in which a NaN input leaves the accumulated value unchanged.
  • The package does not provide a native implementation, and thus only test/test.js required updating.

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 helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was authored by Claude Code, which performed the test migration, measured the minimum passing ULP bounds, and ran the test and lint suites locally.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_011wXHMLyS4pbZfSTXKCMyoX


Generated by Claude Code

Migrate the tests for `stats/incr/nanmpe` from relative tolerance
assertions to ULP-based assertions using
`@stdlib/assert/is-almost-same-value`, as proposed in #11352.

Both migrated test cases pass at a ULP bound of `1`, which is the
minimum passing integer value for each.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011wXHMLyS4pbZfSTXKCMyoX
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Good First PR A pull request resolving a Good First Issue. labels Oct 7, 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/incr/nanmpe $\\color{green}129/129$
$\\color{green}+100.00\\%$
$\\color{green}7/7$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}129/129$
$\\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 Oct 11, 2026
@kgryte
kgryte marked this pull request as ready for review October 11, 2026 12:56
@kgryte
kgryte requested a review from a team October 11, 2026 12:56
@kgryte
kgryte merged commit da1e052 into develop Oct 11, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-stats-incr-nanmpe branch October 11, 2026 12:57
@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 Oct 11, 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. 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