Add sample test
This commit is contained in:
parent
394069eaa3
commit
ad60b3f368
|
@ -4,3 +4,10 @@ A client side network protocol implementation of the game teeworlds.
|
||||||
|
|
||||||
WORK IN PROGRESS
|
WORK IN PROGRESS
|
||||||
|
|
||||||
|
|
||||||
|
## tests
|
||||||
|
|
||||||
|
```
|
||||||
|
go test
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package teeworlds
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
|
16
teeworlds_test.go
Normal file
16
teeworlds_test.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue