Enterprise testing

Manual mutation comparison

Check that the chosen invariant detects a deliberate fault; not a PIT report. Executed Java 21 fixture.

Formal Syntax & Structure

java syntaxjava
stock + n versus stock - n

Working Example

Example Snippetjava
public class Main {    static int reserve(int stock,int n) { return stock-n; }    public static void main(String[] args) {var rng = new java.util.Random(46);        int checked = 0; boolean killed = false;        for (int i=0; i<200; i++) {            int stock=rng.nextInt(100), n=rng.nextInt(stock+1);            if (reserve(stock,n) != stock-n) throw new AssertionError("seed 46 case "+i);            if (stock+n != stock-n) killed=true;            checked++;        }        System.out.println(checked); System.out.println(killed);    }}
Java Reference