vppn/peer/router-ping_test.go
2024-12-12 21:11:17 +01:00

38 lines
511 B
Go

package peer
import (
"reflect"
"testing"
)
func TestMarshalParsePingReq(t *testing.T) {
in := Ping{
SentAt: 4553252,
}
buf := make([]byte, PING_SIZE)
in.Marshal(buf)
out := Ping{}
out.Parse(buf)
if !reflect.DeepEqual(in, out) {
t.Fatal(in, out)
}
}
func TestMarshalParsePingResp(t *testing.T) {
in := Pong{
SentAt: 4553252,
RecvdAt: 4553253,
}
buf := make([]byte, PONG_SIZE)
in.Marshal(buf)
out := Pong{}
out.Parse(buf)
if !reflect.DeepEqual(in, out) {
t.Fatal(in, out)
}
}