-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
To inspect the distribution of generators QCheck
offers
Gen.generate{,1}
to observe samplesset_collect
to label each sample with astring
add_stat
andset_stats
to print a histogram and calculate avg/stddev/... based on some numeric property (e.g.,List.length
)
As part of reworking the generator and extending our existing tests of Stdlib.Sys
I found myself
- reading about the Elm PBT port's abilities in this direction: https://martin.janiczek.cz/2025/05/01/elm-test-distributions.html
- watching “Building on developers’ intuitions to create effective property-based tests” https://www.youtube.com/watch?v=NcJOiQlzlXQ
Based on the above, I found myself
- wanting a generalization of
set_collect
that would allow to describe and summarize several separately specified labelings for one test - currentlyset_collect
is singular, whereasset_stats
is plural (andadd_stat
lets us add more)
and envious about
labelExamples
- to observe a sample from a label (e.g., "What's an example classified as a non-empty list?")checkCoverage
- to ensure a certain distribution (e.g., "At lease 10% of the test input isSome
with a non-empty list")
along the lines of the Haskell and Elm APIs:
https://hackage.haskell.org/package/QuickCheck-2.15.0.1/docs/Test-QuickCheck.html#g:21
https://package.elm-lang.org/packages/elm-explorations/test/2.2.0/Fuzz#labelExamples
https://package.elm-lang.org/packages/elm-explorations/test/2.2.0/Test-Distribution
https://package.elm-lang.org/packages/elm-explorations/test/2.2.0/Test#reportDistribution
Metadata
Metadata
Assignees
Labels
No labels