NAME

Fennec::External::C - Test C code with Fennec

SYNOPSIS

package TEST::MyC;
use strict;
use warnings;
use Fennec;
use Fennec::External::C;

Fennec::Runner->c_compiler( 'gcc' );
Fennec::Runner->c_compiler_args( '$infile -o $outfile' );

testc its_ok => <<C_CODE;
    // ok() is provided to your c code.
    ok( 1, "Should pass" );
    ok( 1, "Another");
    // prove it is C not perl
    int *x;
    int y = 1;
    x = &y;
    ok( *x, "Proof this is C" );
C_CODE

testc its_not_ok => (
    // The failure well not be registered by Fennec
    // when no_tap_merge is set.
    no_tap_merge => 1,
    code => <<'    C_CODE',
        ok( 0, "Should fail" );
    C_CODE
);

1;

DESCRIPTION

Provides testc( $code ). This will insert your code into the main() function in a C template file that also defines the ok( int pass, char* name ) C function. If you do not wish to use the template see Fennec::External::C::Raw.

AUTHORS

Chad Granum exodist7@gmail.com

COPYRIGHT

Copyright (C) 2010 Chad Granum

Fennec is free software; Standard perl licence.

Fennec is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.