NAME

App::Test::Generator::LCSAJ - Static LCSAJ extraction for Perl

SYNOPSIS

use App::Test::Generator::LCSAJ;

my $paths = App::Test::Generator::LCSAJ->generate(
    'lib/MyModule.pm',
    'cover_html/mutation_html/lib',
);

DESCRIPTION

Extracts Linear Code Sequence and Jump (LCSAJ) paths from Perl source files using static analysis via PPI. Each LCSAJ path describes a linear sequence of statements followed by a jump to another sequence, forming the basis for TER3 (third-level Test Effectiveness Ratio) measurement.

The extracted paths are written as JSON to a .lcsaj.json file under the output directory, where they are consumed by bin/test-generator-index for dashboard display and TER3 calculation.

VERSION

Version 0.34

generate

Extract LCSAJ paths from all subroutines in a Perl source file and write the results to a JSON file.

my $paths = App::Test::Generator::LCSAJ->generate(
    'lib/MyModule.pm',
    'cover_html/mutation_html/lib',
);

printf "Extracted %d LCSAJ paths\n", scalar @{$paths};

Arguments

  • $file

    Path to the Perl source file to analyse. Required.

  • $out_dir

    Directory under which the .lcsaj.json file will be written. Optional — defaults to lcsaj.

Returns

An arrayref of LCSAJ path hashrefs, each with keys start, end, and target representing the first line, last line, and jump target line of the path respectively.

Side effects

Creates $out_dir if it does not exist. Writes a .lcsaj.json file to $out_dir.

Notes

Only named subroutines are analysed. Anonymous subs and file-level code are not included. The control flow graph is built using a simplified model that treats branching compound statements as split points — complex nested structures may not be fully represented.

API specification

input

{
    class   => { type => SCALAR },
    file    => { type => SCALAR },
    out_dir => { type => SCALAR, optional => 1 },
}

output

{
    type     => ARRAYREF,
    elements => {
        type => HASHREF,
        keys => {
            start  => { type => SCALAR },
            end    => { type => SCALAR },
            target => { type => SCALAR },
        },
    },
}

1 POD Error

The following errors were encountered while parsing the POD:

Around line 73:

Non-ASCII character seen before =encoding in '—'. Assuming UTF-8