## Default-parity + registration guard for the LEADGAIN gun (id 16). ## ## No Java, no battle, no network build. Covers: ## * the rack table carries LEADGAIN at id 16 and it defaults to `off`; ## * the shipped rack still admits exactly Pattern; ## * TR_RACK_LEADGAIN=both is what admits it, and the spawn gate honours it; ## (the LEGACY TR_RACK_BITBRAIN alias is pinned by ## `test_lead_gain_legacy.nim`); ## * `initLeadGainGun()` is LAZY (no learner) and does NOT touch the global ## RNG, so the default path cannot perturb the selector's random draws; ## * the mode parser defaults to `perRound`. ## ## Run: nim c -r common_libs/tests/test_lead_gain_registration.nim import std/[random, os, math] import gun_harness/virtual_bullets import gun_harness/selector import guns/lead_gain const LeadGainId = 16 const PatternId = 5 var failures = 0 proc check(name: string, ok: bool) = if ok: echo "PASS: ", name else: echo "FAIL: ", name; inc failures proc clearRackEnv() = for name in RackGunNames: delEnv("TR_RACK_" & name) proc testTable() = check "rack: LEADGAIN is registered at id 16", RackGunNames[LeadGainId] == "LEADGAIN" check "rack: LEADGAIN defaults to `off`", DefaultRackMembership[LeadGainId] == rmOff var onlyPattern = true for i in 0.. 0: echo "\n", failures, " check(s) FAILED" quit(1) echo "\nAll LEADGAIN registration checks passed."