26 lines
339 B
Go
26 lines
339 B
Go
package peer
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestMarshalParseNonce(t *testing.T) {
|
|
nIn := Nonce{
|
|
Counter: 3212,
|
|
SourceIP: 34,
|
|
ViaIP: 20,
|
|
DestIP: 200,
|
|
StreamID: 4,
|
|
PacketType: 44,
|
|
}
|
|
|
|
buf := make([]byte, NONCE_SIZE)
|
|
nIn.Marshal(buf)
|
|
|
|
nOut := Nonce{}
|
|
nOut.Parse(buf)
|
|
if nIn != nOut {
|
|
t.Fatal(nIn, nOut)
|
|
}
|
|
}
|