ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Coro/t/03_cont.t
Revision: 1.2
Committed: Thu Jul 19 02:45:09 2001 UTC (25 years, 3 months ago) by root
Content type: application/x-troff
Branch: MAIN
Changes since 1.1: +3 -2 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 $|=1;
2     print "1..13\n";
3    
4     use Coro;
5     use Coro::Cont;
6    
7     $test = 1;
8    
9     sub a1 : Coro {
10 root 1.2 my $cont = csub {
11 root 1.1 { local $_; yield };
12     result $_*2;
13     { local $_; yield };
14     result $_*3;
15     };
16     my @arr = map &$cont, 1,2,3,4,5,6;
17     for(2,6,6,12,10,18) {
18     print (((shift @arr == $_) ? "ok " : "not ok "), $test++, "\n");
19     }
20     $done++;
21     yield while 1;
22     }
23    
24     sub a2 : Coro {
25 root 1.2 my $cont = csub {
26 root 1.1 { local $_; yield };
27     result $_*20;
28     { local $_; yield };
29     result $_*30;
30     };
31     my @arr = map &$cont, 1,2,3,4,5,6;
32     for(20,60,60,120,100,180) {
33     print (((shift @arr == $_) ? "ok " : "not ok "), $test++, "\n");
34     }
35     $done++;
36     yield while 1;
37     }
38    
39     print "ok ", $test++, "\n";
40    
41     $done = 0;
42    
43     yield while $done < 2;
44 root 1.2