News for hackers. Stuff that matters.
Re:What if writing tests was a joyful experience? by angio on Saturday January 14, 2023 @07:10AM (#34379646)
I believe the way to test it is to have a property like `n in integer | fib(n+2) == fib(n+1) + fib(n)`. This is close to the naive (but obviously correct?) implementation of fib and can be used to test the optimized version of the function.

You can also test that the sequence is increasing like `fib(n+2) > fib(n+1) > fib(n)`.

There are no comments on this comment yet.