File: 4_multiple_iterations.t

package info (click to toggle)
libschedule-ratelimiter-perl 0.01-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 84 kB
  • sloc: perl: 47; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 589 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#use Test::More qw( no_plan );
use Test::More tests => 202;

use Schedule::RateLimiter;
ok(1, 'Did the Schedule::RateLimiter module load?'); # If we made it this far, we're ok.

#########################

my $throttle = Schedule::RateLimiter->new( seconds => 99999999, iterations => 100 );
ok ( ref( $throttle ), 'Did we build an Schedule::RateLimiter with more than one iteration?' );
for ( 1 .. 100 ) {
    ok ( $throttle->event( block => 0 ), "Was event $_ allowed to run?" );
}
for ( 101 .. 200 ) {
    ok (! $throttle->event( block => 0 ), "Was event $_ dis-allowed to run?" );
}