Skip to content

Add property-based tests with FsCheck - #61

Merged
atulmish merged 2 commits into
masterfrom
property-tests
Oct 25, 2026
Merged

atulmish merged 2 commits into
masterfrom
property-tests

Conversation

@atulmish

Copy link
Copy Markdown
Owner

Adds FsCheck property tests for every converter: conversions round-trip, are monotonic, scale linearly, compose through any third unit, leave a unit unchanged when converted to itself, and unit names are accepted in any case.

Checked: a deliberate bias injected into the conversion makes 22 of the 62 new test cases fail, and 20 repeated runs with fresh random seeds all pass. Test-only change plus a changelog and contributing note. It also gives the OpenSSF Scorecard Fuzzing check what it looks for in a .NET project (a property-based testing library).

For every converter, FsCheck generates random units and values and checks that conversions
round-trip, are monotonic, scale linearly, compose through any third unit, leave a unit unchanged
when converted to itself and accept unit names in any case. A deliberate bias injected into the
conversion makes 22 of the new tests fail; 20 repeated runs with fresh seeds pass.
@atulmish
atulmish merged commit 667c7cd into master Oct 25, 2026
8 checks passed
@atulmish
atulmish deleted the property-tests branch October 25, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant