tools: mutations p-s for the protocol module and the n counter (#18)

This commit is contained in:
2026-11-15 08:33:12 +01:00
parent 5e43ffa545
commit 951f37c3fb
+9 -1
View File
@@ -66,6 +66,10 @@ L="GM moves a stuck token|GM drops a token|GM manual clear inside|GM: ignores wa
M="Q14: a door closed|push: centre on the door line|push: one side blocked|doorway: token in an open doorway|GM drops a token"
N="push: one side blocked|push: both sides invalid"
O="push: centre on the door line"
P="refill is continuous"
Q="reqId boundaries"
R="nine malformed frames are tolerated"
S="the frame counter starts at 1"
IDS=()
run() {
while [ "$(jobs -rp | wc -l)" -ge "$JOBS" ]; do wait -n; done
@@ -89,9 +93,13 @@ run l "GM moves never set or clear blocked" server/moverules.nim '/^ if who.rol
run m "door push: wrong side first" server/moverules.nim 's/for sg in \[(if side > 0: 1.0 else: -1.0), (if side > 0: -1.0 else: 1.0)\]:/for sg in [(if side > 0: -1.0 else: 1.0), (if side > 0: 1.0 else: -1.0)]:/' "$M"
run n "door push: no validity check" server/moverules.nim 's/if inBounds(sc, p) and not overlapsAny(sc, tt): return (true, p)/return (true, p)/' "$N"
run o "door push: previous position ignored on the line" server/moverules.nim 's/side = if t.hasPrev: dot(t.prev - w.a, n) else: 0.0/side = 0.0/' "$O"
run p "token bucket never refills" server/protocol.nim '/r.tokens = min(r.burst/d' "$P"
run q "reqId upper bound dropped" server/protocol.nim 's/if reqId < 0 or reqId > MaxReqId: return/if reqId < 0: return/' "$Q"
run r "malformed flood never fires" server/protocol.nim 's/f.count >= MalformedFloodLimit/f.count > MalformedFloodLimit/' "$R"
run s "the frame counter never advances" server/conns.nim 's/ inc c.active\[i\].frames/ discard/' "$S"
wait
rc=0; : > "$LOG"
for id in control a b c d1 d2 e f g h i j k l m n o; do
for id in control a b c d1 d2 e f g h i j k l m n o p q r s; do
[ -f "$T/$id/res" ] && cat "$T/$id/res" >> "$LOG"
if [ -f "$T/$id/verdict" ]; then tee -a "$LOG" < "$T/$id/verdict"; [ "$(cat "$T/$id/rc")" = 0 ] || rc=1
else echo "$id: NO RESULT (job killed?)" | tee -a "$LOG"; rc=1; fi