From 31d769e7200c85fc81ff4483c9a270aac83aaba4 Mon Sep 17 00:00:00 2001 From: Rain Date: Sun, 15 Nov 2026 14:26:54 -0800 Subject: [PATCH] [meta] update hegeltest --- .gitignore | 2 +- AGENTS.md | 5 + Cargo.lock | 303 ++++-------------- Cargo.toml | 2 +- crates/iddqd/tests/integration/bi_hash_map.rs | 16 +- .../iddqd/tests/integration/hegel_support.rs | 8 +- crates/iddqd/tests/integration/id_hash_map.rs | 16 +- crates/iddqd/tests/integration/id_ord_map.rs | 16 +- .../iddqd/tests/integration/tri_hash_map.rs | 16 +- 9 files changed, 111 insertions(+), 273 deletions(-) create mode 100644 AGENTS.md diff --git a/.gitignore b/.gitignore index ad1edc51..9a55a510 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ *.llbc.json *.ullbc # Hegel property-test failure database, created on failing local runs. -/.hegel/ +.hegel/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..2d36e29e --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,5 @@ +# Agent instructions + +## Testing + +- Hegel state-machine invariants must always be declared `#[invariant(always_run)]`, never a plain `#[invariant]`. A plain invariant is only sampled between steps (about once per test case), so intermediate states would go unchecked. diff --git a/Cargo.lock b/Cargo.lock index f80a2b50..0605b4fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,56 +29,12 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" -[[package]] -name = "anstream" -version = "0.6.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - [[package]] name = "anstyle" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" -[[package]] -name = "anstyle-parse" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys 0.61.2", -] - [[package]] name = "atomicwrites" version = "0.4.4" @@ -98,9 +54,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" [[package]] name = "bumpalo" @@ -123,42 +79,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" -[[package]] -name = "cbindgen" -version = "0.29.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ecb53484c9c167ba674026b656d8a27d7657a58e6066aa902bfb1a4aa00ae20" -dependencies = [ - "clap", - "heck", - "indexmap 2.14.0", - "log", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn", - "tempfile", - "toml 0.9.12+spec-1.1.0", -] - [[package]] name = "cfg-if" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" -[[package]] -name = "chacha20" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" -dependencies = [ - "cfg-if", - "cpufeatures", - "rand_core 0.10.1", -] - [[package]] name = "ciborium" version = "0.2.2" @@ -201,10 +127,8 @@ version = "4.5.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65" dependencies = [ - "anstream", "anstyle", "clap_lex", - "strsim", ] [[package]] @@ -213,12 +137,6 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" -[[package]] -name = "colorchoice" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" - [[package]] name = "console" version = "0.15.11" @@ -232,24 +150,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "cpufeatures" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" -dependencies = [ - "cfg-if", -] - [[package]] name = "criterion" version = "0.7.0" @@ -325,20 +225,22 @@ dependencies = [ [[package]] name = "dashu-base" -version = "0.4.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993b95dc1b248e3f5747dcb017a41d6e75853a2e5ee4504f7d537c5b8dffdae4" +checksum = "861a614e79388a4c72aa66b0bdabc91e3a4f30d53e0c8d962953e207d75884d0" +dependencies = [ + "num-modular", +] [[package]] name = "dashu-int" -version = "0.4.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c05a0d5cb0b39fcc87c46432fdac24b90dce239857c7f6b798be4ffc3c42c6" +checksum = "64a0490b40a6a3f6427970035f17f76fd59c01d3cd9f9140809672863a0d64c8" dependencies = [ "cfg-if", "dashu-base", "num-modular", - "rustversion", "static_assertions", ] @@ -385,7 +287,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -426,22 +328,10 @@ checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "libc", - "r-efi 5.2.0", + "r-efi", "wasi", ] -[[package]] -name = "getrandom" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" -dependencies = [ - "cfg-if", - "libc", - "r-efi 6.0.0", - "rand_core 0.10.1", -] - [[package]] name = "glob" version = "0.3.3" @@ -492,47 +382,38 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hegeltest" -version = "0.23.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8bcee4716fe693734b22fd0faa3d9062871460a685fa14367f8ce597faeef5" +checksum = "eadd91ef63aef2de1cfa586495cac7a6416201ca1ba3f0cfb91d49f4f280c0e9" dependencies = [ - "ciborium", - "crc32fast", - "dashu-int", "hegeltest-c", "hegeltest-macros", - "miniz_oxide", "parking_lot", - "paste", - "rand 0.10.1", - "rustc-hash", - "serde", - "tempfile", ] [[package]] name = "hegeltest-c" -version = "0.23.1" +version = "0.51.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "499774b9885ffea34db69353dc9c5b6afbb010fdad77c4ea86ca7a002fc381f0" +checksum = "14f5cc626246e4b6f57f2b89871bda8cb7ccc2703f4bd8f91b1227f9b51ea99a" dependencies = [ - "cbindgen", - "ciborium", - "crc32fast", "dashu-int", + "hashbrown 0.17.1", + "libm", "miniz_oxide", - "parking_lot", - "rand 0.10.1", + "once_cell", + "rand 0.10.4", "rustc-hash", - "serde", - "tempfile", + "rustix 1.1.6", + "toml", + "windows-sys 0.61.2", ] [[package]] name = "hegeltest-macros" -version = "0.23.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84041698f9fe77b269fdce7c2edb8b1d319daee3ef211c1566a891819dc56ba3" +checksum = "fe13dba099a4fec1cb3aff54785e3cbf76b682241ac2fcb6d867e486ff21f505" dependencies = [ "proc-macro2", "quote", @@ -635,12 +516,6 @@ dependencies = [ "hashbrown 0.17.1", ] -[[package]] -name = "is_terminal_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" - [[package]] name = "itertools" version = "0.13.0" @@ -674,9 +549,15 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.174" +version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "linux-raw-sys" @@ -686,9 +567,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.9.4" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "lock_api" @@ -731,9 +612,9 @@ dependencies = [ [[package]] name = "num-modular" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc41a1374056e9672221567958a66c16be12d0e2c1b408761e14d901c237d5e0" +checksum = "bd8e500409e6cd603b03e477c26a6caecdc27ac58979a53e881c75eafc079f44" [[package]] name = "num-traits" @@ -750,12 +631,6 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" -[[package]] -name = "once_cell_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - [[package]] name = "oorandom" version = "11.1.5" @@ -868,12 +743,6 @@ version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" -[[package]] -name = "r-efi" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" - [[package]] name = "rand" version = "0.9.4" @@ -886,12 +755,10 @@ dependencies = [ [[package]] name = "rand" -version = "0.10.1" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" dependencies = [ - "chacha20", - "getrandom 0.4.3", "rand_core 0.10.1", ] @@ -911,7 +778,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.3", + "getrandom", ] [[package]] @@ -1019,9 +886,9 @@ dependencies = [ [[package]] name = "rustc-hash" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustix" @@ -1033,20 +900,20 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] name = "rustix" -version = "1.0.7" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", + "linux-raw-sys 0.12.1", + "windows-sys 0.52.0", ] [[package]] @@ -1166,9 +1033,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782" dependencies = [ "serde_core", ] @@ -1209,12 +1076,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "structmeta" version = "0.3.0" @@ -1262,10 +1123,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ "fastrand", - "getrandom 0.3.3", + "getrandom", "once_cell", - "rustix 1.0.7", - "windows-sys 0.59.0", + "rustix 1.1.6", + "windows-sys 0.52.0", ] [[package]] @@ -1322,66 +1183,42 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.12+spec-1.1.0" +version = "1.2.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7" dependencies = [ "indexmap 2.14.0", "serde_core", "serde_spanned", - "toml_datetime 0.7.5+spec-1.1.0", + "toml_datetime", "toml_parser", "toml_writer", - "winnow 0.7.15", -] - -[[package]] -name = "toml" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" -dependencies = [ - "indexmap 2.14.0", - "serde_core", - "serde_spanned", - "toml_datetime 1.1.1+spec-1.1.0", - "toml_parser", - "toml_writer", - "winnow 1.0.3", + "winnow", ] [[package]] name = "toml_datetime" -version = "0.7.5+spec-1.1.0" +version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_datetime" -version = "1.1.1+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" dependencies = [ "serde_core", ] [[package]] name = "toml_parser" -version = "1.1.2+spec-1.1.0" +version = "1.1.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" dependencies = [ - "winnow 1.0.3", + "winnow", ] [[package]] name = "toml_writer" -version = "1.1.1+spec-1.1.0" +version = "1.2.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" +checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a" [[package]] name = "trybuild" @@ -1395,7 +1232,7 @@ dependencies = [ "serde_json", "target-tuple", "termcolor", - "toml 1.1.2+spec-1.1.0", + "toml", ] [[package]] @@ -1469,12 +1306,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "walkdir" version = "2.5.0" @@ -1568,7 +1399,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -1668,12 +1499,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" - [[package]] name = "winnow" version = "1.0.3" diff --git a/Cargo.toml b/Cargo.toml index e3ccd49d..05ea0ed3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ foldhash = "0.2.0" # allocator-api2 is turned on, then for e.g. IdHashMap, otherwise # IdHashMap.) hashbrown = { version = "0.17.1", default-features = false, features = ["allocator-api2", "inline-more"] } -hegeltest = "0.23.1" +hegeltest = { version = "0.52.6", features = ["static-engine"] } hugealloc = "0.1.1" iddqd = { path = "crates/iddqd", default-features = false } iddqd-test-utils = { path = "crates/iddqd-test-utils" } diff --git a/crates/iddqd/tests/integration/bi_hash_map.rs b/crates/iddqd/tests/integration/bi_hash_map.rs index 8df24cca..91867417 100644 --- a/crates/iddqd/tests/integration/bi_hash_map.rs +++ b/crates/iddqd/tests/integration/bi_hash_map.rs @@ -523,7 +523,7 @@ impl BiHashMapMachine { self.check_valid(CompactnessChange::BecomesCompact); } - #[invariant] + #[invariant(always_run)] fn iter_matches(&mut self, _: TestCase) { let mut naive_items = self.naive.iter().collect::>(); naive_items.sort_by(|a, b| a.key1().cmp(&b.key1())); @@ -538,7 +538,7 @@ fn proptest_ops(tc: TestCase) { naive: NaiveMap::new_key12(), compactness: ValidateCompact::Compact, }; - hegel::stateful::run(machine, tc); + hegel::stateful::machine(machine).run(tc); } #[hegel::test(test_cases = 64)] @@ -1401,9 +1401,10 @@ mod proptest_panic_safety { panic_safety: PanicSafety, op: impl FnOnce(&mut PanickyMap), ) { - // hegel runs the `#[invariant]` (which consumes `pending`) after - // every successful rule, so `pending` must be `None` here -- if - // not, a prior op's post-op checks were silently skipped. + // hegel runs the `#[invariant(always_run)]` (which consumes + // `pending`) after every successful rule, so `pending` must be + // `None` here -- if not, a prior op's post-op checks were silently + // skipped. assert!( self.pending.is_none(), "previous op's post-op invariant did not run before this op", @@ -1616,7 +1617,7 @@ mod proptest_panic_safety { }); } - #[invariant] + #[invariant(always_run)] fn check_post_op(&mut self, _: TestCase) { let Some(p) = self.pending.take() else { self.map @@ -1662,6 +1663,7 @@ mod proptest_panic_safety { iddqd::DefaultHashBuilder::default(), PanickyAlloc::default(), ); - hegel::stateful::run(PanicMachine { map, step: 0, pending: None }, tc); + hegel::stateful::machine(PanicMachine { map, step: 0, pending: None }) + .run(tc); } } diff --git a/crates/iddqd/tests/integration/hegel_support.rs b/crates/iddqd/tests/integration/hegel_support.rs index 57c2720f..e5345c19 100644 --- a/crates/iddqd/tests/integration/hegel_support.rs +++ b/crates/iddqd/tests/integration/hegel_support.rs @@ -9,10 +9,10 @@ const MAX_KEY2_CODEPOINT: u8 = 0x7f; /// Returns a [`TestItem`] with random keys and values. #[hegel::composite] -pub(crate) fn test_item(tc: TestCase) -> TestItem { - let key1 = draw_random_key1(&tc); - let key2 = draw_random_key2(&tc); - let key3 = draw_random_key3(&tc); +pub(crate) fn test_item(tc: &TestCase) -> TestItem { + let key1 = draw_random_key1(tc); + let key2 = draw_random_key2(tc); + let key3 = draw_random_key3(tc); let value = tc.draw(gs::text()); TestItem::new(key1, key2, key3, value) } diff --git a/crates/iddqd/tests/integration/id_hash_map.rs b/crates/iddqd/tests/integration/id_hash_map.rs index 7079eb9c..c8fa15f8 100644 --- a/crates/iddqd/tests/integration/id_hash_map.rs +++ b/crates/iddqd/tests/integration/id_hash_map.rs @@ -450,7 +450,7 @@ impl IdHashMapMachine { self.check_valid(CompactnessChange::BecomesCompact); } - #[invariant] + #[invariant(always_run)] fn iter_matches(&mut self, _: TestCase) { let mut naive_items = self.naive.iter().collect::>(); naive_items.sort_by(|a, b| a.key().cmp(&b.key())); @@ -465,7 +465,7 @@ fn proptest_ops(tc: TestCase) { naive: NaiveMap::new_key1(), compactness: ValidateCompact::Compact, }; - hegel::stateful::run(machine, tc); + hegel::stateful::machine(machine).run(tc); } #[hegel::test(test_cases = 64)] @@ -1055,9 +1055,10 @@ mod proptest_panic_safety { panic_safety: PanicSafety, op: impl FnOnce(&mut PanickyMap), ) { - // hegel runs the `#[invariant]` (which consumes `pending`) after - // every successful rule, so `pending` must be `None` here -- if - // not, a prior op's post-op checks were silently skipped. + // hegel runs the `#[invariant(always_run)]` (which consumes + // `pending`) after every successful rule, so `pending` must be + // `None` here -- if not, a prior op's post-op checks were silently + // skipped. assert!( self.pending.is_none(), "previous op's post-op invariant did not run before this op", @@ -1227,7 +1228,7 @@ mod proptest_panic_safety { }); } - #[invariant] + #[invariant(always_run)] fn check_post_op(&mut self, _: TestCase) { let Some(p) = self.pending.take() else { self.map @@ -1269,6 +1270,7 @@ mod proptest_panic_safety { iddqd::DefaultHashBuilder::default(), PanickyAlloc::default(), ); - hegel::stateful::run(PanicMachine { map, step: 0, pending: None }, tc); + hegel::stateful::machine(PanicMachine { map, step: 0, pending: None }) + .run(tc); } } diff --git a/crates/iddqd/tests/integration/id_ord_map.rs b/crates/iddqd/tests/integration/id_ord_map.rs index a4f91366..b7c2ea8f 100644 --- a/crates/iddqd/tests/integration/id_ord_map.rs +++ b/crates/iddqd/tests/integration/id_ord_map.rs @@ -527,7 +527,7 @@ impl IdOrdMapMachine { self.check_valid(CompactnessChange::BecomesCompact); } - #[invariant] + #[invariant(always_run)] fn iter_matches(&mut self, _: TestCase) { let mut naive_items = self.naive.iter().collect::>(); naive_items.sort_by(|a, b| a.key().cmp(&b.key())); @@ -542,7 +542,7 @@ fn proptest_ops(tc: TestCase) { naive: NaiveMap::new_key1(), compactness: ValidateCompact::Compact, }; - hegel::stateful::run(machine, tc); + hegel::stateful::machine(machine).run(tc); } #[hegel::test(test_cases = 64)] @@ -1310,9 +1310,10 @@ mod proptest_panic_safety { panic_safety: PanicSafety, op: impl FnOnce(&mut IdOrdMap), ) { - // hegel runs the `#[invariant]` (which consumes `pending`) after - // every successful rule, so `pending` must be `None` here -- if - // not, a prior op's post-op checks were silently skipped. + // hegel runs the `#[invariant(always_run)]` (which consumes + // `pending`) after every successful rule, so `pending` must be + // `None` here -- if not, a prior op's post-op checks were silently + // skipped. assert!( self.pending.is_none(), "previous op's post-op invariant did not run before this op", @@ -1479,7 +1480,7 @@ mod proptest_panic_safety { ); } - #[invariant] + #[invariant(always_run)] fn check_post_op(&mut self, _: TestCase) { let Some(p) = self.pending.take() else { self.map @@ -1518,6 +1519,7 @@ mod proptest_panic_safety { #[hegel::test(test_cases = 512)] fn proptest_panic_ops(tc: TestCase) { let map = IdOrdMap::::new(); - hegel::stateful::run(PanicMachine { map, step: 0, pending: None }, tc); + hegel::stateful::machine(PanicMachine { map, step: 0, pending: None }) + .run(tc); } } diff --git a/crates/iddqd/tests/integration/tri_hash_map.rs b/crates/iddqd/tests/integration/tri_hash_map.rs index 2244d044..9eecf271 100644 --- a/crates/iddqd/tests/integration/tri_hash_map.rs +++ b/crates/iddqd/tests/integration/tri_hash_map.rs @@ -528,7 +528,7 @@ impl TriHashMapMachine { self.check_valid(CompactnessChange::BecomesCompact); } - #[invariant] + #[invariant(always_run)] fn iter_matches(&mut self, _: TestCase) { let mut naive_items = self.naive.iter().collect::>(); naive_items.sort_by(|a, b| a.key1().cmp(&b.key1())); @@ -543,7 +543,7 @@ fn proptest_ops(tc: TestCase) { naive: NaiveMap::new_key123(), compactness: ValidateCompact::Compact, }; - hegel::stateful::run(machine, tc); + hegel::stateful::machine(machine).run(tc); } #[hegel::test(test_cases = 64)] @@ -1244,9 +1244,10 @@ mod proptest_panic_safety { panic_safety: PanicSafety, op: impl FnOnce(&mut PanickyMap), ) { - // hegel runs the `#[invariant]` (which consumes `pending`) after - // every successful rule, so `pending` must be `None` here -- if - // not, a prior op's post-op checks were silently skipped. + // hegel runs the `#[invariant(always_run)]` (which consumes + // `pending`) after every successful rule, so `pending` must be + // `None` here -- if not, a prior op's post-op checks were silently + // skipped. assert!( self.pending.is_none(), "previous op's post-op invariant did not run before this op", @@ -1438,7 +1439,7 @@ mod proptest_panic_safety { }); } - #[invariant] + #[invariant(always_run)] fn check_post_op(&mut self, _: TestCase) { let Some(p) = self.pending.take() else { self.map @@ -1486,6 +1487,7 @@ mod proptest_panic_safety { iddqd::DefaultHashBuilder::default(), PanickyAlloc::default(), ); - hegel::stateful::run(PanicMachine { map, step: 0, pending: None }, tc); + hegel::stateful::machine(PanicMachine { map, step: 0, pending: None }) + .run(tc); } }