Hacker News new | ask | show | jobs
by siscia 2111 days ago
I implemented a tiny and simple data structure in rust, a circular buffer: https://github.com/RedBeardLab/circular-buffer-rs

The amount of subtle bugs and problems that proptest was able to point out to me was terrific.

Property based testing it is definitely the tool that you want to use to thoroughly test a complex library that need to maintains its invariants.

The interesting bit is that if you approach the problem with unittest, you will write mostly test that pass. If you approach the test writing as a property test, then you will write much harder test cases.

1 comments

Apropos hard test cases: have a look at the floats that Python's Hypothesis property testing library generates. They are truly evil.