line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Test::Sequence; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
386
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use Carp qw(croak); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
7
|
1
|
|
|
1
|
|
5
|
use POE; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
1
|
|
|
1
|
1
|
414
|
my ($class, %args) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
5
|
my $sequence = delete $args{sequence}; |
13
|
1
|
50
|
|
|
|
7
|
croak "sequence required" unless defined $sequence; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
9
|
return bless { |
16
|
|
|
|
|
|
|
sequence => $sequence, |
17
|
|
|
|
|
|
|
test_count => scalar( @$sequence ), |
18
|
|
|
|
|
|
|
}, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub next { |
22
|
15
|
|
|
15
|
1
|
308
|
my ($self, $event, $parameter) = @_; |
23
|
|
|
|
|
|
|
|
24
|
15
|
|
|
|
|
18
|
my $expected_result = shift @{ $self->{sequence} }; |
|
15
|
|
|
|
|
42
|
|
25
|
15
|
50
|
|
|
|
41
|
unless (defined $expected_result) { |
26
|
0
|
|
|
|
|
0
|
Test::More::fail( |
27
|
|
|
|
|
|
|
"Got an unexpected result ($event, $parameter). Time to bye." |
28
|
|
|
|
|
|
|
); |
29
|
0
|
|
|
|
|
0
|
exit; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
15
|
|
|
|
|
32
|
my $next_action = pop @$expected_result; |
33
|
|
|
|
|
|
|
|
34
|
15
|
|
|
|
|
104
|
Test::More::note "Testing (@$expected_result)"; |
35
|
|
|
|
|
|
|
|
36
|
15
|
|
|
|
|
3992
|
Test::More::is_deeply( [ $event, $parameter ], $expected_result ); |
37
|
|
|
|
|
|
|
|
38
|
15
|
|
100
|
4
|
|
11607
|
return $next_action || sub { undef }; |
|
4
|
|
|
|
|
20
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub test_count { |
42
|
1
|
|
|
1
|
1
|
22
|
return $_[0]{test_count}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub create_generic_session { |
46
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
POE::Session->create( |
49
|
|
|
|
|
|
|
inline_states => { |
50
|
0
|
|
|
0
|
|
|
_start => sub { goto $self->next( $_[STATE], 0 ) }, |
51
|
0
|
|
|
0
|
|
|
_default => sub { goto $self->next( $_[ARG0], 0 ) }, |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |