top | item 34743184

(no title)

hashkb | 3 years ago

You can mock the RNG. You don’t need to test/prove it’s random, you need to test your code which is not random.

discuss

order

hinkley|3 years ago

unit tests are notoriously bad about testing n>2. I just ran into a problem with sorting recently that was caused by buggy comparators, but it didn't bubble up to the tests until the runtime switched to a different sort implementation. Most of the tests were doing n=2 so it was not visible under the old runtime version but was under the new one. This has been broken in production for months if not years. If the test had used n=5 I'm pretty sure the old tests would fail as well.