File: 13proxy_stat.t

package info (click to toggle)
libnet-proxy-perl 0.12-5
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 304 kB
  • ctags: 66
  • sloc: perl: 777; sh: 84; makefile: 44
file content (38 lines) | stat: -rw-r--r-- 1,077 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
30
31
32
33
34
35
36
37
38
use Test::More tests => 10;
use Net::Proxy;

my $proxy = Net::Proxy->new(
    {   in  => { type => 'dummy' },
        out => { type => 'dummy' }
    }
);

is( $proxy->stat_opened(), 0, "No opened connection" );
is( $proxy->stat_closed(), 0, "No closed connection" );

$proxy->stat_inc_opened();
is( $proxy->stat_opened(), 1, "1 opened connection" );
$proxy->stat_inc_opened();
$proxy->stat_inc_opened();
is( $proxy->stat_opened(), 3, "3 opened connections" );

$proxy->stat_inc_closed();
is( $proxy->stat_closed(), 1, "1 closed connection" );
$proxy->stat_inc_closed();
$proxy->stat_inc_closed();
is( $proxy->stat_opened(), 3, "3 closed connections" );

my $proxy2 = Net::Proxy->new(
    {   in  => { type => 'dummy' },
        out => { type => 'dummy' }
    }
);

$proxy2->stat_inc_opened();
is( $proxy2->stat_opened(), 1, "1 opened connection");
is( Net::Proxy->stat_total_opened(), 4, "Total 4 opened connections" );

$proxy2->stat_inc_closed();
is( $proxy2->stat_closed(), 1, "1 closed connection");
is( Net::Proxy->stat_total_closed(), 4, "Total 4 closed connections" );