Revision: | 1.10 |
Committed: | Thu Oct 21 15:13:42 2010 UTC (13 years, 9 months ago) by root |
Content type: | application/x-troff |
Branch: | MAIN |
CVS Tags: | EV-rel-4_28, EV-rel-4_29, EV-rel-4_26, EV-rel-4_27, EV-rel-4_25, EV-rel-4_22, EV-rel-4_20, EV-rel-4_21, rel-4_01, rel-4_00, rel-4_03, rel-4_02, EV-rel-4_31, EV-rel-4_30, EV-rel-4_33, EV-rel-4_32, EV-rel-4_34, EV_rel-4_11, EV_rel-4_10, EV-rel-4_15, EV_rel-4_17, EV_rel-4_16, EV-rel-4_18, HEAD |
Changes since 1.9: | +1 -1 lines |
Log Message: | port testsuite |
# | User | Rev | Content |
---|---|---|---|
1 | root | 1.8 | BEGIN { |
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 | |||
10 | root | 1.3 | BEGIN { $| = 1; print "1..6002\n"; } |
11 | |||
12 | no warnings; | ||
13 | root | 1.5 | use strict; |
14 | root | 1.1 | |
15 | use EV; | ||
16 | |||
17 | root | 1.6 | my $fudge = 0.02; # allow rt and monotonic clock to disagree by this much |
18 | |||
19 | root | 1.1 | my $id = 1; |
20 | my @timer; | ||
21 | root | 1.3 | my @periodic; |
22 | root | 1.1 | |
23 | my $base = EV::now; | ||
24 | my $prev = EV::now; | ||
25 | |||
26 | root | 1.4 | for my $i (1..1000) { |
27 | my $t = $i * $i * 1.735435336; $t -= int $t; | ||
28 | root | 1.1 | push @timer, EV::timer $t, 0, sub { |
29 | root | 1.3 | my $now = EV::now; |
30 | |||
31 | root | 1.9 | EV::default_loop->verify; |
32 | root | 1.7 | |
33 | root | 1.6 | print $now + $fudge >= $prev ? "" : "not ", "ok ", ++$id, " # t0 $i $now + $fudge >= $prev\n"; |
34 | print $now + $fudge >= $base + $t ? "" : "not ", "ok ", ++$id, " # t1 $i $now + $fudge >= $base + $t\n"; | ||
35 | root | 1.3 | |
36 | unless ($id % 3) { | ||
37 | $t *= 0.0625; | ||
38 | $_[0]->set ($t); | ||
39 | $_[0]->start; | ||
40 | $t = $now + $t - $base; | ||
41 | } | ||
42 | |||
43 | $prev = $now; | ||
44 | }; | ||
45 | root | 1.2 | |
46 | root | 1.4 | my $t = $i * $i * 1.375475771; $t -= int $t; |
47 | root | 1.3 | push @periodic, EV::periodic $base + $t, 0, 0, sub { |
48 | my $now = EV::now; | ||
49 | |||
50 | root | 1.9 | EV::default_loop->verify; |
51 | root | 1.7 | |
52 | root | 1.4 | print $now >= $prev ? "" : "not ", "ok ", ++$id, " # p0 $i $now >= $prev\n"; |
53 | print $now >= $base + $t ? "" : "not ", "ok ", ++$id, " # p1 $i $now >= $base + $t\n"; | ||
54 | root | 1.1 | |
55 | unless ($id % 3) { | ||
56 | $t *= 1.0625; | ||
57 | root | 1.3 | $_[0]->set ($base + $t); |
58 | root | 1.1 | $_[0]->start; |
59 | } | ||
60 | root | 1.3 | |
61 | $prev = $now; | ||
62 | root | 1.1 | }; |
63 | } | ||
64 | |||
65 | print "ok 1\n"; | ||
66 | root | 1.10 | EV::run; |
67 | root | 1.3 | print "ok 6002\n"; |
68 | root | 1.1 |