Skip to content

test: migrate stats/incr/apcorr to ULP-based assertions - #15978

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-taot70
Oct 11, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-taot70

Conversation

@kgryte

@kgryte kgryte commented Oct 8, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Specifically, in test/test.js:

  • adds the @stdlib/assert/is-almost-same-value require and drops the now-unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.
  • removes the delta/tol variables and the actual === expected[ i ] branch in the two accumulator fixture loops.
  • replaces the tolerance checks with t.strictEqual( isAlmostSameValue( actual, expected[ i ], <ULP> ), true, 'returns expected value' );.

ULP bounds

Each bound was tightened to the measured minimum integer which still passes over the full set of test values. The minimum was measured per test value, and confirmed by re-running the suite with each bound decremented by one (which fails, 6 assertions):

Test Previous tolerance Final ULP bound Measured minimum
the accumulator function incrementally computes a sample absolute correlation coefficient 3.7 * EPS * abs( expected ) 4 4
the accumulator function incrementally computes a sample absolute correlation coefficient (known means) EPS * abs( expected ) 1 1

The suite was run twice at the final bounds to confirm determinism (96 passing, 0 failing on both runs).

No other assertions were changed; the existing exact t.strictEqual comparisons (null, 0.0, NaN, and the two exactly-reproduced accumulator values) are left as-is, and no non-test files are touched.

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.

  • Verification: make test TESTS_FILTER=".*/@stdlib/stats/incr/apcorr/.*" → 96 passing, 0 failing; eslint --config etc/eslint/.eslintrc.tests.js on the changed file is clean.
  • The lint-editorconfig-files pre-commit step could not run in the authoring environment because the editorconfig-checker binary download was blocked by network policy, so EditorConfig conformance (tabs, LF line endings, no trailing whitespace, final newline) was verified manually instead. CI should be treated as authoritative here.

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, running unattended as a scheduled task. Claude Code studied the already-migrated sibling packages under stats/incr to mirror the established idiom, applied the mechanical substitution to test/test.js, and determined the minimum passing ULP bounds empirically.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_015maoYHf9sFNS4w6oCmCo5b


Generated by Claude Code

Replaces computed relative-tolerance comparisons in the `stats/incr/apcorr`
test suite with `@stdlib/assert/is-almost-same-value` ULP-based assertions.

The ULP bounds were tightened to the measured minimum which still passes
over the full set of test values: 4 ULP for the unknown means test and
1 ULP for the known means test.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015maoYHf9sFNS4w6oCmCo5b
@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 8, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/incr/apcorr $\\color{green}149/149$
$\\color{green}+100.00\\%$
$\\color{green}15/15$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}149/149$
$\\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:53
@kgryte
kgryte requested a review from a team October 11, 2026 12:53
@kgryte
kgryte merged commit c3d250c into develop Oct 11, 2026
66 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-taot70 branch October 11, 2026 12:53
@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