root/libswish3/trunk/bindings/perl/t/07-refcnt.t

Revision 2172, 0.6 kB (checked in by karpet, 2 months ago)

still have some mem leaks somewhere, but this is at least a better approach

Line 
1 use Test::More tests => 10;
2
3 use_ok('SWISH::3');
4
5 ok( my $s3 = SWISH::3->new, "new s3" );
6 is( $s3->refcount, 1, "refcnt = 1" );
7 is( $s3->analyzer->refcount, 1, "analyzer refcount == 1" );
8 ok( my $analyzer = $s3->analyzer, "get analyzer" );
9 is( $analyzer->refcount, 1, "analyzer refcount == 1" );
10
11
12 #undef $s3;
13 is( $analyzer->refcount, 1, "analyzer refcount == 1" );
14 my $a2 = $analyzer;
15 is( $a2->refcount,       2, "a2 copy == 2" );
16 is( $analyzer->refcount, 2, "analyzer refcount == 2" );
17
18 #$s3->dump($analyzer);
19 is( $s3->config->refcount, 1, "config refcount == 1" );
20
Note: See TracBrowser for help on using the browser.