How to test your code—part 3

An example of a real automated test

Following my last two posts on automated testing, and since one picture is worth many words, I’m showing you a real automated test that I’ve written for a library that calculates evaporation:

This test, together with about 40 others, runs in a bit less than 2 seconds whenever I enter the appropriate command. As a result, I am free to modify the calculating code as much as I want. For example, if a function is messy and I want to rewrite it, I can go ahead without fearing I’ll break something.