package matcher import ( "fmt" "testing" ) type TestMatcher struct { } func (t *TestMatcher) ServiceName() string { return "TestMatcher" } func (t *TestMatcher) Match(info MatchInfo, index int, packet []byte) bool { return true } func (t *TestMatcher) PacketCount() int { return 1 } func (t *TestMatcher) Packet(index int) []byte { return nil } func (t *TestMatcher) IsError(info MatchInfo, index int, packet []byte) bool { return true } func (t *TestMatcher) HasResponse(index int) bool { return true } func (t *TestMatcher) IsPrePacket() bool { return true } type Animal interface { Speak() string } type Dog struct { } func (d Dog) Speak() string { return "Woof!" } type Cat struct { } func (c Cat) Speak() string { return "Meow!" } type Llama struct { } func (l Llama) Speak() string { return "?????" } type JavaProgrammer struct { } func (j JavaProgrammer) Speak() string { return "Design patterns!" } func TestMatcherTTT(t *testing.T) { //animals := []Animal{Dog{}, Cat{}, Llama{}, JavaProgrammer{}} var animals []Animal animals = append(animals, &Dog{}) animals = append(animals, &Cat{}) animals = append(animals, &Llama{}) animals = append(animals, &JavaProgrammer{}) for _, a := range animals { fmt.Println(a.Speak()) } } func TestMatchersInit(t *testing.T) { }