Juggernaut.Schemata.Bisect (Juggernaut v0.4.0)

Copy Markdown View Source

Poison isolation's fallback (design notes §10.4): when the span map cannot pin a file's errors on mutants within its rounds, the file's mutants are compiled in groups until each poisoned one is found, so the mutants that compile stay switched.

The file is first compiled with no mutant (an error there is outside the mutants: the file is compiled as written). Then each group is compiled with the mutants already proven: a group that compiles is proven; a failing group with inline mutants has them moved into lifted copies and is compiled again (a place inside a macro's argument that cannot take a case is the usual cause); a failing group of lifted mutants is split in two; a failing single lifted mutant is a compile error. After max compiles the mutants not yet proven are compile errors with that reason, and the proven ones stay.

The budget is the file's, not one bisection's: a file whose proven mutants fail again later is bisected again with the compiles it has left (Unit.bisected counts those spent), and a file with none left is compiled as written.

Summary

Functions

Whether unit is being bisected.

Starts bisecting unit, whose live mutants failed to compile with error (described), for at most max compiles of the file, counting those earlier bisections of it spent. The failure of all of them counts as the first group's. A file with no compiles left is compiled as written.

One step after a compile: error is nil when the compile passed (the current group is proven), else the description of the error the group is failed with.

Types

state()

@type state() :: %{
  proven: [Juggernaut.Schemata.Unit.entry()],
  queue: [[Juggernaut.Schemata.Unit.entry()]],
  order: %{required(String.t()) => non_neg_integer()},
  compiles: non_neg_integer(),
  max: pos_integer()
}

Functions

active?(unit)

@spec active?(Juggernaut.Schemata.Unit.t()) :: boolean()

Whether unit is being bisected.

start(unit, error, max)

Starts bisecting unit, whose live mutants failed to compile with error (described), for at most max compiles of the file, counting those earlier bisections of it spent. The failure of all of them counts as the first group's. A file with no compiles left is compiled as written.

step(unit, error)

One step after a compile: error is nil when the compile passed (the current group is proven), else the description of the error the group is failed with.