refactor-for-testability (#3)
Co-authored-by: jdl <jdl@desktop> Co-authored-by: jdl <jdl@crumpington.com> Reviewed-on: #3
This commit is contained in:
21
peer/header_test.go
Normal file
21
peer/header_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package peer
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestHeaderMarshalParse(t *testing.T) {
|
||||
nIn := header{
|
||||
StreamID: 23,
|
||||
Counter: 3212,
|
||||
SourceIP: 34,
|
||||
DestIP: 200,
|
||||
}
|
||||
|
||||
buf := make([]byte, headerSize)
|
||||
nIn.Marshal(buf)
|
||||
|
||||
nOut := header{}
|
||||
nOut.Parse(buf)
|
||||
if nIn != nOut {
|
||||
t.Fatal(nIn, nOut)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user