Repository navigation
test: migrate stats/base/dists/chisquare/cdf to ULP-based assertions - #15392
Merged
Merged
Conversation
Migrates the tests for `stats/base/dists/chisquare/cdf` from relative tolerance testing to ULP difference testing. The ULP constant is the measured minimum over the full 5000-element `decimal_decimal.json` fixture set: - `decimal_decimal.json`: 76 (was `40.0 * EPS * abs( expected[i] )`) The native add-on was built locally and reproduces the JavaScript results bit-for-bit across all 5000 fixtures, so `test/test.native.js` uses the same constant. Ref: #11352 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018DyJPRsZzRLQLN4sSHtZjY --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: skipped - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Member
|
/stdlib merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves a part of #11352.
Description
This pull request:
stats/base/dists/chisquare/cdffrom relative tolerance testing to ULP difference testing, per [RFC]: Migratemath/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352.The following test files are updated; no other files are touched:
test/test.cdf.jstest/test.factory.jstest/test.native.jsIn each file,
var abs = require( '@stdlib/math/base/special/abs' );andvar EPS = require( '@stdlib/constants/float64/eps' );are replaced byvar isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );, thedelta/tolcomputation is removed, and theif ( y === expected[i] ) { ... } else { t.ok( delta <= tol, ... ); }block is replaced by a singlet.strictEqual( isAlmostSameValue( y, expected[ i ], N ), true, 'returns expected value' );.ULP constant
There is a single fixture-driven test block per file, all three of which are backed by the same 5000-element fixture set:
test/fixtures/julia/decimal_decimal.json40.0 * EPS * abs( expected[i] )76is the measured minimum, not a rounded-up bound:76, forx = 0.05304959964595124,k = 17.630144352098277.75fails, with exactly one failing assertion (that same value); running at76passes.76to confirm determinism; both runs were identical, with no arch/FMA-dependent variation.The native add-on was built locally so that
test/test.native.jswas actually exercised rather than skipped. The C implementation reproduces the JavaScript results bit-for-bit across all 5000 fixtures (0 differing values), and its measured maximum ULP difference is likewise76, sotest/test.native.jsuses the same constant.Related Issues
This pull request has the following related issues:
math/base/specialpackages from relative tolerance testing to ULP difference testing (tracking issue) #11352Questions
No.
Other
Test results on this branch (
make test TESTS_FILTER=".*/stats/base/dists/chisquare/cdf/.*"):test/test.cdf.js: 5015 passing, 0 failingtest/test.factory.js: 5015 passing, 0 failingtest/test.js: 3 passing, 0 failing (unchanged; contains no tolerance-based assertions)test/test.native.js: 5009 passing, 0 failing (with the add-on built locally)ESLint is clean for the three changed files against
etc/eslint/.eslintrc.tests.js. The EditorConfig check could not be run in this environment, becauseeditorconfig-checkerdownloads its binary from GitHub releases and that download was blocked; the changed files were instead verified by hand to use LF endings, tab indentation, no trailing whitespace, and a final newline, andgit diff --checkreports no whitespace errors.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written by Claude Code, which studied the migrations in already-converted packages in the same family (e.g.
stats/base/dists/cauchy/cdf,stats/base/dists/gamma/cdf) to match the established idiom, applied the same mechanical transformation here, and determined the ULP constant empirically by measuring the maximum ULP difference over the fixture set and confirming that the next-lower integer fails.@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_018DyJPRsZzRLQLN4sSHtZjY
Generated by Claude Code