Convert-Binary-C
view release on metacpan or search on metacpan
bin/perltypes.PL view on Meta::CPAN
-d "$_/include" and $base = rel2abs("$_/include") and last for qw( tests ../tests );
defined $base or die <<MSG;
Please run this script from either the 'examples' directory
or the distribution base directory.
MSG
#-------------------------------------
# Create an object, set configuration.
#-------------------------------------
my $cfg = require "$base/config.pl";
my $c = new Convert::Binary::C %$cfg;
#------------------
# Parse the C file.
#------------------
eval { $c->parse_file( "$base/include.c" ) };
#-----------------------
# Check for parse error.
tests/206_parse.t view on Meta::CPAN
#
################################################################################
use Test;
use Convert::Binary::C @ARGV;
$^W = 1;
BEGIN { plan tests => 116 }
my $CCCFG = require './tests/include/config.pl';
#===================================================================
# create object (1 tests)
#===================================================================
eval { $p = Convert::Binary::C->new };
ok($@,'',"failed to create Convert::Binary::C object");
#===================================================================
# try to parse empty file / empty code (2 tests)
#===================================================================
tests/209_sourcify.t view on Meta::CPAN
#
################################################################################
use Test;
use Convert::Binary::C @ARGV;
$^W = 1;
BEGIN { plan tests => 98 }
my $CCCFG = require './tests/include/config.pl';
eval {
$orig = Convert::Binary::C->new( %$CCCFG );
@clone = map { Convert::Binary::C->new( %$CCCFG ) } 1 .. 2;
};
ok($@,'',"failed to create Convert::Binary::C objects");
eval {
$orig->parse_file( 'tests/include/include.c' );
$orig->parse( <<ENDPARSE );
tests/210_depend.t view on Meta::CPAN
#
################################################################################
use Test;
use Convert::Binary::C @ARGV;
$^W = 1;
BEGIN { plan tests => 90 }
my $CCCFG = require './tests/include/config.pl';
eval {
$c1 = Convert::Binary::C->new( Include => ['tests/include/files'] );
$c2 = Convert::Binary::C->new( Include => ['tests/include/files'] );
};
ok($@,'',"failed to create Convert::Binary::C objects");
eval {
$c1->parse_file( 'tests/include/files/files.h' );
$c2->parse( <<CODE );
tests/211_clone.t view on Meta::CPAN
#
################################################################################
use Test;
use Convert::Binary::C @ARGV;
$^W = 1;
BEGIN { plan tests => 35 }
my $CCCFG = require './tests/include/config.pl';
eval {
$orig = Convert::Binary::C->new( %$CCCFG );
};
ok($@,'',"failed to create Convert::Binary::C object");
eval {
# Clone at least twice, to make sure memory of the first clone(s) will
# get freed (and to make sure that cloning works a couple of times)
$clone = $orig->clone->clone->clone;
tests/215_local.t view on Meta::CPAN
use Test;
use Convert::Binary::C @ARGV;
$^W = 1;
BEGIN {
plan tests => 9;
}
my $CCCFG = require './tests/include/config.pl';
eval {
$c = Convert::Binary::C->new;
};
ok($@,'',"failed to create Convert::Binary::C::Cached object");
eval {
$c->parse( <<'ENDC' );
enum Zoo {
tests/218_member.t view on Meta::CPAN
use Test;
use Convert::Binary::C @ARGV;
$^W = 1;
BEGIN {
plan tests => 417;
}
my $CCCFG = require './tests/include/config.pl';
%basic = ( char => 1, short => 1, int => 1,
long => 1, signed => 1, unsigned => 1,
float => 1, double => 1, void => 1 );
eval {
$c = Convert::Binary::C->new(
ShortSize => 2,
IntSize => 4,
LongSize => 4,
tests/223_initializer.t view on Meta::CPAN
#
################################################################################
use Test;
use Convert::Binary::C @ARGV;
$^W = 1;
BEGIN { plan tests => 27 }
my $CCCFG = require './tests/include/config.pl';
$c = eval { Convert::Binary::C->new( %$CCCFG ) };
ok($@,'',"failed to create Convert::Binary::C objects");
eval { $c->parse_file( 'tests/include/include.c' ) };
ok($@,'',"failed to parse C-file");
$full = $zero = $c->sourcify;
for( $c->typedef_names ) {
tests/601_speed.t view on Meta::CPAN
use Test;
use Convert::Binary::C @ARGV;
use Convert::Binary::C::Cached;
$^W = 1;
BEGIN {
plan tests => 11;
}
my $CCCFG = require './tests/include/config.pl';
push @{$CCCFG->{Define}}, 'CACHE_TEST=1';
push @{$CCCFG->{Include}}, 'tests/include';
eval { require Data::Dumper }; $Data_Dumper = $@;
eval { require IO::File }; $IO_File = $@;
if( $Data_Dumper or $IO_File ) {
my $req;
$req = 'IO::File' if $IO_File;
tests/602_threads.t view on Meta::CPAN
use Config;
use Convert::Binary::C @ARGV;
use constant NUM_THREADS => 4;
$^W = 1;
BEGIN {
plan tests => NUM_THREADS
}
my $CCCFG = require './tests/include/config.pl';
#===================================================================
# load appropriate threads module and start a couple of threads
#===================================================================
my $have_threads = ($Config{useithreads} && $] >= 5.008) ||
$Config{use5005threads};
my $reason = $Config{useithreads} || $Config{use5005threads}
? "unsupported threads configuration"
( run in 0.310 second using v1.01-cache-2.11-cpan-0d8aa00de5b )