mirror of
https://github.com/pion/webrtc.git
synced 2025-10-27 17:21:27 +08:00
49 lines
1001 B
Go
49 lines
1001 B
Go
package webrtc
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
)
|
|
|
|
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,
|
|
NewRTCSdpType(testCase.sdpTypeString),
|
|
testCase.expectedSdpType,
|
|
"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.sdpType.String(),
|
|
testCase.expectedString,
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|