mirror of
https://github.com/pion/webrtc.git
synced 2025-10-26 16:50:34 +08:00
50 lines
1004 B
Go
50 lines
1004 B
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewRTCSdpType(t *testing.T) {
|
|
testCases := []struct {
|
|
sdpTypeString string
|
|
expectedSdpType RTCSdpType
|
|
}{
|
|
{unknownStr, 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), unknownStr},
|
|
{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,
|
|
)
|
|
}
|
|
}
|