| 1 | package Test2::Workflow::Task::Group; | ||||||||||||||||||||||||||||
| 2 | 38 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 38 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 38 | our $VERSION = '1.302226'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 38 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 38 | ▶ | use Test2::Workflow::Task::Action; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 38 | ▶ | use base 'Test2::Workflow::Task'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 38 | ▶ | use Test2::Util::HashBase qw/before after primary rand variant/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 201 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 201 | my $self = shift; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 201 | ▶ | if (my $take = delete $self->{take}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 134 | $self->{$_} = delete $take->{$_} for ISO, ASYNC, TODO, SKIP; | |||||||||||||||||||||||||||
| 19 | 134 | $self->{$_} = $take->{$_} for FLAT, SCAFFOLD, NAME, CODE, FRAME; | |||||||||||||||||||||||||||
| 20 | 134 | $take->{+FLAT} = 1; | |||||||||||||||||||||||||||
| 21 | 134 | $take->{+SCAFFOLD} = 1; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | { | ||||||||||||||||||||||||||||
| 25 | 201 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | |||||||||||||||||||||||||||
| 26 | 201 | $self->SUPER::init(); | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 201 | ▶ | $self->{+BEFORE} ||= []; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"before"} ||= []
MC/DC0%0/1
$self->{"before"} ||= []
$self->{"before"}
Truth table50%1/2
A
A= $self->{"before"}
| |||||||||||||||||||||||||||||
| 30 | 201 | ▶ | $self->{+AFTER} ||= []; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"after"} ||= []
MC/DC0%0/1
$self->{"after"} ||= []
$self->{"after"}
Truth table50%1/2
A
A= $self->{"after"}
| |||||||||||||||||||||||||||||
| 31 | 201 | ▶ | $self->{+PRIMARY} ||= []; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"primary"} ||= []
MC/DC0%0/1
$self->{"primary"} ||= []
$self->{"primary"}
Truth table50%1/2
A
A= $self->{"primary"}
| |||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 601 | ▶ | sub filter { | ||||||||||||||||||||||||||
|
Subroutine
filter: called CC=11 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 601 | my $self = shift; | |||||||||||||||||||||||||||
| 36 | 601 | my ($filter) = @_; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 601 | ▶ | return if $self->{+IS_ROOT}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 601 | my $result = $self->SUPER::filter($filter); | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 601 | my $child_ok = 0; | |||||||||||||||||||||||||||
| 43 | 601 | for my $c (@{$self->{+PRIMARY}}) { | |||||||||||||||||||||||||||
| 44 | 894 | ▶ | next if $c->{+SCAFFOLD}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | # A child matches the filter, so we should not be filtered, but also | ||||||||||||||||||||||||||||
| 46 | # should not satisfy the filter. | ||||||||||||||||||||||||||||
| 47 | 430 | my $res = $c->filter($filter); | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | # A child satisfies the filter | ||||||||||||||||||||||||||||
| 50 | 430 | ▶ | $child_ok++ if !$res || $res->{satisfied}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $res or $res->{"satisfied"}
MC/DC100%2/2
not $res or $res->{"satisfied"}
not $res
$res->{"satisfied"}
Truth table100%3/3
not(A) or B
A= not $resB= $res->{"satisfied"}
| |||||||||||||||||||||||||||||
| 51 | 430 | ▶ | last if $child_ok; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | # If the filter says we are ok | ||||||||||||||||||||||||||||
| 55 | 601 | ▶ | unless($result) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | # If we are a variant then allow everything under us to be run | ||||||||||||||||||||||||||||
| 57 | 78 | ▶ | return {satisfied => 1} if $self->{+VARIANT} || !$child_ok; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"variant"} or not $child_ok
MC/DC100%2/2
$self->{"variant"} or not $child_ok
$self->{"variant"}
not $child_ok
Truth table100%3/3
A or not(B)
A= $self->{"variant"}B= not $child_ok
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # Normal group | ||||||||||||||||||||||||||||
| 60 | 8 | return; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 523 | ▶ | return if $child_ok; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 457 | return $result; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 38 | 1; | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | __END__ | ||||||||||||||||||||||||||||