## Pure unit guard for the `TR_VBULLET_ADMIT_ONLY` spawn-gate predicate. ## ## No Java, no battle, no virtual bullets: `vBulletAdmitted` is a pure function of ## (gunId, rack mode, membership table, admitOnly) over the SHIPPED ## `DefaultRackMembership`, so the live gate can be pinned without running the ## bot. Covers: ## * the shipped default rack admits Pattern (5) and nothing else; ## * `admitOnly=false` (TR_VBULLET_ADMIT_ONLY=0) restores "spawn for every gun"; ## * mode-restricted membership (`rmOnly1v1` / `rmOnlyMelee`) flips with mode; ## * an empty membership table filters nothing (pre-change callers); ## * out-of-range ids are admitted, negative ids are not; ## * the TMPATTERN special case: forcing `admitOnly=true` keeps gun 14 gated ## even when the knob is off — the exact composition the live loop uses. ## ## Run with plain: ## nim c -r common_libs/tests/test_vbullet_admit_gate.nim import gun_harness/virtual_bullets import gun_harness/selector var failures = 0 proc check(name: string, ok: bool) = if ok: echo "PASS: ", name else: echo "FAIL: ", name; inc failures proc testShippedDefaultRack() = ## The shipped onlyPattern table: Pattern (5) admitted in both modes, every ## other registered gun (0..14) off. check "default: Pattern admitted in 1v1", vBulletAdmitted(5, rm1v1, DefaultRackMembership, true) check "default: Pattern admitted in melee", vBulletAdmitted(5, rmMelee, DefaultRackMembership, true) var allOthersOff = true for gi in 0.. 0: echo "\n", failures, " check(s) FAILED" quit(1) echo "\nAll vbullet-admit-gate checks passed."