Files
webrtc/rtcicecomponent_test.go
Konstantin Itskov 5be692f2ec Add Spec compliant enum structures
Add RTCIceRole structure with complete unittests
Add RTCIceProtocol structure with unittests
Add RTCIceComponent structure with unittests
Add RTCIceCandidateType with complete unittests

Relates to #83
2018-09-14 13:42:41 -04:00

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,
)
}
}