Skip to content

test: migrate stats/base/dists/bradford/quantile to ULP-based assertions - #14923

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-bradford-quantile
Sep 3, 2026
Merged

test: migrate stats/base/dists/bradford/quantile to ULP-based assertions#14923
kgryte merged 1 commit into
developfrom
kgryte/ulp-bradford-quantile

Conversation

@kgryte

@kgryte kgryte commented Sep 3, 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/bradford/quantile from relative tolerance testing to ULP difference testing, per [RFC]: Migrate math/base/special packages from relative tolerance testing to ULP difference testing (tracking issue) #11352.
  • replaces the delta/tol (3.2 * EPS * abs( expected[i] ) and 4.8 * EPS * abs( expected[i] )) comparisons in test/test.quantile.js, test/test.factory.js, and test/test.native.js with t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' );, adding the @stdlib/assert/is-almost-same-value import and removing the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps imports.

Final ULP constants (identical across all three test files):

Fixture ULP bound
small_c.json 5
medium_c.json 6
large_c.json 7

These are the measured minimums. Starting from a high bound and tightening, the maximum ULP difference over the full 1000-case-per-group Python fixture set is exactly 5, 6, and 7 respectively. Each bound was verified to be minimal: lowering any one of them by a single ULP produces failing assertions (1, 1, and 2 failures respectively). The bounds hold identically for the JavaScript and native implementations, so the same values apply to all three files.

The suite was run twice at the final bounds with identical results, and the native addon was compiled locally so that test/test.native.js actually executed rather than being skipped:

  • test/test.js: 3 passing, 0 failing
  • test/test.quantile.js: 3011 passing, 0 failing
  • test/test.factory.js: 3013 passing, 0 failing
  • test/test.native.js: 3011 passing, 0 failing

test/test.js contains only export smoke tests and is unchanged. The expected[i] !== null guards in test/test.native.js are preserved. Only the three test files containing tolerance math are changed.

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.

The conversion mirrors the sibling package stats/base/dists/bradford/cdf, which uses the same three-fixture structure and per-fixture-group ULP bounds.

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

This PR was authored by Claude Code running as an automated task. The tolerance-to-ULP conversion, the search for the minimum ULP bounds, and the local test/lint verification were all performed by Claude Code.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_012wtya3dXa2SDCVsefgMHKb


Generated by Claude Code

…tions

Replace the relative tolerance comparisons in `test/test.quantile.js`,
`test/test.factory.js`, and `test/test.native.js` with
`isAlmostSameValue` ULP difference assertions. The measured minimum
ULP bounds are `5` (small `c`), `6` (medium `c`), and `7` (large `c`),
which hold identically for both the JavaScript and native
implementations.

Ref: #11352

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/bradford/quantile $\\color{green}290/290$
$\\color{green}+100.00\\%$
$\\color{green}21/21$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}290/290$
$\\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 Sep 3, 2026
@kgryte
kgryte marked this pull request as ready for review September 3, 2026 03:04
@kgryte
kgryte requested a review from a team September 3, 2026 03:04
@kgryte
kgryte merged commit 2efc2d4 into develop Sep 3, 2026
66 checks passed
@kgryte
kgryte deleted the kgryte/ulp-bradford-quantile branch September 3, 2026 03:05
@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 Sep 3, 2026
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Sep 5, 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