[Pdx-pm] Test::More and Inline

Thomas Keller kellert at ohsu.edu
Tue Dec 16 14:09:38 PST 2008


Greetings,
I'm not understanding the explanation given for using Test::More with  
Inline C in chromatic's Perl Testing book.

The example in the book (this works):
#!/usr/local/bin/perl
# test_math.t from "Perl Testing" p 172

BEGIN
{
     chdir 't' if -d 't';
}
use strict;
use warnings;
use Test::More tests =>6;

use Inline C =>
             Config  =>
                     LIBS    => '-lm',
                     ENABLE => 'AUTOWRAP'
;

Inline->import( C => <<END_HEADERS );
         double fmax( double, double );
         double fmin( double, double );
END_HEADERS

is( fmax( 1.0, 2.0 ), 2.0, 'fmax() should find max of two values');
is( fmax( -1.0, 1.0 ), 1.0, '... and should find with a neg value');
is( fmax( -1.0, -7.0 ), -1.0, '... and should find with neg values');
is( fmin( 9.3, 1.7 ), 1.7, 'fmin() should find min of two values');
is( fmin( -9.3, 1.7 ), -9.3, '... and should handle a neg value');
is( fmin( -1.3, -1.7 ), -1.7, '... and should handle a neg values');

###############

But I don't see how Inline knows where to look for the library?
Does Test::More generate "wrapper" code? Is it only in memory, or can  
it be retrieved?
... If so would this be useful for building more extensive programs  
using C functions?


thanks for your help and advice.

Tom K



Tom Keller, Ph.D.
kellert at ohsu.edu
503-494-2442
6339b RJH (BSc)
http://www.ohsu.edu/research/core




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/pdx-pm-list/attachments/20081216/d2d90d2b/attachment.html>


More information about the Pdx-pm-list mailing list