Branch Coverage

blib/lib/Games/Dice/Roller.pm
Criterion Covered Total %
branch 127 160 79.3


line true false branch
15 7 5 if (defined $opts{'sub_rand'})
17 1 6 unless ref $opts{'sub_rand'} eq 'CODE'
28 1 36 unless $arg
29 1 35 if @_
39 6 29 if (scalar @args > 1) { }
45 8 9 unless $ele->{'type'} eq 'dice_expression'
52 3 1 if $global_modifier->{'value'} eq 'kh'
56 4 0 $sorted[0]{'original'} ? :
4 0 $sorted[0]{'result_description'} ? :
63 5 4 $_->{'original'} ? :
5 4 $_->{'result_description'} ? :
9 0 $_->{'result'} ? :
83 122 134 unless ($ref->{'die_mod'})
93 5 129 if ($ref->{'die_mod'} and $ref->{'die_mod'} eq 'avg') { }
106 42 87 if ($ref->{'die_mod'} and $ref->{'die_mod'} eq 'r')
110 10 32 if (not defined $ref->{'comp_mod'} and $single_res == $comp_num or defined $ref->{'comp_mod'} and $ref->{'comp_mod'} eq 'lt' and $single_res < $comp_num or defined $ref->{'comp_mod'} and $ref->{'comp_mod'} eq 'gt' and $single_res > $comp_num) { }
127 51 36 if ($ref->{'die_mod'} and $ref->{'die_mod'} eq 'x')
131 10 41 if (not defined $ref->{'comp_mod'} and $single_res == $comp_num or defined $ref->{'comp_mod'} and $ref->{'comp_mod'} eq 'lt' and $single_res < $comp_num or defined $ref->{'comp_mod'} and $ref->{'comp_mod'} eq 'gt' and $single_res > $comp_num) { }
151 36 0 if ($ref->{'die_mod'} and $ref->{'die_mod'} eq 'cs')
157 10 26 if (not defined $ref->{'comp_mod'} and $single_res == $comp_num or defined $ref->{'comp_mod'} and $ref->{'comp_mod'} eq 'lt' and $single_res < $comp_num or defined $ref->{'comp_mod'} and $ref->{'comp_mod'} eq 'gt' and $single_res > $comp_num) { }
177 6 22 if ($ref->{'res_mod'} and $ref->{'res_mod'} =~ /^(?:kh|kl|dh|dl)$/)
184 3 3 if ($ref->{'res_mod'} eq 'kh' or $ref->{'res_mod'} eq 'kl')
186 2 1 if $ref->{'res_mod'} eq 'kh'
194 24 148 if ($ele eq $tobedropped)
200 1 2 if $ref->{'res_mod'} eq 'kl'
204 3 3 if ($ref->{'res_mod'} eq 'dh' or $ref->{'res_mod'} eq 'dl')
206 2 1 if $ref->{'res_mod'} eq 'dl'
213 15 5 $ref->{'res_mod'} eq 'dl' ? :
214 20 59 if ($ele eq $tobedropped)
220 1 2 if $ref->{'res_mod'} eq 'dh'
226 12 16 if ($ref->{'res_sum'})
236 0 28 if $debug
245 1 10260 unless $sides
246 4 10256 unless $sides =~ /^(\d+)$/
258 7 91 if ($result->{'die_mod'} and $result->{'die_mod'} eq 'avg')
259 0 7 if $result->{'res_mod'}
260 1 6 if $result->{'comp_mod'}
261 1 5 if $result->{'die_mod_val'}
264 9 87 if ($result->{'die_mod'} and $result->{'die_mod'} eq 'cs')
265 1 8 if $result->{'res_mod'}
266 2 6 unless $result->{'die_mod_val'}
267 1 5 if $result->{'res_sum'}
270 12 80 if ($result->{'die_mod'} and $result->{'die_mod'} eq 'x')
271 1 11 if $result->{'res_mod'}
272 1 10 unless $result->{'die_mod_val'}
275 9 81 if ($result->{'die_mod'} and $result->{'die_mod'} eq 'r')
276 0 9 unless $result->{'die_mod_val'}
279 10 80 if ($result->{'comp_mod'} and $result->{'comp_mod'} =~ /^(?:gt|lt)$/)
280 0 10 unless $result->{'die_mod'} =~ /^(?:r|x|cs)$/
283 27 63 if ($result->{'res_mod'} and $result->{'res_mod'} =~ /^(?:kh|kl|dh|dl)$/)
284 0 27 unless $result->{'res_mod_val'}
285 0 27 if $result->{'die_mod'}
286 0 27 if $result->{'comp_mod'}
287 27 0 if $result->{'dice_exp'} =~ /^(\d+)d/
288 1 26 if $result->{'res_mod_val'} >= $dice_num
291 49 40 if ($result->{'res_sum'} and $result->{'res_sum'} =~ /^[+-]\d+$/)
292 0 49 if defined $result->{'die_mod'} and $result->{'die_mod'} eq 'cs'
302 1 5 if 1 < grep({$_->{'type'} eq 'number';} @args)
303 1 4 if 1 < grep({$_->{'type'} eq 'global_modifier';} @args)
305 2 2 if 0 == grep({$_->{'type'} eq 'global_modifier';} @args)
306 0 4 unless $args[-1]{'type'} eq 'global_modifier'
312 1 121 unless $exp
314 0 121 if $debug
326 106 15 if ($exp =~ / ^ (?\d+d\d+) # a mandatory dice expression as start 1d6 ( # an optional res_mod group (?(?:kh|kl|dh|dl)) # with a res_mod kh|kl|dh|dl (?\d+) # and with a mod_val 3 )? ( # an optional die_mod (?(?:r|x|cs|avg)) # with a die_mod r|x|cs|avg (?(?:gt|lt))? # an optional comp_mod gt|lt (?\d{0,}) # and an optional die_mod_val 3 )? ( # an optional res_sum (?[+-]{1}\d+) # with a res_mod +|-3 )? /x) { }
8 7 elsif ($exp =~ /^\d+$/) { }
4 3 elsif ($exp =~ /^kh|kl$/) { }
344 0 106 if ($debug)
348 0 0 if $+{'res_mod'}
349 0 0 if $+{'res_mod_val'}
350 0 0 if $+{'die_mod'}
351 0 0 if $+{'comp_mod'}
352 0 0 if $+{'die_mod_val'}
353 0 0 if $+{'res_sum'}
371 0 106 if $debug
374 0 308 if defined $result->{$key} and $debug
375 308 434 if defined $result->{$key}
377 0 106 if $debug
379 8 98 if length $tobenull
386 0 8 if $debug
391 0 4 if $debug