mirror of
https://github.com/pion/webrtc.git
synced 2025-10-28 01:31:33 +08:00
Add a bunch of default basic unittests to boost coverage
This commit is contained in:
committed by
Sean DuBois
parent
cbea80026d
commit
a08b5d51cf
48
rtcsdptype_test.go
Normal file
48
rtcsdptype_test.go
Normal file
@@ -0,0 +1,48 @@
|
||||
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,
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user