ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/t/01_timer.t
(Generate patch)

Comparing EV/t/01_timer.t (file contents):
Revision 1.7 by root, Thu May 22 02:44:57 2008 UTC vs.
Revision 1.9 by root, Tue Mar 16 20:43:05 2010 UTC

1BEGIN {
2 # many testers have totally overloaded machines with virtual machines
3 # running backwards in time etc. etc.
4 if (exists $ENV{AUTOMATED_TESTING}) {
5 print "1..0 # Skipped: Too many broken cpan tester setups.\n";
6 exit;
7 }
8}
9
1BEGIN { $| = 1; print "1..6002\n"; } 10BEGIN { $| = 1; print "1..6002\n"; }
2 11
3no warnings; 12no warnings;
4use strict; 13use strict;
5 14
17for my $i (1..1000) { 26for my $i (1..1000) {
18 my $t = $i * $i * 1.735435336; $t -= int $t; 27 my $t = $i * $i * 1.735435336; $t -= int $t;
19 push @timer, EV::timer $t, 0, sub { 28 push @timer, EV::timer $t, 0, sub {
20 my $now = EV::now; 29 my $now = EV::now;
21 30
22 EV::default_loop->loop_verify; 31 EV::default_loop->verify;
23 32
24 print $now + $fudge >= $prev ? "" : "not ", "ok ", ++$id, " # t0 $i $now + $fudge >= $prev\n"; 33 print $now + $fudge >= $prev ? "" : "not ", "ok ", ++$id, " # t0 $i $now + $fudge >= $prev\n";
25 print $now + $fudge >= $base + $t ? "" : "not ", "ok ", ++$id, " # t1 $i $now + $fudge >= $base + $t\n"; 34 print $now + $fudge >= $base + $t ? "" : "not ", "ok ", ++$id, " # t1 $i $now + $fudge >= $base + $t\n";
26 35
27 unless ($id % 3) { 36 unless ($id % 3) {
36 45
37 my $t = $i * $i * 1.375475771; $t -= int $t; 46 my $t = $i * $i * 1.375475771; $t -= int $t;
38 push @periodic, EV::periodic $base + $t, 0, 0, sub { 47 push @periodic, EV::periodic $base + $t, 0, 0, sub {
39 my $now = EV::now; 48 my $now = EV::now;
40 49
41 EV::default_loop->loop_verify; 50 EV::default_loop->verify;
42 51
43 print $now >= $prev ? "" : "not ", "ok ", ++$id, " # p0 $i $now >= $prev\n"; 52 print $now >= $prev ? "" : "not ", "ok ", ++$id, " # p0 $i $now >= $prev\n";
44 print $now >= $base + $t ? "" : "not ", "ok ", ++$id, " # p1 $i $now >= $base + $t\n"; 53 print $now >= $base + $t ? "" : "not ", "ok ", ++$id, " # p1 $i $now >= $base + $t\n";
45 54
46 unless ($id % 3) { 55 unless ($id % 3) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines