| 1 | package POE::Test::Sequence; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 1 | ▶ | use Carp qw(croak); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 1 | ▶ | use POE; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 1 | $VERSION = '1.370'; # NOTE - Should be #.### (three decimal places) | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||
| 13 | 1 | my ($class, %args) = @_; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 1 | my $sequence = delete $args{sequence}; | |||||||||||||||||||
| 16 | 1 | ▶ | croak "sequence required" unless defined $sequence; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 1 | return bless { | |||||||||||||||||||
| 19 | sequence => $sequence, | ||||||||||||||||||||
| 20 | test_count => scalar( @$sequence ), | ||||||||||||||||||||
| 21 | }, $class; | ||||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 15 | ▶ | sub next { | ||||||||||||||||||
|
Subroutine
next: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||
| 25 | 15 | my ($self, $event, $parameter) = @_; | |||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 15 | my $expected_result = shift @{ $self->{sequence} }; | |||||||||||||||||||
| 28 | 15 | ▶ | unless (defined $expected_result) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 0 | Test::More::fail( | |||||||||||||||||||
| 30 | "Got an unexpected result ($event, $parameter). Time to bye." | ||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||
| 32 | 0 | exit; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 15 | my $next_action = pop @$expected_result; | |||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 15 | Test::More::note "Testing (@$expected_result)"; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 15 | Test::More::is_deeply( [ $event, $parameter ], $expected_result ); | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 15 | ▶ | return $next_action || sub { undef }; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$next_action || sub {
undef;
}
MC/DC0%0/2
$next_action || sub {
undef;
}
$next_action
sub {
undef;
}
Truth table66%2/3
A || B
A= $next_actionB= sub {
undef;
}
| |||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 1 | ▶ | sub test_count { | ||||||||||||||||||
|
Subroutine
test_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 45 | 1 | return $_[0]{test_count}; | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 0 | ▶ | sub create_generic_session { | ||||||||||||||||||
|
Subroutine
create_generic_session: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 49 | 0 | my ($self) = @_; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | POE::Session->create( | ||||||||||||||||||||
| 52 | inline_states => { | ||||||||||||||||||||
| 53 | 0 | ▶ | _start => sub { goto $self->next( $_[STATE], 0 ) }, | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 54 | 0 | ▶ | _default => sub { goto $self->next( $_[ARG0], 0 ) }, | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 55 | } | ||||||||||||||||||||
| 56 | 0 | ); | |||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | 1 | 1; | |||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | __END__ | ||||||||||||||||||||