usecandidate_test.go 538 B

123456789101112131415161718192021222324252627
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. package ice
  4. import (
  5. "testing"
  6. "github.com/pion/stun"
  7. )
  8. func TestUseCandidateAttr_AddTo(t *testing.T) {
  9. m := new(stun.Message)
  10. if UseCandidate().IsSet(m) {
  11. t.Error("should not be set")
  12. }
  13. if err := m.Build(stun.BindingRequest, UseCandidate()); err != nil {
  14. t.Error(err)
  15. }
  16. m1 := new(stun.Message)
  17. if _, err := m1.Write(m.Raw); err != nil {
  18. t.Error(err)
  19. }
  20. if !UseCandidate().IsSet(m1) {
  21. t.Error("should be set")
  22. }
  23. }