diff --git a/rtp/rtp_test.go b/rtp/rtp_test.go new file mode 100644 index 0000000..36f5ee3 --- /dev/null +++ b/rtp/rtp_test.go @@ -0,0 +1,30 @@ +package rtp_test + +import ( + "reflect" + "testing" + + "github.com/jart/gosip/rtp" +) + +func TestRTPRoundTrip(t *testing.T) { + h := rtp.Header{ + Pad: false, + Mark: true, + PT: 42, + Seq: 1234, + TS: 567891234, + Ssrc: 6789, + } + + b := h.Write(nil) + var h2 rtp.Header + err := h2.Read(b) + if err != nil { + t.Fatalf("Read RTP: %v", err) + } + + if !reflect.DeepEqual(h, h2) { + t.Errorf("%#v != %#v", h2, h) + } +}