t/base/wcap.t

filter: Statementstmt 66.6% 34 / 51 Branchbran 12.5% 1 / 8 Conditioncond 8.3% 1 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 48.1% 40 / 83 CC 1 SCAR 0.0
CC
1
Cov
51%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/WWW/WCAP.pm ↑ Summary
1 1 print "1..5\n";
2  
3 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use WWW::WCAP qw(login do_request parse_ical logout);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Benchmark::Timer; # Performance measure
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 print "ok 1\n";
8  
9 1 my $timer = Benchmark::Timer->new(skip => 0);
10 1 my $user = 'youruser';
11 1 my $pass = 'yourpass';
12 1 my $ref;
13  
14 # From now
15 1 my ($min,$hh,$dd,$mm,$yy) = (localtime)[1,2,3,4,5];
16 1 $mm++; $yy += 1900; # adjust to real values
17 1 my $range_start = sprintf("%4.4d%2.2d%2.2dT%2.2d%2.2d00", $yy, $mm, $dd, $hh, $min);
18  
19 # until tomorrow
20 1 ($min,$hh,$dd,$mm,$yy) = (localtime(time + 3600 * 24))[1,2,3,4,5];
21 1 $mm++; $yy += 1900; # adjust to real values
22 1 my $range_end = sprintf("%4.4d%2.2d%2.2dT%2.2d%2.2d00", $yy, $mm, $dd, $hh, $min);
23  
24 1 $timer->start("TEST>> Logging in: $user");
25 1 my $id = &login($user,$pass);
26 1 ▶print "not " unless $id && $id ne '';
Branch: 1 branch
BranchTrueFalseTotal
unless $id and $id ne "" 1 0 1
Condition33%1/3
$id and $id ne ""
!ll&&!rl&&r
100
MC/DC0%0/2
$id and $id ne ""
$id $id ne ""
Truth table33%1/3
A and B
A= $idB= $id ne ""
ABresult
0X0
100
111
27 1 print "ok 2\n";
28 1 print Dumper($id);
29 1 $timer->stop;
30  
31 1 $timer->start("TEST>> Getting calendar for: $user");
32 1 $ref = &do_request($id,'fetchcomponents_by_range.wcap',
33 'uid=' . $user,
34 'dtstart=' . $range_start, 'dtend=' . $range_end,
35 );
36 0 ▶print "not " unless $ref && $ref->{status};
Branch: 1 branch
BranchTrueFalseTotal
unless $ref and $ref->{"status"} 0 0 0
Condition0%0/3
$ref and $ref->{"status"}
!ll&&!rl&&r
000
MC/DC0%0/2
$ref and $ref->{"status"}
$ref $ref->{"status"}
Truth table0%0/3
A and B
A= $refB= $ref->{"status"}
ABresult
0X0
100
111
37 0 print "ok 3\n";
38 0 print Dumper($ref);
39 0 $timer->stop;
40  
41 0 $timer->start("TEST>> Displaying calendar for: $user");
42 0 $ref = &parse_ical($ref->{content});
43 0 ▶print "not " unless $ref && $ref->{status};
Branch: 1 branch
BranchTrueFalseTotal
unless $ref and $ref->{"status"} 0 0 0
Condition0%0/3
$ref and $ref->{"status"}
!ll&&!rl&&r
000
MC/DC0%0/2
$ref and $ref->{"status"}
$ref $ref->{"status"}
Truth table0%0/3
A and B
A= $refB= $ref->{"status"}
ABresult
0X0
100
111
44 0 print "ok 4\n";
45 0 print Dumper($ref);
46 0 $timer->stop;
47  
48 0 $timer->start("TEST>> Logging out: $user");
49 0 $ref = &logout($id);
50 0 ▶print "not " unless $ref && $ref->{status};
Branch: 1 branch
BranchTrueFalseTotal
unless $ref and $ref->{"status"} 0 0 0
Condition0%0/3
$ref and $ref->{"status"}
!ll&&!rl&&r
000
MC/DC0%0/2
$ref and $ref->{"status"}
$ref $ref->{"status"}
Truth table0%0/3
A and B
A= $refB= $ref->{"status"}
ABresult
0X0
100
111
51 0 print "ok 5\n";
52 0 print Dumper($ref);
53 0 $timer->stop;
54  
55 0 print $timer->report;
« blib/lib/WWW/WCAP.pm ↑ Summary