github.com/pion/webrtc/v4@v4.0.1/rtcpmuxpolicy_test.go (about) 1 // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> 2 // SPDX-License-Identifier: MIT 3 4 package webrtc 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestNewRTCPMuxPolicy(t *testing.T) { 13 testCases := []struct { 14 policyString string 15 expectedPolicy RTCPMuxPolicy 16 }{ 17 {ErrUnknownType.Error(), RTCPMuxPolicyUnknown}, 18 {"negotiate", RTCPMuxPolicyNegotiate}, 19 {"require", RTCPMuxPolicyRequire}, 20 } 21 22 for i, testCase := range testCases { 23 assert.Equal(t, 24 testCase.expectedPolicy, 25 newRTCPMuxPolicy(testCase.policyString), 26 "testCase: %d %v", i, testCase, 27 ) 28 } 29 } 30 31 func TestRTCPMuxPolicy_String(t *testing.T) { 32 testCases := []struct { 33 policy RTCPMuxPolicy 34 expectedString string 35 }{ 36 {RTCPMuxPolicyUnknown, ErrUnknownType.Error()}, 37 {RTCPMuxPolicyNegotiate, "negotiate"}, 38 {RTCPMuxPolicyRequire, "require"}, 39 } 40 41 for i, testCase := range testCases { 42 assert.Equal(t, 43 testCase.expectedString, 44 testCase.policy.String(), 45 "testCase: %d %v", i, testCase, 46 ) 47 } 48 }