Add sample test

This commit is contained in:
ChillerDragon 2024-06-02 09:41:00 +08:00
parent 394069eaa3
commit ad60b3f368
3 changed files with 24 additions and 1 deletions

View file

@ -4,3 +4,10 @@ A client side network protocol implementation of the game teeworlds.
WORK IN PROGRESS
## tests
```
go test
```

View file

@ -1,4 +1,4 @@
package main
package teeworlds
import (
"bufio"

16
teeworlds_test.go Normal file
View file

@ -0,0 +1,16 @@
package teeworlds
import (
"testing"
)
func TestIsCtrlMsg(t *testing.T) {
data := []byte{0x04, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x04}
got := isCtrlMsg(data)
want := true
if got != want {
t.Errorf("got %t, wanted %t", got, want)
}
}