|No such thing as a small change|
*How* Do I Get Involved?by Ea (Hermit)
|on Oct 11, 2001 at 17:52 UTC||Need Help??|
Alright - I already have written some gitzy little tests for the tiny, first module I wrote 3 months ago. And it felt great, too! But now the feeling is a little hollow. All I've done is one test per sub, testing the numbers I give it yield the answer I expect. I mean, for me the only way a test should fail is if the module isn't there. (or perhaps, if I go and change the checksum algorithm in a drunken stupor, the tests would bail me out) I somehow feel there should be more to it.
So my question is - and it's quite newbie - How do I write a test? Forgive me for being pedantic, but there's not a lot out there. Test::Harness is briefly described in the Camel book (Amelia, to some ;) and there's the nodes Writing tests and perlman:Test::Harness. Does make test run all of the tests that it finds in the t directory automatically?
Another question - How would you write tests for a program? The same as you would for a module? (but those are run with make test)
For added entertainment, I'll throw in my "test suite". (Comments very welcome - snigger if you like ;)
Edit Masem 2001-10-11 - Code Tags