Branch Coverage

blib/lib/Sub/Throttler/Rate/AnyEvent.pm
Criterion Covered Total %
branch 69 100 69.0


line true false branch
31 2 37 unless $self->{'limit'} =~ /\A\d+\z/ms
32 0 37 if $self->{'period'} <= 0
33 0 37 if $self->{'period'} >= -&Sub::Throttler::Rate::rr::EMPTY()
34 2 35 if keys %opt
36 13 0 if $this
42 11 0 unless ($self->try_acquire($id, $key, $quantity))
43 11 0 if ($quantity <= $self->{'limit'})
48 11 0 if ($delay > 0)
52 0 11 unless ($self->try_acquire($id, $key, $quantity))
61 2 9 if (1 == @_)
64 0 9 unless $limit =~ /\A\d+\z/ms
72 2 7 if ($resources_increases)
80 1 4 if $state->{'algo'} ne 'Sub::Throttler::Rate::AnyEvent'
82 1 3 if ($v > $VERSION)
90 2 2 if ($state->{'at'} > $time)
96 12 0 if ($_ != &Sub::Throttler::Rate::rr::EMPTY())
111 5 3 if (1 == @_)
114 0 3 if $period <= 0
115 0 3 if $self->{'period'} >= -&Sub::Throttler::Rate::rr::EMPTY()
120 1 2 if ($resources_increases)
121 1 0 if ($self->{'_t'}) { }
134 3 25 unless $self->{'acquired'}{$id}
141 3 23 unless $self->{'acquired'}{$id}
148 16 6 if ($self->{'used'}{$key}->get($self->{'limit'}) + $self->{'period'} <= $now)
154 14 9 unless (keys %{$$self{'used'};})
174 3 0 if ($_ != &Sub::Throttler::Rate::rr::EMPTY())
189 2 17 if $self->{'acquired'}{$id} and exists $self->{'acquired'}{$id}{$key}
190 2 162 if $quantity <= 0
195 68 94 unless ($self->{'used'}{$key}->add($self->{'period'}, $now, $quantity))
200 45 49 unless ($self->{'_t'})
212 17 3 if (not $after) { }
3 0 elsif (not $when or $when > $after) { }
219 11 3 !$when ? :
251 3 159 if ($quantity > $len)
260 65 94 if ($self->{'data'}[$required] > $since)
278 3 43 if $self->{'data'}[$_] > $time
290 0 22 unless ($len)
293 0 22 if ($quantity > $len)
297 3 19 if ($self->{'data'}[$self->{'next'}] > $time) { }
16 3 elsif ($self->{'data'}[$self->{'next'}] == $time) { }
3 0 elsif ($self->{'data'}[$self->{'next'} - 1] == $time) { }
304 0 26 if $self->{'data'}[$_] != $time
311 0 6 if $self->{'data'}[$_] != $time
320 0 0 unless defined $i
322 0 0 if $self->{'data'}[$_] != $time
329 0 0 if ($count_fwd <= $count_rew) { }
358 6 1 if ($newlen < $len) { }
374 0 0 if $min < 0 or $#{$aref;} < $max or $min > $max
377 0 0 if ($target > $aref->[$mid]) { }
383 0 0 if $target == $aref->[$min]