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
872 B
Go
46 lines
872 B
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewRTCIceProtocol(t *testing.T) {
|
|
testCases := []struct {
|
|
protoString string
|
|
expectedProto RTCIceProtocol
|
|
}{
|
|
{"unknown", RTCIceProtocol(Unknown)},
|
|
{"udp", RTCIceProtocolUDP},
|
|
{"tcp", RTCIceProtocolTCP},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedProto,
|
|
newRTCIceProtocol(testCase.protoString),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|
|
|
|
func TestRTCIceProtocol_String(t *testing.T) {
|
|
testCases := []struct {
|
|
proto RTCIceProtocol
|
|
expectedString string
|
|
}{
|
|
{RTCIceProtocol(Unknown), "unknown"},
|
|
{RTCIceProtocolUDP, "udp"},
|
|
{RTCIceProtocolTCP, "tcp"},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedString,
|
|
testCase.proto.String(),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|