DenseCheck 0.1.0
dotnet add package DenseCheck --version 0.1.0
NuGet\Install-Package DenseCheck -Version 0.1.0
<PackageReference Include="DenseCheck" Version="0.1.0" />
<PackageVersion Include="DenseCheck" Version="0.1.0" />
<PackageReference Include="DenseCheck" />
paket add DenseCheck --version 0.1.0
#r "nuget: DenseCheck, 0.1.0"
#:package DenseCheck@0.1.0
#addin nuget:?package=DenseCheck&version=0.1.0
#tool nuget:?package=DenseCheck&version=0.1.0
DenseCheck
DenseCheck is a companion tool for property based testing frameworks like FsCheck, which help you generate test data to validate properties about your code.
How is DenseCheck different from FsCheck?
- FsCheck generates random instances of your types to test properties
- DenseCheck systematically constructs functions that creates a simple integer to all possible instances of your function, making the entire set of your type denumerable.
Why use DenseCheck?
- FsCheck's random generation can miss edge cases or important scenarios in your domain model.
- DenseCheck allows you to thoroughly test smaller value spaces in a systematic way random generation cannot.
Domain Model Checking Made Enumerable!
DenseCheck is a deterministic domain exploration tool for F# that treats your types as sets of the values they inhabit, providing you an infinite and indexable catalog of values you can enumerate and explore.
How It Works
1. Define a Domain Model or Type
Start with a domain model like this simple role based access control system:
type Role =
| Admin
| Editor
| Viewer
type AccessRule =
| HasRole of Role
| And of AccessRule * AccessRule
| Or of AccessRule * AccessRule
| Not of AccessRule
2. Ask for a catalog of all possible instances
let getAccessRule = DenseCheck.getIndex<AccessRule> ()
3. Enumerate the first 10 instances
let terms = [ for i in 0I .. 29I -> getAccessRule i ]
// It will return a list of terms like this:
let expected =
[ HasRole Admin
And(HasRole Admin, HasRole Admin)
Or(HasRole Admin, HasRole Admin)
Not(HasRole Admin)
HasRole Editor
And(HasRole Admin, And(HasRole Admin, HasRole Admin))
Or(HasRole Admin, And(HasRole Admin, HasRole Admin))
Not(And(HasRole Admin, HasRole Admin))
HasRole Viewer
And(And(HasRole Admin, HasRole Admin), HasRole Admin) ]
4. Get a Randomly Large Instance
let bigRule = getAccessRule 123987123098123987324987234I
// bigRule will be something like this:
let expected =
Or(
Or(
Or(
Or(HasRole Editor, Not(HasRole Admin)),
Not(Not(And(Or(HasRole Admin, HasRole Admin), Or(HasRole Admin, HasRole Admin))))
),
Not(Or(Or(Not(And(HasRole Admin, HasRole Admin)), HasRole Editor), HasRole Viewer))
),
Or(
Not(Or(HasRole Viewer, HasRole Viewer)),
Or(
And(And(HasRole Admin, And(HasRole Admin, HasRole Admin)), And(HasRole Admin, HasRole Admin)),
Or(Not(Or(HasRole Admin, HasRole Admin)), And(HasRole Admin, HasRole Admin))
)
)
)
This is all well and good, but domain models always feel abstract. It would be nice if we could quickly generate some concrete examples of our AccessRule to see what sorts of scenarios our model allows.
Instead of using FsCheck random generation or property based testing, we can use the Instance Catalog to enumerate all the possible AccessRule instances.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FSharp.Core (>= 10.0.100)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 669 | 12/2/2025 |