Harness/Compatible/Results.pm

filter: Statementstmt 12.9% 8 / 62 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 7.4% 2 / 27 Podpod 100% 25 / 25 totaltotal 22.7% 35 / 154 CC 15 SCAR 15.4
CC
15
Cov
9%
wait
6.0
inc_max
6.0
max
6.0
CRAP 4.7
« Parser/Source/Perl.pm ↑ Summary Parser/Grammar.pm »
1 # -*- Mode: cperl; cperl-indent-level: 4 -*-
2 package TAPx::Harness::Compatible::Results;
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 $VERSION = '0.50_07';
7  
8 =head1 NAME
9  
10 TAPx::Harness::Compatible::Results - object for tracking results from a single test file
11  
12 =head1 SYNOPSIS
13  
14 One TAPx::Harness::Compatible::Results object represents the results from one
15 test file getting analyzed.
16  
17 =head1 CONSTRUCTION
18  
19 =head2 new()
20  
21 my $results = new TAPx::Harness::Compatible::Results;
22  
23 Create a test point object. Typically, however, you'll not create
24 one yourself, but access a Results object returned to you by
25 TAPx::Harness::Compatible::Results.
26  
27 =cut
28  
29 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
30 0 my $class = shift;
31 0 my $self = bless {}, $class;
32  
33 0 return $self;
34 }
35  
36 =head1 ACCESSORS
37  
38 The following data points are defined:
39  
40 passing true if the whole test is considered a pass
41 (or skipped), false if its a failure
42  
43 exit the exit code of the test run, if from a file
44 wait the wait code of the test run, if from a file
45  
46 max total tests which should have been run
47 seen total tests actually seen
48 skip_all if the whole test was skipped, this will
49 contain the reason.
50  
51 ok number of tests which passed
52 (including todo and skips)
53  
54 todo number of todo tests seen
55 bonus number of todo tests which
56 unexpectedly passed
57  
58 skip number of tests skipped
59  
60 So a successful test should have max == seen == ok.
61  
62  
63 There is one final item, the details.
64  
65 details an array ref reporting the result of
66 each test looks like this:
67  
68 $results{details}[$test_num - 1] =
69 { ok => is the test considered ok?
70 actual_ok => did it literally say 'ok'?
71 name => name of the test (if any)
72 diagnostics => test diagnostics (if any)
73 type => 'skip' or 'todo' (if any)
74 reason => reason for the above (if any)
75 };
76  
77 Element 0 of the details is test #1. I tried it with element 1 being
78 #1 and 0 being empty, this is less awkward.
79  
80  
81 Each of the following fields has a getter and setter method.
82  
83 =over 4
84  
85 =item * wait
86  
87 =item * exit
88  
89 =back
90  
91 =cut
92  
93 0 ▶sub set_wait { my $self = shift; $self->{wait} = shift }
Subroutine set_wait: not called CC=1 SCAR=6.9
Pod documented
94  
95 0 ▶sub wait {
Subroutine wait: not called CC=2 SCAR=17.9
Pod documented
96 0 my $self = shift;
97 0 ▶ return $self->{wait} || 0;
Condition0%0/2
$self->{'wait'} || 0
l!l
00
MC/DC0%0/1
$self->{'wait'} || 0
$self->{'wait'}
Truth table0%0/2
A
A= $self->{'wait'}
Aresult
11
00
98 }
99  
100 0 ▶sub set_skip_all { my $self = shift; $self->{skip_all} = shift }
Subroutine set_skip_all: not called CC=1 SCAR=6.9
Pod documented
101  
102 0 ▶sub skip_all {
Subroutine skip_all: not called CC=1 SCAR=6.9
Pod documented
103 0 my $self = shift;
104 0 return $self->{skip_all};
105 }
106  
107 0 ▶sub inc_max { my $self = shift; $self->{max} += ( @_ ? shift: 1 ) }
Subroutine inc_max: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
108  
109 0 ▶sub max {
Subroutine max: not called CC=2 SCAR=17.9
Pod documented
110 0 my $self = shift;
111 0 ▶ return $self->{max} || 0;
Condition0%0/2
$self->{'max'} || 0
l!l
00
MC/DC0%0/1
$self->{'max'} || 0
$self->{'max'}
Truth table0%0/2
A
A= $self->{'max'}
Aresult
11
00
112 }
113  
114 0 ▶sub set_passing { my $self = shift; $self->{passing} = shift }
Subroutine set_passing: not called CC=1 SCAR=6.9
Pod documented
115  
116 0 ▶sub passing {
Subroutine passing: not called CC=2 SCAR=17.9
Pod documented
117 0 my $self = shift;
118 0 ▶ return $self->{passing} || 0;
Condition0%0/2
$self->{'passing'} || 0
l!l
00
MC/DC0%0/1
$self->{'passing'} || 0
$self->{'passing'}
Truth table0%0/2
A
A= $self->{'passing'}
Aresult
11
00
119 }
120  
121 0 ▶sub inc_ok { my $self = shift; $self->{ok} += ( @_ ? shift: 1 ) }
Subroutine inc_ok: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
122  
123 0 ▶sub ok {
Subroutine ok: not called CC=2 SCAR=17.9
Pod documented
124 0 my $self = shift;
125 0 ▶ return $self->{ok} || 0;
Condition0%0/2
$self->{'ok'} || 0
l!l
00
MC/DC0%0/1
$self->{'ok'} || 0
$self->{'ok'}
Truth table0%0/2
A
A= $self->{'ok'}
Aresult
11
00
126 }
127  
128 0 ▶sub set_exit { my $self = shift; $self->{exit} = shift }
Subroutine set_exit: not called CC=1 SCAR=6.9
Pod documented
129  
130 0 ▶sub exit {
Subroutine exit: not called CC=2 SCAR=17.9
Pod documented
131 0 my $self = shift;
132 0 ▶ return $self->{exit} || 0;
Condition0%0/2
$self->{'exit'} || 0
l!l
00
MC/DC0%0/1
$self->{'exit'} || 0
$self->{'exit'}
Truth table0%0/2
A
A= $self->{'exit'}
Aresult
11
00
133 }
134  
135 0 ▶sub inc_bonus { my $self = shift; $self->{bonus}++ }
Subroutine inc_bonus: not called CC=1 SCAR=6.9
Pod documented
136  
137 0 ▶sub bonus {
Subroutine bonus: not called CC=2 SCAR=17.9
Pod documented
138 0 my $self = shift;
139 0 ▶ return $self->{bonus} || 0;
Condition0%0/2
$self->{'bonus'} || 0
l!l
00
MC/DC0%0/1
$self->{'bonus'} || 0
$self->{'bonus'}
Truth table0%0/2
A
A= $self->{'bonus'}
Aresult
11
00
140 }
141  
142 0 ▶sub set_skip_reason { my $self = shift; $self->{skip_reason} = shift }
Subroutine set_skip_reason: not called CC=1 SCAR=6.9
Pod documented
143  
144 0 ▶sub skip_reason {
Subroutine skip_reason: not called CC=2 SCAR=17.9
Pod documented
145 0 my $self = shift;
146 0 ▶ return $self->{skip_reason} || 0;
Condition0%0/2
$self->{'skip_reason'} || 0
l!l
00
MC/DC0%0/1
$self->{'skip_reason'} || 0
$self->{'skip_reason'}
Truth table0%0/2
A
A= $self->{'skip_reason'}
Aresult
11
00
147 }
148  
149 0 ▶sub inc_skip { my $self = shift; $self->{skip}++ }
Subroutine inc_skip: not called CC=1 SCAR=6.9
Pod documented
150  
151 0 ▶sub skip {
Subroutine skip: not called CC=2 SCAR=17.9
Pod documented
152 0 my $self = shift;
153 0 ▶ return $self->{skip} || 0;
Condition0%0/2
$self->{'skip'} || 0
l!l
00
MC/DC0%0/1
$self->{'skip'} || 0
$self->{'skip'}
Truth table0%0/2
A
A= $self->{'skip'}
Aresult
11
00
154 }
155  
156 0 ▶sub inc_todo { my $self = shift; $self->{todo}++ }
Subroutine inc_todo: not called CC=1 SCAR=6.9
Pod documented
157  
158 0 ▶sub todo {
Subroutine todo: not called CC=2 SCAR=17.9
Pod documented
159 0 my $self = shift;
160 0 ▶ return $self->{todo} || 0;
Condition0%0/2
$self->{'todo'} || 0
l!l
00
MC/DC0%0/1
$self->{'todo'} || 0
$self->{'todo'}
Truth table0%0/2
A
A= $self->{'todo'}
Aresult
11
00
161 }
162  
163 0 ▶sub inc_seen { my $self = shift; $self->{seen}++ }
Subroutine inc_seen: not called CC=1 SCAR=6.9
Pod documented
164  
165 0 ▶sub seen {
Subroutine seen: not called CC=2 SCAR=17.9
Pod documented
166 0 my $self = shift;
167 0 ▶ return $self->{seen} || 0;
Condition0%0/2
$self->{'seen'} || 0
l!l
00
MC/DC0%0/1
$self->{'seen'} || 0
$self->{'seen'}
Truth table0%0/2
A
A= $self->{'seen'}
Aresult
11
00
168 }
169  
170 0 ▶sub set_details {
Subroutine set_details: not called CC=2 SCAR=17.9
Pod documented
171 0 my $self = shift;
172 0 my $index = shift;
173 0 my $details = shift;
174  
175 0 ▶ my $array = ( $self->{details} ||= [] );
Condition0%0/2
$self->{"details"} ||= []
l!l
00
MC/DC0%0/1
$self->{"details"} ||= []
$self->{"details"}
Truth table0%0/2
A
A= $self->{"details"}
Aresult
11
00
176 0 $array->[ $index - 1 ] = $details;
177 }
178  
179 0 ▶sub details {
Subroutine details: not called CC=2 SCAR=17.9
Pod documented
180 0 my $self = shift;
181 0 ▶ return $self->{details} || [];
Condition0%0/2
$self->{'details'} || []
l!l
00
MC/DC0%0/1
$self->{'details'} || []
$self->{'details'}
Truth table0%0/2
A
A= $self->{'details'}
Aresult
11
00
182 }
183  
184 1 1;
185  
186 =head1 TO DOCUMENT
187  
188 =over
189  
190 =item bonus
191  
192 TODO: Document bonus
193  
194 =item details
195  
196 TODO: Document details
197  
198 =item inc_bonus
199  
200 TODO: Document inc_bonus
201  
202 =item inc_max
203  
204 TODO: Document inc_max
205  
206 =item inc_ok
207  
208 TODO: Document inc_ok
209  
210 =item inc_seen
211  
212 TODO: Document inc_seen
213  
214 =item inc_skip
215  
216 TODO: Document inc_skip
217  
218 =item inc_todo
219  
220 TODO: Document inc_todo
221  
222 =item max
223  
224 TODO: Document max
225  
226 =item ok
227  
228 TODO: Document ok
229  
230 =item passing
231  
232 TODO: Document passing
233  
234 =item seen
235  
236 TODO: Document seen
237  
238 =item set_details
239  
240 TODO: Document set_details
241  
242 =item set_exit
243  
244 TODO: Document set_exit
245  
246 =item set_passing
247  
248 TODO: Document set_passing
249  
250 =item set_skip_all
251  
252 TODO: Document set_skip_all
253  
254 =item set_skip_reason
255  
256 TODO: Document set_skip_reason
257  
258 =item set_wait
259  
260 TODO: Document set_wait
261  
262 =item skip
263  
264 TODO: Document skip
265  
266 =item skip_all
267  
268 TODO: Document skip_all
269  
270 =item skip_reason
271  
272 TODO: Document skip_reason
273  
274 =item todo
275  
276 TODO: Document todo
277  
278 =back
« Parser/Source/Perl.pm ↑ Summary Parser/Grammar.pm »