I am writing a simple Lua pattern matching engine (similar to regex’s) in Ocaml and I’m a lazy tester so I wanted to use some quickchecking tool to make my life simpler. Quickchecking this is actually rather difficult though because predicting if the pattern would match or not involves writing the state machine again.
Instead, I decided to do something simpler, I generated two random strings and validated that they didn’t crash the matcher, not whether or not they matched or not. I found a lot of surprising bugs this way and it was really helpful.
I still had to write explicit tests to validate matching worked in the examples I could come up with but I took a way a valuable lesson in that even if I cannot define the property I want, simpler properties can bring a lot of value and confidence to the code as well.