mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 07:06:51 +08:00

Add RTCIceRole structure with complete unittests Add RTCIceProtocol structure with unittests Add RTCIceComponent structure with unittests Add RTCIceCandidateType with complete unittests Relates to #83
46 lines
900 B
Go
46 lines
900 B
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRTCIceComponent(t *testing.T) {
|
|
testCases := []struct {
|
|
componentString string
|
|
expectedComponent RTCIceComponent
|
|
}{
|
|
{"unknown", RTCIceComponent(Unknown)},
|
|
{"rtp", RTCIceComponentRtp},
|
|
{"rtcp", RTCIceComponentRtcp},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
newRTCIceComponent(testCase.componentString),
|
|
testCase.expectedComponent,
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|
|
|
|
func TestRTCIceComponent_String(t *testing.T) {
|
|
testCases := []struct {
|
|
state RTCIceComponent
|
|
expectedString string
|
|
}{
|
|
{RTCIceComponent(Unknown), "unknown"},
|
|
{RTCIceComponentRtp, "rtp"},
|
|
{RTCIceComponentRtcp, "rtcp"},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.state.String(),
|
|
testCase.expectedString,
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|