Reads the game's process memory read-only (AOB signature scanning, re-resolved every tick — never a cached pointer) and serves a live death counter as a browser-source overlay plus a status panel. Supports co-op: each player runs the program locally, one acts as hub. The peer link is authenticated (HMAC challenge/response, no token on the wire, constant-time compare) but not yet encrypted — see CLAUDE.md's TODO section for the planned TLS+pinning split. Zero external dependencies — including a hand-rolled WebSocket implementation — so the whole thing ships as one .exe.
55 lines
1.4 KiB
Go
55 lines
1.4 KiB
Go
package main
|
||
|
||
import "testing"
|
||
|
||
func TestLooksLikeName(t *testing.T) {
|
||
cases := []struct {
|
||
name string
|
||
ok bool
|
||
}{
|
||
// Latin: the usual case.
|
||
{"Vaike", true},
|
||
{"Jean-Paul", true},
|
||
{"O'Brien", true},
|
||
{"Tarnished 2", true},
|
||
|
||
// Cyrillic.
|
||
{"Иван", true},
|
||
{"Мария Петровна", true},
|
||
|
||
// Hangul.
|
||
{"지우", true},
|
||
{"김민준", true},
|
||
|
||
// CJK: Han, Hiragana, and Katakana count as a single family
|
||
// because Japanese mixes them in one name.
|
||
{"田中", true}, // Han alone (also valid in Chinese)
|
||
{"たろう", true}, // Hiragana alone
|
||
{"タロウ", true}, // Katakana alone
|
||
{"田中たかし", true}, // Han + Hiragana, typical Japanese name
|
||
|
||
// Cases that MUST keep failing (regression, see CLAUDE.md):
|
||
// Greek + Han mixed, the garbage a 64-bit pointer decodes into
|
||
// when read as UTF-16.
|
||
{"ᾘ䱷翶", false},
|
||
|
||
// Mixing two ACCEPTED families is still mixing: not a valid
|
||
// name in any real language.
|
||
{"Аnna", false}, // Cyrillic А + Latin nna
|
||
|
||
// The usual rules: length, leading punctuation, digits-only.
|
||
{"", false},
|
||
{"A", false},
|
||
{"WayTooLongOfANameToBeRealHonestly", false},
|
||
{"-Starts", false},
|
||
{"123", false},
|
||
{"Ok 123", true},
|
||
}
|
||
|
||
for _, c := range cases {
|
||
if got := looksLikeName(c.name); got != c.ok {
|
||
t.Errorf("looksLikeName(%q) = %v, wanted %v", c.name, got, c.ok)
|
||
}
|
||
}
|
||
}
|