From 46a81e7a07c7fa0962c4196c9af12ca3d1c4b8d9 Mon Sep 17 00:00:00 2001 From: funman300 Date: Wed, 12 Aug 2026 02:30:38 +0000 Subject: [PATCH] test(adapter): squad mutation battery (14 mutants, all killed) mutation-battery.sh injects each of the 14 required wrong behaviours into the committed source, runs the one invariant test that must catch it, and requires a non-zero exit (mutant killed), reverting via git after each. Kills: kit-by-slot, captain-as-resourceId, chemistry-reconciled, custom-regenerated, index-derived, stale-accepted, missing-fabricated, faked-asset-id, duplicate-instance-collapse, PUT-as-slot-diff, wire-id-in-canonical, projector-bypasses-shared-shaper, schema-version- ignored, player-state-keyed-by-definition. 14/14 killed. --- openfut-adapter-fifa17/mutation-battery.sh | 108 +++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100755 openfut-adapter-fifa17/mutation-battery.sh diff --git a/openfut-adapter-fifa17/mutation-battery.sh b/openfut-adapter-fifa17/mutation-battery.sh new file mode 100755 index 0000000..dcee49a --- /dev/null +++ b/openfut-adapter-fifa17/mutation-battery.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +# FIFA 17 squad-adapter mutation battery. +# +# Each mutation injects a specific WRONG behaviour into the committed source, +# runs the one test that defends the invariant, and requires that test to FAIL +# (non-zero exit) — i.e. the mutant is killed. The source is reverted via +# `git checkout` after every mutation, so the tree is left untouched. +# +# A mutant that SURVIVES (its guard test still passes) means the invariant is +# not actually defended; the battery then exits non-zero. +# +# Run from the adapter crate root: bash mutation-battery.sh +set -u +cd "$(dirname "$0")" + +FUT=src/fut +PASS=0 +FAIL=0 +declare -a SURVIVORS=() + +# mutate (literal, multiline-safe) +mutate() { + OLD="$2" NEW="$3" perl -0777 -pi -e \ + 's/\Q$ENV{OLD}\E/$ENV{NEW}/g or die "MUTATION PATTERN NOT FOUND in '"$1"'\n"' "$1" +} + +# kill