VERSION

Version 0.34

DESCRIPTION

Abstract base class for all mutation strategies in App::Test::Generator. Subclasses must implement both applies_to and mutate.

new

Construct a new mutation strategy object.

my $strategy = My::Mutation::Subclass->new;

Arguments

None.

Returns

A blessed hashref of the subclass type.

API specification

input

{}

output

{
    type => OBJECT,
    isa  => 'App::Test::Generator::Mutation::Base',
}

applies_to

Return true if this mutation strategy applies to the given PPI document. Subclasses must override this method.

if ($strategy->applies_to($doc)) {
    my @mutants = $strategy->mutate($doc);
}

Arguments

Returns

A boolean. Croaks if called on the base class directly.

API specification

input

{
    self => { type => OBJECT, isa => 'App::Test::Generator::Mutation::Base' },
    doc  => { type => OBJECT, isa => 'PPI::Document' },
}

output

{ type => SCALAR }

mutate

Generate and return a list of mutants for the given PPI document. Subclasses must override this method.

my @mutants = $strategy->mutate($doc);

Arguments

  • $doc

    A PPI::Document object representing the source file to mutate. Must not be modified by this method.

Returns

A list of App::Test::Generator::Mutant objects. Croaks if called on the base class directly.

API specification

input

{
    self => { type => OBJECT, isa => 'App::Test::Generator::Mutation::Base' },
    doc  => { type => OBJECT, isa => 'PPI::Document' },
}

output

{
    type     => ARRAYREF,
    elements => { type => OBJECT, isa => 'App::Test::Generator::Mutant' },
}