Home

Awesome

NAME

libtap - Write tests in C

SYNOPSIS

#include <tap.h>

int main () {
    plan(5);
    int bronze = 1, silver = 2, gold = 3;
    ok(bronze < silver, "bronze is less than silver");
    ok(bronze > silver, "not quite");
    is("gold", "gold", "gold is gold");
    cmp_ok(silver, "<", gold, "%d <= %d", silver, gold);
    like("platinum", ".*inum", "platinum matches .*inum");
    done_testing();
}

results in:

1..5
ok 1 - bronze is less than silver
not ok 2 - not quite
#   Failed test 'not quite'
#   at t/synopsis.c line 7.
ok 3 - gold is gold
ok 4 - 2 <= 3
ok 5 - platinum matches .*inum
# Looks like you failed 1 test of 5 run.

DESCRIPTION

tap is an easy to read and easy to write way of creating tests for your software. This library creates functions that can be used to generate it for your C programs. It is implemented using macros that include file and line info automatically, and makes it so that the format message of each test is optional. It is mostly based on the Test::More Perl module.

INSTALL

On Unix systems:

$ make
$ make install

For more detailed installation instructions (eg, for Windows), see INSTALL.

FUNCTIONS