Write a unit test abstraction for tests that need to be repeated multiple times to prove failure
Some unit tests succeed at random with a certain probability, so we need to repeat them a number of times until the failure rate is acceptable.
Typically, we make sure the failure rate is less than the hardware bit error rate.
But we could standardise this, by taking the following inputs:
- test function with success/fail return value,
- the probability of success regardless of whether the code actually works,
- the desired overall probability of failure by chance (for example, the bit error rate).
The abstraction would then repeat the test enough times to make sure the failure rate is less than the bit error rate.
We might also want to check that the distribution of returned values is uniform, but I think that's a separate (and more complex) ticket.