¶“Imperative” property testing and the arbtest crate
2025-05-01
Came across a new crate for property testing in Rust. It's called arbtest, written by matklad.
It aims to provide a simpler API than quickcheck and proptest. In particular, it follows the pattern of “imperative property testing”. Instead of using macro wizardry to inject random instances of a fixed set of datatypes, you are provided a source of random data, and it's up to you to generate whatever data you need by drawing bits from that random data source. In this aspect, it's similar to rapid on the Go side.
I came across this via an interesting path: Tony Finch described an “element-wise” approach to testing a data structure (as opposed to the more common “example-wise”), which was in response to a matklad post about “swarm testing” data structures. matklad mentioned arbtest in passing in a comment on the Lobsters discussion for the original post.
Testing data structures per element [fanf]
Swarm testing data structures [matklad, tigerbeetle.com]