Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Test::LectroTest::Property 0.3600

    Download button

    No screenshots available
    Downloads: 276  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Tom Moertel | More programs
    Perl Artistic License / FREE
    January 10th, 2007, 00:05 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Test::LectroTest::Property description

    A Perl module with properties that make testable claims about your software.

    Test::LectroTest::Property is a Perl module with properties that make testable claims about your software.

    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 label("odd") if $x % 2;
    $tcon->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 ...
    );


    STOP! If you're just looking for an easy way to write and run unit tests, see Test::LectroTest first. Once you're comfortable with what is presented there and ready to delve into the full offerings of properties, this is the document for you.

    This module allows you to define Properties that can be checked automatically by Test::LectroTest. A Property is a specification of your software's required behavior over a given set of conditions. The set of conditions is given by a generator-binding specification. The required behavior is defined implicitly by a block of code that tests your software for a given set of generated conditions; if your software matches the expected behavor, the block of code returns true; otherwise, false.

    This documentation serves as reference documentation for LectroTest Properties. If you don't understand the basics of Properties yet, see "OVERVIEW" in Test::LectroTest::Tutorial before continuing.

    Two ways to create Properties

    There are two ways to create a property:

    1. Use the Property function to promote a block of code that contains both a generator-binding specification and a behavior test into a Test::LectroTest::Property object. This is the preferred method. Example:
    my $prop1 = Property {
    ##[ x = 0;
    }, name => "thing_to_test is non-negative";

    2. Use the new method of Test::LectroTest::Property and provide it with the necessary ingredients via named parameters:
    my $prop2 = Test::LectroTest::Property->new(
    inputs => [ x => Int ],
    test => sub { my ($tcon,$x) = @_;
    thing_to_test($x) >= 0 },
    name => "thing_to_test is non-negative"
    );

    Both are equivalent, but the first is concise, easier to read, and lets LectroTest do some of the heavy lifting for you. The second is probably better, however, if you are constructing property specifications programmatically.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    testable claims | test software | Perl module | Test | properties | testable

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM