|
|
|
|
|
by drothlis
1254 days ago
|
|
I'm not the OP but I think Fibonacci is a contrived example. In practice these "characterisation tests" are great for adding tests to an existing codebase. The "snapshot" just records the current behaviour; it doesn't judge whether it's correct or not, but if you refactor it will catch changes to the behaviour, and then it's up to a human to judge if the changes were desirable or not. |
|
I.e. For all x, Fib(x+2)=Fib(x)+Fib(x+1)
A property based test produces values of x and tests this property (or invariant).
If it fails the framework usually then tries to find the simplest failing case.