AI-Pathfinding-OptimizeMultiple

 view release on metacpan or  search on metacpan

lib/AI/Pathfinding/OptimizeMultiple/App/CmdLine.pm  view on Meta::CPAN

    return $self->_map_all_but_last(
        sub {
            my ($line) = @_;

            return $line . ' ' . ( $self->_is_flares() ? "-nf" : "-nst" );
        },
        [
            map {
                my $line = $_;

                # Add the -sp r:tf flag to each scan if specified - it enhances
                # performance, but timing the scans with it makes the total
                # scan sub-optimal.
                if ( $self->_add_horne_prune() )
                {
                    $line =~ s/( --st-name)/ -sp r:tf$1/;
                }
                $line;
            } @$lines_aref
        ],
    );

t/cmdline-app.t  view on Meta::CPAN

{
    plan skip_all => "Test::Trap not found.";
}

plan tests => 6;

my @running_modes = (
    {
        blurb_base => 'modulino',
        sub_ref    => sub {
            my ($flags) = @_;
            AI::Pathfinding::OptimizeMultiple::App::CmdLine->new(
                {
                    argv => [@$flags],
                },
            )->run();
        },
    },
    {
        blurb_base => 'cmd_line',
        sub_ref    => sub {
            my ($flags) = @_;
            system( $^X, "bin/optimize-game-ai-multi-tasking", @$flags );
        },
    },
);

# TEST:$num_subs=2;
foreach my $mode (@running_modes)
{
    my $blurb_base = $mode->{blurb_base};

    trap( sub { return $mode->{sub_ref}->( [qw(--help)] ); } );

    # TEST*$num_subs
    like( $trap->stdout(), qr/--output/,
        "stdout matches --output flag. ($blurb_base)",
    );

    # TEST*$num_subs
    like(
        $trap->stdout(),
        qr/--help[^\n]*-h[^\n]*displays this help screen/ms,
        "stdout matches --output flag. ($blurb_base)",
    );

    # TEST*$num_subs
    ok( scalar( !$trap->die ), "No exception was thrown. ($blurb_base)", );
}



( run in 1.427 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )