I like to pursue quality in software, and so I am constantly looking for innovative or smart ways in which to improve quality.
One approach I have always liked is the concept of Fuzzing. Basically fuzzing means to feed random or cleverly provocative data into your innocent and carefree API to wreck complete havoc and expose all its bad traits/bugs/unexpected features etc.
But I am reluctant to bring new dependencies into my project if I can avoid it. So how could we implement a built-in fuzzing in the least amount of code?
I came up with the approach below which I find myself being really happy with! Here the qrand() function could be exchanged with a more devious/evolutionary and data driven fuzz data generator function.