Branch Coverage

blib/lib/Sub/Throttler/Rate/AnyEvent.pm
Criterion Covered Total %
branch 43 100 43.0


line true false branch
31 0 9 unless $$self{'limit'} =~ /\A\d+\z/ms
32 0 9 if $$self{'period'} <= 0
33 0 9 if $$self{'period'} >= -&Sub::Throttler::Rate::rr::EMPTY()
34 0 9 if keys %opt
36 0 0 if $this
42 11 0 unless ($self->try_acquire($id, $key, $quantity))
43 11 0 if ($quantity <= $$self{'limit'})
47 11 0 if ($delay > 0)
51 0 11 unless ($self->try_acquire($id, $key, $quantity))
60 1 0 if (1 == @_)
63 0 0 unless $limit =~ /\A\d+\z/ms
71 0 0 if ($resources_increases)
79 1 4 if $$state{'algo'} ne 'Sub::Throttler::Rate::AnyEvent'
81 1 3 if ($v > $VERSION)
89 2 2 if ($$state{'at'} > $time)
95 12 0 if ($_ != &Sub::Throttler::Rate::rr::EMPTY())
109 1 0 if (1 == @_)
112 0 0 if $period <= 0
113 0 0 if $$self{'period'} >= -&Sub::Throttler::Rate::rr::EMPTY()
118 0 0 if ($resources_increases)
119 0 0 if ($$self{'_t'}) { }
132 0 18 unless $$self{'acquired'}{$id}
139 0 13 unless $$self{'acquired'}{$id}
146 11 2 if ($$self{'used'}{$key}->get($$self{'limit'}) + $$self{'period'} <= $now)
152 11 2 unless (keys %{$$self{'used'};})
172 3 0 if ($_ != &Sub::Throttler::Rate::rr::EMPTY())
185 1 61 if $$self{'acquired'}{$id} and exists $$self{'acquired'}{$id}{$key}
187 0 61 if $quantity <= 0
192 26 35 unless ($$self{'used'}{$key}->add($$self{'period'}, $now, $quantity))
197 16 19 unless ($$self{'_t'})
209 0 0 if (not $after) { }
0 0 elsif (not $when or $when > $after) { }
216 0 0 !$when ? :
247 1 60 if ($quantity > $len)
255 25 35 if ($$self{'data'}[$required] > $time - $period)
272 0 0 if $$self{'data'}[$_] > $time
283 0 13 unless ($len)
286 0 13 if ($quantity > $len)
290 0 13 if ($$self{'data'}[$$self{'next'}] > $time) { }
11 2 elsif ($$self{'data'}[$$self{'next'}] == $time) { }
2 0 elsif ($$self{'data'}[$$self{'next'} - 1] == $time) { }
297 0 11 if $$self{'data'}[$_] != $time
304 0 2 if $$self{'data'}[$_] != $time
313 0 0 unless defined $i
315 0 0 if $$self{'data'}[$_] != $time
322 0 0 if ($count_fwd <= $count_rew) { }
351 0 0 if ($newlen < $len) { }
367 0 0 if $min < 0 or $#{$aref;} < $max or $min > $max
370 0 0 if ($target > $$aref[$mid]) { }
376 0 0 if $target == $$aref[$min]