Skip to content

test: migrate stats/base/dists/chisquare/cdf to ULP-based assertions - #13868

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-chisquare-cdf
Draft

test: migrate stats/base/dists/chisquare/cdf to ULP-based assertions#13868
Planeshifter wants to merge 1 commit into
developfrom
philipp/ulp-chisquare-cdf

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

Migrates the stats/base/dists/chisquare/cdf test suite from the old computed-tolerance idiom (delta/tol derived from EPS) to ULP-based assertions using @stdlib/assert/is-almost-same-value, per #11352.

Converted files:

  • test/test.cdf.js
  • test/test.factory.js
  • test/test.native.js

test/test.js was left untouched (it only contains the exports smoke test; no tolerance comparisons).

ULP bound

All three files share the same fixture set (test/fixtures/julia/decimal_decimal.json) and the same underlying computation, so a single ULP constant was used across all of them:

  • isAlmostSameValue( y, expected[i], 76 )

The bound of 76 was found by computing the exact ULP difference between actual and expected values across the full fixture (5015 cases) using @stdlib/number/float64/base/ulp-difference; the maximum observed difference was 76 ULPs. The full test suite was run twice at this bound to confirm deterministic results (no FMA/arch flakiness).

Verification

  • test/test.cdf.js: 5015/5015 passing (run twice)
  • test/test.factory.js: 5015/5015 passing (run twice)
  • test/test.js: 3/3 passing
  • test/test.native.js: no native binding available in this environment, so the (skip-gated) tests did not execute; the conversion mirrors the JS test files exactly.
  • Only test files were changed; package.json did not need updates since @stdlib/assert/is-almost-same-value resolves via the existing monorepo module resolution (no explicit devDependencies entries are used elsewhere in this package either).
  • eslint could not be run to completion in this sandboxed session due to an unrelated dependency-resolution issue in the reconstructed lint toolchain (reproduces identically on an already-merged, unmodified test file, so it is an environment/tooling issue, not something introduced by this diff). The diff was manually checked against the exact conventions used in prior merged conversions (e.g. test: migrate math/base/special/csc to ULP-based assertions #13828, test: migrate math/base/special/roundn to ULP-based assertions #13857, test: migrate stats/base/dists/t/quantile to ULP-based assertions #13847) — require ordering, removal of now-unused abs/EPS/delta/tol, and the t.strictEqual( isAlmostSameValue( actual, expected, N ), true, 'returns expected value' ) shape.

Ref: #11352


Generated by Claude Code

@stdlib-bot

Copy link
Copy Markdown
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/chisquare/cdf $\\color{green}241/241$
$\\color{green}+100.00\\%$
$\\color{green}7/7$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}241/241$
$\\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 3, 2026
@kgryte

kgryte commented Aug 3, 2026

Copy link
Copy Markdown
Member

You need to update the OP above according to #13868 (comment).

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.

4 participants