mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewRTCRtpTransceiverDirection(t *testing.T) {
|
|
testCases := []struct {
|
|
priorityString string
|
|
expectedPriority RTCRtpTransceiverDirection
|
|
}{
|
|
{"unknown", RTCRtpTransceiverDirection(Unknown)},
|
|
{"sendrecv", RTCRtpTransceiverDirectionSendrecv},
|
|
{"sendonly", RTCRtpTransceiverDirectionSendonly},
|
|
{"recvonly", RTCRtpTransceiverDirectionRecvonly},
|
|
{"inactive", RTCRtpTransceiverDirectionInactive},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
NewRTCRtpTransceiverDirection(testCase.priorityString),
|
|
testCase.expectedPriority,
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|
|
|
|
func TestRTCRtpTransceiverDirection_String(t *testing.T) {
|
|
testCases := []struct {
|
|
priority RTCRtpTransceiverDirection
|
|
expectedString string
|
|
}{
|
|
{RTCRtpTransceiverDirection(Unknown), "unknown"},
|
|
{RTCRtpTransceiverDirectionSendrecv, "sendrecv"},
|
|
{RTCRtpTransceiverDirectionSendonly, "sendonly"},
|
|
{RTCRtpTransceiverDirectionRecvonly, "recvonly"},
|
|
{RTCRtpTransceiverDirectionInactive, "inactive"},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.priority.String(),
|
|
testCase.expectedString,
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|