mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00

Modify RTCSdpType to protect newRTCSdpType Modify RTCPriorityType to protect methods Modify RTCSctpTransportState to protect methods Modify RTCRtcpMuxPolicy to protect methods Modify RTCPeerConnectionState to protect methods Modify RTCIceTransportPolicy to protect methods Modify RTCIceGatheringState to protect methods Modify RTCIceCredentialType to protect methods Modify RTCIceConnectionState to protect methods Modify RTCDtlsTransportState to protect methods Modify RTCDataChannelState to protect methods Modify RTCBundlePolicy to protect methods Relates to #83
50 lines
1002 B
Go
50 lines
1002 B
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewRTCSdpType(t *testing.T) {
|
|
testCases := []struct {
|
|
sdpTypeString string
|
|
expectedSdpType RTCSdpType
|
|
}{
|
|
{"unknown", RTCSdpType(Unknown)},
|
|
{"offer", RTCSdpTypeOffer},
|
|
{"pranswer", RTCSdpTypePranswer},
|
|
{"answer", RTCSdpTypeAnswer},
|
|
{"rollback", RTCSdpTypeRollback},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedSdpType,
|
|
newRTCSdpType(testCase.sdpTypeString),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|
|
|
|
func TestRTCSdpType_String(t *testing.T) {
|
|
testCases := []struct {
|
|
sdpType RTCSdpType
|
|
expectedString string
|
|
}{
|
|
{RTCSdpType(Unknown), "unknown"},
|
|
{RTCSdpTypeOffer, "offer"},
|
|
{RTCSdpTypePranswer, "pranswer"},
|
|
{RTCSdpTypeAnswer, "answer"},
|
|
{RTCSdpTypeRollback, "rollback"},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedString,
|
|
testCase.sdpType.String(),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|