That means you have to define the law in terms of the input and output. Rather than fix the input like you'd do on a regular test and just assert the output.
The hard part is trying to figure out what laws you should expect from your functions.
That means you have to define the law in terms of the input and output. Rather than fix the input like you'd do on a regular test and just assert the output.
The hard part is trying to figure out what laws you should expect from your functions.
Just asking yourself what laws a function should adhere to as you are considering writing it function puts you in a different frame of mind and you can end up with simpler software.
Special casing is effectively traditional testing: input is 1, output is 2.
This assumption is what are "blind implementation voting systems" were based on, and it was proved to not survive that well in practice. It may totally work in your case, but you may be interested in looking at the work on Nancy Leveson at the MIT (all links are from her website)
http://sunnyday.mit.edu/papers/nver-tse.pdf
http://sunnyday.mit.edu/critics.pdf
http://sunnyday.mit.edu/papers/nver2.pdf
http://sunnyday.mit.edu/papers/consistent-comp.pdf
This body of work launched quite a controversy, but well, it is still here...