## Default-parity + registration guard for the BitBrain gun (id 16). ## ## No Java, no battle, no network build. Covers: ## * the rack table carries BITBRAIN at id 16 and it defaults to `off`; ## * the shipped rack still admits exactly Pattern; ## * TR_RACK_BITBRAIN=both is what admits it, and the spawn gate honours it; ## * `initBitBrainGun()` is LAZY (no network) 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_bitbrain_registration.nim import std/[random, os, math] import gun_harness/virtual_bullets import gun_harness/selector import guns/bitbrain_gun const BitBrainId = 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: BITBRAIN is registered at id 16", RackGunNames[BitBrainId] == "BITBRAIN" check "rack: BITBRAIN defaults to `off`", DefaultRackMembership[BitBrainId] == rmOff var onlyPattern = true for i in 0.. 0: echo "\n", failures, " check(s) FAILED" quit(1) echo "\nAll BitBrain registration checks passed."