File Coverage

blib/lib/Sim/Agent/Engine.pm
Criterion Covered Total %
statement 12 26 46.1
branch 0 12 0.0
condition n/a
subroutine 4 6 66.6
pod 0 2 0.0
total 16 46 34.7


line stmt bran cond sub pod time code
1             package Sim::Agent::Engine;
2              
3 1     1   7 use strict;
  1         2  
  1         39  
4 1     1   6 use warnings;
  1         2  
  1         96  
5              
6             package Sim::Agent::Engine;
7              
8 1     1   7 use strict;
  1         2  
  1         42  
9 1     1   5 use warnings;
  1         2  
  1         302  
10              
11             sub dependencies_satisfied
12             {
13 0     0 0   my ($agent, $state) = @_;
14              
15 0 0         return 1 unless @{ $agent->{wait_for} || [] };
  0 0          
16              
17 0           for my $dep (@{ $agent->{wait_for} })
  0            
18             {
19 0 0         return 0 unless exists $state->{completed}->{$dep};
20 0 0         return 0 unless $state->{completed}->{$dep}->{status} eq 'ok';
21             }
22              
23 0           return 1;
24             }
25              
26             sub is_enqueued_or_active
27             {
28 0     0 0   my ($state, $agent) = @_;
29              
30 0 0         return 1 if $state->{active}->{$agent};
31              
32 0           for my $queued (@{ $state->{queue} })
  0            
33             {
34 0 0         return 1 if $queued eq $agent;
35             }
36              
37 0           return 0;
38             }
39              
40              
41             1;
42              
43             =pod
44              
45             =head1 NAME
46              
47             Sim::Agent::Engine - Small pure helper routines used by the runner
48              
49             =head1 DESCRIPTION
50              
51             Internal helpers used by the runner (e.g. dependency checks, queue guards). Intentionally minimal and side-effect free.
52              
53             See L.
54              
55             =head1 AUTHOR
56              
57             Gian Luca Brunetti (2026), gianluca.brunetti@gmail.com
58              
59             =head1 LICENSE
60              
61             The GNU General Public License v3.0
62              
63             =cut
64