Hegel 0.1.3
dotnet add package Hegel --version 0.1.3
NuGet\Install-Package Hegel -Version 0.1.3
<PackageReference Include="Hegel" Version="0.1.3" />
<PackageVersion Include="Hegel" Version="0.1.3" />
<PackageReference Include="Hegel" />
paket add Hegel --version 0.1.3
#r "nuget: Hegel, 0.1.3"
#:package Hegel@0.1.3
#addin nuget:?package=Hegel&version=0.1.3
#tool nuget:?package=Hegel&version=0.1.3
hegel-dotnet
Property-based testing for F#, powered by the native Hegel engine. Write properties; the engine generates inputs and shrinks failures to a minimal counterexample — you never write a shrinker.
Early (v0.1): primitives, core combinators, collections, and the
[<Property>]xUnit attribute. Not yet full Hypothesis parity.
Install
dotnet add package Hegel.Xunit # pulls in Hegel transitively
Quickstart
module Example
open Xunit
open Hegel
open Hegel.Xunit
[<Property>]
let ``reversing a list twice is the identity`` (tc: TestCase) =
let xs = tc.Draw(Gen.lists (Gen.integers ()))
Assert.Equal<int list>(xs, xs |> List.rev |> List.rev)
dotnet test runs it as one node over many generated cases; a failure prints the shrunk
counterexample (e.g. Falsifying example: 100).
Generators
Draw with tc.Draw(gen):
| Primitives | integers longs booleans floats text bytes — ints take .Min(..).Max(..) |
| Combinators | map bind filter optional oneOf sampledFrom just |
| Collections | lists set maps tuple2 tuple3 |
gen { } sequences dependent draws:
gen {
let! lo = Gen.integers().Min(0).Max(100)
let! hi = Gen.integers().Min(lo).Max(200)
return (lo, hi)
}
How it works
A thin client over the native libhegel (Rust) — P/Invoke + CBOR, no Python or subprocess.
Generators are deterministic functions of the engine's choice sequence, so shrinking runs
engine-side. The native ships per-RID in the package (osx-arm64, linux-x64/arm64,
win-x64/arm64); override it with HEGEL_LIBHEGEL_PATH.
Develop
nix develop # pinned .NET 10 SDK (+ just, python3)
just build
just test
just pack # fetch all natives + build the packages
License
MIT. The bundled libhegel is MIT (© Antithesis, LLC) — see THIRD-PARTY-NOTICES.txt.
| 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.1.301)
- System.Formats.Cbor (>= 9.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Hegel:
| Package | Downloads |
|---|---|
|
Hegel.Xunit
xUnit integration for hegel-dotnet: the [Property] attribute. |
GitHub repositories
This package is not used by any popular GitHub repositories.