rtcpmuxpolicy_test.go 1010 B

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