Repository navigation
Releases
libhegel 0.53.3 binaries
SwiftPM binary targets for libhegel 0.53.3, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.53.3.
0.53.0
✨ New Features
-
Time zones and zoned datetimes:
.zonedDateTimedraws a zone, a wall-clock time in it
and, when the clocks repeated that time, which of the two instants it means. Draws aim at the
zone's transitions, so skipped and repeated wall times turn up in a short run:let meetings = Gen.zonedDateTime(zone: "America/New_York", allowImaginary: false) try Property.check { tc in let start = try tc.draw(meetings, named: "start") #expect(start.kind != .gap) }
Draw in one named zone, in zones your own generator picks, or in zones from
.zone(from: Zones(...)), which draws IANA names. Link names are included by default; legacy
names,Etc/Unknownand names only your own database knows are drawn when you ask. Bound the
draws by wall clock or by instant, leave out skipped times withallowImaginary: false, and
pick which instant of a repeated time you get withambiguous:. -
Zone sources: Zones resolve against the IANA database bundled in libhegel (2026e, see
tzdbVersion). To test against another database, build aZoneSourcefrom TZif files, zone
data given as transitions and a yearly rule, an offset oracle, links, or a loader that
supplies each name the first time a draw needs it. Pass it inZones(source:), or make it the
default withZoneSource.setDefault(_:). A source also answers queries outside a test:
resolve(_:in:),offset(in:at:),info(for:),zone(named:)andnames. -
Foundation's time zones as a zone source:
ZoneSource.foundationreads the time zone
database Foundation uses on the platform under test, so zoned datetimes drawn or resolved
against it agree withTimeZoneandCalendarthere:let meetings = Gen.zonedDateTime(zones: Zones(source: .foundation))
It holds every tz name Foundation knows (598 on macOS 26 and on Linux), loads each zone the
first time a draw needs it, and reports Foundation's tz data version as itsversion. Names
Foundation reads its own way, such asGMT+1andPST, are left out. On Linux and Windows,
Hegel now links FoundationInternationalization, which Foundation needs for named zones. -
Instants, offsets, durations and spans:
Timestampis an instant to the nanosecond,
UTCOffseta known offset in seconds or an unknown one, andCalendarSpanan amount in
units from years to nanoseconds. Each has a generator:.timestamp(in:precision:),
.utcOffset(in:granularity:allowUnknown:)and.calendarSpan(_:sign:).
.duration(in:precision:)draws Swift's ownDuration. -
Weekdays, months and precision:
.calendarDate(in:weekdays:months:)draws only the
weekdays and months you list.precision:on the time, datetime, timestamp, duration and
zoned datetime generators, and on.date, draws whole units:.secondsdraws no fraction,
and.hoursdraws on the hour.WeekdayandMonthare new enums, and
CalendarDate.weekdaytells you the day of the week. -
Foundation bridges: Hegel's time values meet Foundation's at the instant:
let instant = Timestamp(date) // and back: instant.date let local = LocalDateTime(date, in: .current) // its wall-clock time in a zone let timeZone = TimeZone(zone) // nil outside the tz database let fixed = TimeZone(UTCOffset.known(seconds: 3600)) // nil if unknown or past ±18 hours
No conversion goes through a
Calendar, whose Gregorian calendar turns Julian before
1582-10-15, so dates before then keep the proleptic Gregorian calendar.TimeZone(zone)
takes only tz database names, so Foundation's own readings of names such asGMT+1(an hour
east, where POSIX puts it west) andPSTnever stand in for a zone. -
Settings.projectDirectory: The directory the default database,.hegel/examples/, and
a relative database path resolve against, instead of the current directory..hegelsets it
to the test's package. Without Swift Testing, pass it toProperty.run, and set
HEGEL_CONFIGto thehegel.tomlto read.
🔧 Improvements
- libhegel 0.53.1: Updated the bundled libhegel to 0.53.1, which adds the time APIs above.
About one date or time draw in twenty now aims at a value that breaks code: a bound, a leap
day, the Unix epoch, the 32-bit limits, or a time zone transition. Between steps, a state
machine checks an invariant withouteveryStepwith a probability of at least 1% at each
step, not just one over its number of steps. A machine with more than 100 steps, as under
Antithesis, used to almost never check it. - Time values print as every Hegel frontend prints them: dates, times, timestamps, offsets,
spans and zoned datetimes print the engine's canonical ISO 8601, RFC 3339 and RFC 9557 text,
so a counterexample reads the same whichever language found it. - Time generators check their arguments when they are built: bounds that hold no whole
value at the precision, or an empty set of weekdays or months, are reported as a usage error
at the generator's first draw, with the engine's reason.
⚠️ Behaviour Changes
-
Dates span years ±999,999 by default:
CalendarDate.minand.max, and so the default
ranges of.calendarDate()and.localDateTime(), now run from year -999,999 to 999,999
instead of 1 to 9999. Years outside 0 to 9999 print in ISO 8601's expanded form:
+010000-01-01,-000001-12-31. To keep the old range, pass it:Gen.calendarDate(in: CalendarDate(year: 1, month: 1, day: 1)...CalendarDate(year: 9999, month: 12, day: 31))
.date()still draws Foundation dates in years 1 to 9999. -
HegelErrorhas a new case,.cancelled:Property.runandProperty.checkthrow it
when the task running them is cancelled;propertyturns it intoCancellationError. A
switchoverHegelErrorwith nodefaultneeds a case for it.
🐛 Fixes
.date()no longer draws 10000-01-01: At nanosecond precision, the last instant of year
9999 rounds up to year 10000 when stored as aDate. The default range now ends at
9999-12-31T23:59:59.999Z, and every draw is clamped to its range, so rounding never takes a
Datepast a bound.- Parameterized tests keep each test case's failures apart: In
@Test(.hegel, arguments: [...]), every argument shared one failure-database entry. An
argument that passed replayed another's saved counterexample, passed it, and deleted it, so
the failing argument lost its replay;.hegel(reproducing:)failed the other arguments with
"did not reproduce". Each test case now has its own entry, and a test without arguments keeps
its old one, so saved failures still replay. The reproduce hint names the failing test case,
.hegel(reproducing: "...", arguments: "mode: .fast"), and only that test case replays the
blob. - A cancelled test stops its property run: When Swift Testing cancels a test, as
.timeLimitdoes, the run used to keep generating cases. An async body that saw the
cancellation threwCancellationError, which Hegel shrank, reported as a counterexample and
saved, so the next run replayed it first. Now the run stops after the test case in flight,
nothing is shrunk, reported or saved for it, andpropertythrowsCancellationError, so
Swift Testing reports only the time limit. This covers explicit examples, generation,
shrinking and.hegel(reproducing:)replays, for synchronous and async bodies. - Synchronous properties no longer starve async ones: A synchronous
propertyholds its
thread for its whole run..hegelran tests on Swift's cooperative pool, one thread per core,
so synchronous properties running in parallel could hold every thread, and async properties
and Swift Testing's own reporting waited until one ended. With 32 synchronous properties on
16 cores, an async property waited 7.5 s between two test cases, long enough for the TooSlow
health check to fail it..hegelnow runs its tests on threads of Hegel's own, as many as
the machine has cores, and an asyncpropertyhands its test cases back to the cooperative
pool: the same property's longest wait is now 3.9 ms. A test that sets its own task executor
preference keeps it, so a workaround such as a NIO thread pool still works and can go. The
rest of an async test, outsideproperty, runs on Hegel's threads and can still wait for
one. - Xcode runs use the package's
hegel.tomland failure database: The engine finds both
from the current directory.swift testruns a package's tests from its root, but Xcode and
xcodebuild teststart them elsewhere, such as/private/tmp. A test that named a
hegel.tomlprofile failed with "unknown settings profile", the file'sdefaultentry and
overrides ofdevelopmentandciwere silently ignored, and failures were saved where
swift testnever looked..hegelnow finds both from the test's package, the nearest
directory above the test's file that holds aPackage.swift:- Before any test runs, it points
HEGEL_CONFIGat the package'shegel.tomlwhen the
engine wouldn't find it from the current directory. AHEGEL_CONFIGyou set stays as it
is. - The default database and a relative database path resolve against the package. A disabled
database or an absolute path stays as it is. - The engine reads one
hegel.tomlper test process, so when one process runs the tests of
packages with differenthegel.tomlfiles, the first package's applies..hegelrecords a
warning that names a package'shegel.tomlwhen it doesn't apply, and says why.
- Before any test runs, it points
- Stall limits no longer count the time a task waits to start:
withStallDetection(after:)
andwithRandomCancellation(stallsAfter:)started their clock before the body's task was
scheduled. With every thread busy, as when many tests run in parallel underxcodebuild test,
a body...
libhegel 0.53.2 binaries
SwiftPM binary targets for libhegel 0.53.2, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.53.2.
libhegel 0.53.1 binaries
SwiftPM binary targets for libhegel 0.53.1, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.53.1.
0.52.0
✨ New Features
-
Verbose runs stream each test case: With
verbosity: .verbose, every test case's draws
and notes are now printed as it runs, and a concurrent state machine's round by round. Each
failing case is followed by one line that says what failed. For a property in Swift Testing,
that's the failed expectation, led by its location:let n = 10 MyTests/SortTests.swift:12:9: Expectation failed: n < 10 (error)Otherwise it's the error's type and the first line of its message, followed by
…when the
message goes on..debugprints each failing case's whole error instead. Anoutput:
handler receives these lines too. It can now be called from a concurrent worker's thread,
not only the one that runs the property.
🔧 Improvements
-
libhegel 0.52.0: Updated the bundled libhegel to 0.52.0. The engine now prints each test
case's output itself, as soon as it can no longer change, instead of keeping all of it in
memory until the test case ends. Since 0.51.6 it also frees the empty output regions that
worker rounds and rule steps open. Together, these keep the memory of a long-running test
case, such as aConcurrentStateMachineorconcurrentlyworkload under Antithesis, flat at
every verbosity.Failure reports are unchanged: the shrunk example's draws and notes, its error, and how to
reproduce it. A quiet run still prints nothing, and its report still has no draws. No code
changes are needed.
libhegel 0.53.0 binaries
SwiftPM binary targets for libhegel 0.53.0, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.53.0.
0.51.9
🔧 Improvements
-
libhegel 0.51.6: Updated the bundled libhegel to 0.51.6. Long-running concurrent state
machines no longer use more and more memory as they run. Every worker round and every rule
step opens an output region, and the engine used to keep each one until the test case ended,
even when nothing was printed into it. Now an empty region is freed as soon as its last
handle is released. AConcurrentStateMachineorconcurrentlyworkload that runs for a
long time inside one test case, such as under Antithesis, keeps a flat memory footprint.
Regions that do hold output are still kept until the test case ends, so a verbose
long-running case still grows with what it prints.The API is unchanged, and no code changes are needed.
libhegel 0.52.0 binaries
SwiftPM binary targets for libhegel 0.52.0, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.52.0.
0.51.8
✨ New Features
-
reachingAfter: reach claims for states only deep runs reach: Some states are too rare
for a short run to hit reliably but show up dependably in a deep one. List them in
reachingAfter, each label mapped to the number of passing generated cases a run needs
before the claim is checked:try property( reaching: ["ends inside a body"], reachingAfter: ["ends on a frame boundary": 1_000] ) { tc in ... }
The run counts its own passing cases, so the claim follows the real depth however it was
set: ahegel.tomlprofile, the test's owntestCases,HEGEL_TEST_CASESor
HEGEL_TEST_CASES_SCALE. Suites no longer need to guess a run's depth fromHEGEL_*
environment variables, a guess that missed most of those sources. A short run skips the
claim, and a run that reaches the threshold without seeing the state fails just like a
reachingclaim. It works withproperty(...)in Swift Testing and withProperty.run,
which throwsHegelError.unreached.reaching:is unchanged, so existing callers keep
compiling.
📖 Documentation
- The README, the
hegel-property-testingskill and its oracles reference now explain when to
usereachingAfterand warn against guessing a run's depth fromHEGEL_*variables.
0.51.7
✨ New Features
-
HEGEL_TEST_CASES_SCALE: Run every property deeper without losing the relative cost of
each. The scale multiplies the count each property resolves to, its owntestCasesor the
profile's, so withHEGEL_TEST_CASES_SCALE=50a 200-case property runs 10,000 cases and an
expensive state machine's 20 becomes 1,000. Any positive number works (0.1for a quick
pass). Counts round up, never drop below 1, and saturate instead of overflowing. An explicit
HEGEL_TEST_CASESstill wins outright, and a malformed value is reported as a usage error.# a scheduled deep run: fresh inputs, every property 50 times deeper HEGEL_DEFAULT_PROFILE=nightly HEGEL_TEST_CASES_SCALE=50 swift test
📖 Documentation
- Profile
test_casesprecedence is now documented: a property's owntestCaseswins over
ahegel.tomlprofile'stest_cases, so a profile's count applies only to properties that
don't set one. In a suite where every property sets its count, anightlyprofile that only
raisestest_caseschanges nothing. The README, theSettingsdocs and the
hegel-property-testingskill now say so, and theirnightlyexamples put the depth in
HEGEL_TEST_CASES_SCALEinstead of the profile.