Skip to content

test: migrate stats/base/dists/weibull/logpdf to ULP-based assertions - #15906

Merged
kgryte merged 1 commit into
developfrom
philipp/ulp-weibull-logpdf
Oct 12, 2026
Merged

kgryte merged 1 commit into
developfrom
philipp/ulp-weibull-logpdf

Conversation

@Planeshifter

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/weibull/logpdf from computed relative-tolerance comparisons (delta = abs( y - expected[ i ] ) / tol = N * EPS * abs( expected[ i ] ), asserted via t.ok( delta <= tol, ... )) to ULP-difference assertions using @stdlib/assert/is-almost-same-value.
  • applies the migration to test/test.logpdf.js, test/test.factory.js, and test/test.native.js (test/test.js has no tolerance-based assertions).
  • collapses the if ( y === expected[i] ) { ... } else { ... } branch in each fixture loop into a single t.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' ) assertion, matching the idiom used in the already-merged migrations (e.g., stats/base/dists/gumbel/quantile).
  • removes the now-unused abs and EPS requires and the delta/tol variables (including a stray tol = EPS; in test.factory.js).

Only test files are changed.

ULP bounds

File Test (fixture) Previous tolerance ULP bound
test/test.logpdf.js both_large 1.0 * EPS * abs( expected ) 0
test/test.logpdf.js large_scale 1.0 * EPS * abs( expected ) 0
test/test.logpdf.js large_shape 1.0 * EPS * abs( expected ) 0
test/test.factory.js all three 1.0 * EPS * abs( expected ) 0
test/test.native.js both_large / large_scale / large_shape 2.0 / 2.0 / 10.0 * EPS * abs( expected ) 0

Each bound is the minimum integer N for which every fixture value passes. It was found by setting that one assertion to N (others at 64) and increasing N from 0 until the file passed. The minimum is 0 everywhere, so every fixture value is reproduced bit-for-bit. The suite was run twice at the final bounds with identical results (3023 passing assertions in test.logpdf.js and test.native.js, 3028 in test.factory.js, 0 failing), and the native addon was built so test.native.js actually ran. npx eslint on the test files is clean.

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 ULP value is passed as a literal, as in the other merged migrations, rather than as a named constant. The pre-commit editorconfig step could not download its binary in this environment, so it was skipped; the diff only removes lines from tab-indented files.

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 written primarily by Claude Code, running as an unattended scheduled task. It selected the package, studied previously migrated packages, performed the migration, and measured the minimum passing ULP bounds.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_019dhnpndHupQsUA3fAyxi1g


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

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/weibull/logpdf $\\color{green}308/308$
$\\color{green}+100.00\\%$
$\\color{green}35/35$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}308/308$
$\\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 12:58
@kgryte
kgryte requested a review from a team October 12, 2026 12:58
@kgryte
kgryte merged commit f6d1d43 into develop Oct 12, 2026
66 checks passed
@kgryte
kgryte deleted the philipp/ulp-weibull-logpdf branch October 12, 2026 12:59
@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.

4 participants