Files
deathwatch/names_test.go
emmatherock e1f7e6f529 Initial commit: DeathWatch, an Elden Ring death counter for OBS
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.
2026-09-17 21:10:22 -03:00

55 lines
1.4 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)
}
}
}