github.com/cnotch/ipchub@v1.1.0/media/cid_test.go (about)

     1  // Copyright (c) 2019,CAOHONGJU All rights reserved.
     2  // Use of this source code is governed by a MIT-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package media
     6  
     7  import (
     8  	"testing"
     9  )
    10  
    11  func TestCID(t *testing.T) {
    12  	var consumerSequenceSeed uint32
    13  
    14  	tests := []struct {
    15  		name string
    16  		typ  PacketType
    17  	}{
    18  		{
    19  			"NewRTPConsumer",
    20  			RTPPacket,
    21  		},
    22  		{
    23  			"NewFLVConsumer",
    24  			FLVPacket,
    25  		},
    26  	}
    27  	for _, tt := range tests {
    28  		t.Run(tt.name, func(t *testing.T) {
    29  			cid := NewCID(tt.typ, &consumerSequenceSeed)
    30  			if cid.Type() != tt.typ {
    31  				t.Errorf("cid.Type() = %v, want %v", cid.Type(), tt.typ)
    32  			}
    33  			if cid.Sequence() != consumerSequenceSeed {
    34  				t.Errorf("cid.Sequence() = %v, want %v", cid.Sequence(), consumerSequenceSeed)
    35  			}
    36  		})
    37  	}
    38  }