Skip to content

test: migrate stats/bartlett-test to ULP-based assertions - #15835

Merged
kgryte merged 1 commit into
developfrom
claude/great-brahmagupta-qd9gi6
Oct 12, 2026
Merged

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

Conversation

@kgryte

@kgryte kgryte commented Oct 3, 2026

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

Specifically, in test/test.js, the following idiom

delta = abs( out.pValue - expected );
tol = 10.0 * EPS * abs( expected );
t.ok( delta <= tol, 'within tolerance. ...' );

is replaced by

t.strictEqual( isAlmostSameValue( out.pValue, expected, 9 ), true, 'returns expected value' );

The abs and EPS requires are dropped in favor of @stdlib/assert/is-almost-same-value.

ULP bounds

The ULP constants were tightened to the measured minimum which still passes over the full fixture set (fixtures generated against R):

Assertion ULP bound Measured ULP difference
out.pValue 9 9
out.statistic 4 4

Each bound is minimal: lowering pValue to 8 or statistic to 3 causes the respective assertion to fail. The suite was run twice at the final bounds to confirm deterministic results.

The package has no test/test.native.js, so only test/test.js required changes.

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.

  • Only test files are modified; no implementation, documentation, or benchmark changes are included.
  • The conversion mirrors the idiom already established in the same family (e.g., stats/levene-test and stats/fligner-test).

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 written primarily by Claude Code. The ULP bounds were determined empirically by measuring the actual ULP differences against the fixture values and then verifying that each bound is the minimum integer which still passes.


@stdlib-js/reviewers


Generated by Claude Code

@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 3, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/bartlett-test $\\color{green}414/414$
$\\color{green}+100.00\\%$
$\\color{green}54/54$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}414/414$
$\\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 12, 2026
@kgryte
kgryte marked this pull request as ready for review October 12, 2026 13:28
@kgryte
kgryte requested a review from a team October 12, 2026 13:28
@kgryte
kgryte merged commit 29aef2e into develop Oct 12, 2026
66 checks passed
@kgryte
kgryte deleted the claude/great-brahmagupta-qd9gi6 branch October 12, 2026 13:29
@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 12, 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.

2 participants