Skip to content

[tests] tests: ProbabilityFunctions unit tests for Erfinv/Erf/Erfc/Probit#54

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
tests/probability-functions-erfinv-pr51-79acdecfb842455b
Draft

[tests] tests: ProbabilityFunctions unit tests for Erfinv/Erf/Erfc/Probit#54
github-actions[bot] wants to merge 1 commit intomainfrom
tests/probability-functions-erfinv-pr51-79acdecfb842455b

Conversation

@github-actions
Copy link
Copy Markdown

@github-actions github-actions bot commented Apr 8, 2026

Adds comprehensive unit tests for ProbabilityFunctions to cover the changes introduced in PR #51.

Related PR

Covers changes from #51 — performance fix for Erfinv via lazy-allocated ErfInvSeriesCoefficients struct.

Test file created

  • test/Microsoft.ML.CpuMath.UnitTests/ProbabilityFunctionsTests.cs (275 lines, 57 tests)

What is tested

Category Description
Erfinv boundary/special values NaN for out-of-range, ±∞ for ±1, 0 for x=0
Erfinv consistency Repeated calls return identical results — validates the coefficient caching refactor from PR #51
Erf/Erfinv round-trip Erf(Erfinv(x)) ≈ x for 9 values in (-1, 1)
Erf special values +∞ → 1, -∞ → -1
Erfc special values +∞ → 0, -∞ → 2
Erf + Erfc = 1 Complement property for 8 values
Erf odd symmetry Erf(-x) == -Erf(x)
Erfc symmetry Erfc(-x) == 2 - Erfc(x)
Probit valid inputs Interior values return finite doubles; boundaries don't throw
Probit invalid inputs Values outside [0,1] throw ArgumentOutOfRangeException
Known values Erfinv(0.5) ≈ 0.4769, Probit(0.5) ≈ 0

All 57 tests pass.

Generated by Add Tests for PR Changes · ● 3.3M ·

Add 57 unit tests covering the ProbabilityFunctions class changed in PR #51.

Tests cover:
- Erfinv boundary/special values (NaN, ±∞, 0)
- Erfinv consistency (coefficient caching returns same result)
- Erf/Erfinv round-trip accuracy
- Erf/Erfc special values and symmetry
- Erf + Erfc = 1 complement property
- Probit valid/invalid inputs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants