NAME

Test::LectroTest::Property - Automated random-data tests

SYNOPSIS

use MyModule;  # provides my_function_to_test

use Test::LectroTest::Generator qw( :common );
use Test::LectroTest::Property qw( Test );
use Test::LectroTest::TestRunner;

my $prop_non_neg = Property {
    ##[ x <- Int, y <- Int ]##
    $t->label("negative") if $x < 0;
    $t->label("odd")      if $x % 2;
    $t->retry             if $y == 0;  # 0 can't be used in test
    my_function_to_test( $x, $y ) >= 0;
}, name => "my_function_to_test output is non-negative";

my $runner = Test::LectroTest::TestRunner->new();
$runner->run_suite(
    $prop_non_neg,
    # ... more properties here ...
);

DESCRIPTION

STOP! If you're just looking for an easy way to write and run unit tests, see Test::LectroTest first.

This module allows you to define Properties that can be tested automatically by Test::LectroTest. A Property defines a behaviorial characteristic that the software you're testing must hold over a range of inputs.

  1. The shape of the haystack

  2. What a needle looks like

LECTROTEST HOME

The LectroTest home is http://community.moertel.com/LectroTest. There you will find more documentation, presentations, a wiki, and other helpful LectroTest-related resources. It's also the best place to ask questions.

AUTHOR

Tom Moertel (tom@moertel.com)

INSPIRATION

The LectroTest project was inspired by Haskell's fabulous QuickCheck module by Koen Claessen and John Hughes: http://www.cs.chalmers.se/~rjmh/QuickCheck/.

COPYRIGHT and LICENSE

Copyright 2004 by Thomas G Moertel. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.