File: 03_count.t

package info (click to toggle)
libtest-leaktrace-perl 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 412 kB
  • ctags: 879
  • sloc: ansic: 3,215; perl: 1,789; makefile: 7
file content (29 lines) | stat: -rw-r--r-- 457 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!perl -w

use strict;
use Test::More tests => 5;

use Test::LeakTrace;

sub normal{
	my %a;
	my %b;

	$a{b} = 1;
	$b{a} = 2;
}
cmp_ok leaked_count(\&normal), '<=', 0, 'not leaked(1)';
cmp_ok leaked_count(\&normal), '<=', 0, 'not leaked(2)';

sub leaked{
	my %a;
	my %b;

	$a{b} = \%b;
	$b{a} = \%a;
}

cmp_ok leaked_count(\&leaked), '>', 0;

is leaked_count(\&leaked), scalar(leaked_info \&leaked);
is leaked_count(\&leaked), scalar(leaked_refs \&leaked);