package main import "testing" // TASK D1 Group D — agent_update opsign param validation. isHex64 is the sha gate the CLI applies // before it will build an agent_update envelope (the agent re-validates too, but a bad sha should // never even be signed). func TestIsHex64(t *testing.T) { good := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" // 64 'a' if !isHex64(good) { t.Errorf("isHex64(%q) = false, want true", good) } for name, bad := range map[string]string{ "too short": "abcdef", "too long": good + "a", "uppercase hex": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "non-hex char": "g" + good[1:], "empty": "", } { if isHex64(bad) { t.Errorf("%s: isHex64(%q) = true, want false", name, bad) } } }