Lite/t/relops.t

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 29 / 29 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Lite/t/overminus.t ↑ Summary Lite/t/v4-new_from_aton.t »
1 1 ▶use NetAddr::IP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 @gt = (
5 [ '255.255.255.255/32', '0.0.0.0/0' ],
6 [ 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', '::/0' ],
7 [ '10.0.1.0/16', '10.0.0.1/24' ],
8 [ '10.0.0.1/24', '10.0.0.0/24' ],
9 [ 'deaf:beef::1/64', 'dead:beef::/64' ],
10 );
11  
12 1 @ngt = (
13 [ '0.0.0.0/0', '255.255.255.255/32' ],
14 [ '::/0', 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' ],
15 [ '10.0.0.0/24', '10.0.0.0/24' ],
16 [ 'dead:beef::/60', 'dead:beef::/60' ],
17 );
18  
19 1 @cmp = (
20 [ '0.0.0.0/0', '255.255.255.255/32', -1 ],
21 [ '::/0', 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', -1 ],
22 [ '10.0.0.0/16', '10.0.0.0/8', 1 ],
23 [ 'dead:beef::/60', 'dead:beef::/40', 1 ],
24 [ '10.0.0.0/24', '10.0.0.0/8', 1 ],
25 [ '255.255.255.255/32', '0.0.0.0/0', 1 ],
26 [ 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', '::/0', 1 ],
27 [ '142.52.5.87', '142.52.2.88', 1 ],
28 [ '10.0.0.0/24', '10.0.0.0/24', 0 ],
29 [ 'default', 'default', 0 ],
30 [ 'broadcast', 'broadcast', 0],
31 [ 'loopback', 'loopback', 0],
32 );
33  
34 };
35  
36 1 ▶use Test::More tests => @gt + @ngt + (2 * @cmp);
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 1 for my $a (@gt) {
39 5 $a_ip = new NetAddr::IP::Lite $a->[0];
40 5 $b_ip = new NetAddr::IP::Lite $a->[1];
41  
42 5 ok($a_ip > $b_ip, "$a_ip > $b_ip");
43 }
44  
45 1 for my $a (@ngt) {
46 4 $a_ip = new NetAddr::IP::Lite $a->[0];
47 4 $b_ip = new NetAddr::IP::Lite $a->[1];
48  
49 4 ok(!($a_ip > $b_ip), "$a_ip !> $b_ip");
50 }
51  
52 1 for $a (@cmp) {
53 12 $a_ip = new NetAddr::IP::Lite $a->[0];
54 12 $b_ip = new NetAddr::IP::Lite $a->[1];
55  
56 12 is($a_ip <=> $b_ip, $a->[2], "$a_ip <=> $b_ip is $a->[2]");
57 12 is($a_ip cmp $b_ip, $a->[2], "$a_ip cmp $b_ip is $a->[2]");
58 }
59  
« Lite/t/overminus.t ↑ Summary Lite/t/v4-new_from_aton.t »