23 lines
281 B
Go
23 lines
281 B
Go
package stage3
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestPacketHeader(t *testing.T) {
|
|
b := make([]byte, 1024)
|
|
|
|
h := packetHeader{
|
|
SrcIP: 8,
|
|
Counter: 2354,
|
|
}
|
|
n := h.Marshal(b)
|
|
h2 := packetHeader{}
|
|
h2.Parse(b[:n])
|
|
|
|
if !reflect.DeepEqual(h, h2) {
|
|
t.Fatal(h, h2)
|
|
}
|
|
}
|