PageRenderTime 13ms CodeModel.GetById 2ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/perl5/char_binary_runme.pl

#
Perl | 32 lines | 20 code | 9 blank | 3 comment | 0 complexity | e5684bfa02e2e55be9a1458705792bad MD5 | raw file
 1use strict;
 2use warnings;
 3use Test::More tests => 7;
 4BEGIN { use_ok('char_binary') }
 5require_ok('char_binary');
 6
 7my $t = char_binary::Test->new();
 8
 9is($t->strlen('hile'), 4, "string typemap");
10
11is($t->strlen("hil\0"), 4, "string typemap");
12
13#
14# creating a raw char*
15#
16my $pc = char_binary::new_pchar(5);
17char_binary::pchar_setitem($pc, 0, 'h');
18char_binary::pchar_setitem($pc, 1, 'o');
19char_binary::pchar_setitem($pc, 2, 'l');
20char_binary::pchar_setitem($pc, 3, 'a');
21char_binary::pchar_setitem($pc, 4, 0);
22
23
24is($t->strlen($pc), 4, "string typemap");
25
26$char_binary::var_pchar = $pc;
27is($char_binary::var_pchar, "hola", "pointer case");
28
29$char_binary::var_namet = $pc;
30is($char_binary::var_namet, "hola", "pointer case");
31
32char_binary::delete_pchar($pc);