in reply to writing tests on modules

First of all, welcome to the wonderful world of testing! I recently started writing tests for my modules, and I'm hooked. :-)

References you might find helpful:

Relevant nodes found by Super Search (this is one of your best friends at Perl Monks):

Finally, don't forget to search CPAN:

Your specific example of a function that checks bounds is certainly something that I would test. It will allow you to easily verify that it is behaving as expected (per the specifications), especially after you tweak the code (anything from a minor change to a complete refactoring).

For example: Does the function handle different types of input appropriately? What should happen if it is passed undef? An integer? A float? Does it work with positive and negative values? An alphanumeric string? A string that contains with special characters? The empty string? What other edge cases are there?

Just some initial thoughts. Hope this helps.

Replies are listed 'Best First'.
Re^2: writing tests on modules
by tphyahoo (Vicar) on Nov 28, 2005 at 11:04 UTC
    Yes, and to filter that a bit, I would start by reading the basics: Test::Simple (first) and Test::More (after).

    Test::Tutorial, though temptingly named, is unfortunately only a placeholder.

      It's true that I can't seem to find Test::Tutorial on CPAN any more, perhaps that is because it's part of the core Perl distribution since:

      perldoc Test::Tutorial

      works on the Linux boxes that I have access to.