package profile import "testing" func TestStatus(t *testing.T) { h, err := Quicknet().Hash() if err != nil { t.Fatal(err) } if s, ok := StatusOf(h); !ok || s != Active { t.Errorf("StatusOf(Quicknet) = %v, %v", s, ok) } if s, ok := StatusOf([32]byte{1}); ok || s != Active { t.Errorf("StatusOf of an unknown profile = %v, %v", s, ok) } for s, want := range map[Status]string{Active: "active", ReadOnly: "read-only", Compromised: "compromised", 7: "unknown"} { if s.String() != want { t.Errorf("%d: %q, want %q", s, s.String(), want) } } }