NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
test it with values that you know... (Score:1)
To program a function that returns something, you need to know what it returns, so that you know you reached your goal. You have to ask yourself if it is possible to capture the conditions that tell you 'you are done. this works like it should'.
For some functions it might be that you have to test it with a value that you experienced with a special OS/CPU combination. For other functions you might want to write and I/O test for the data processing. This is called Glas-Box testing. And last but not least you might want to write mock tests.
To learn more about this and other stuff you might want to read Michael Schwerns talk on testing [guild.net].
Reply to This
Re:test it with values that you know... (Score:2)
This sounds extremely fragile to me. At some point, a new release of the operating system is being made and suddenly the values I experienced may have changed.
I eventually did find a solution, although not a very convincing one admittedly. I call every function in the module (that's easy because none of the functions take any argument). If the return value is an object, I call each