model_test.go 412 B

12345678910111213141516171819202122
  1. package model
  2. import "testing"
  3. func TestIsHysteria(t *testing.T) {
  4. cases := []struct {
  5. in Protocol
  6. want bool
  7. }{
  8. {Hysteria, true},
  9. {Hysteria2, true},
  10. {VLESS, false},
  11. {Shadowsocks, false},
  12. {Protocol(""), false},
  13. {Protocol("hysteria3"), false},
  14. }
  15. for _, c := range cases {
  16. if got := IsHysteria(c.in); got != c.want {
  17. t.Errorf("IsHysteria(%q) = %v, want %v", c.in, got, c.want)
  18. }
  19. }
  20. }