-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy pathcandidatetype_test.go
More file actions
39 lines (31 loc) · 1.06 KB
/
candidatetype_test.go
File metadata and controls
39 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package ice
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestCandidateType_String_KnownCases(t *testing.T) {
cases := map[CandidateType]string{
CandidateTypeHost: "host",
CandidateTypeServerReflexive: "srflx",
CandidateTypePeerReflexive: "prflx",
CandidateTypeRelay: "relay",
CandidateTypeUnspecified: "Unknown candidate type",
}
for ct, want := range cases {
require.Equal(t, want, ct.String(), "unexpected string for %v", ct)
}
}
func TestCandidateType_String_Default(t *testing.T) {
const outOfBounds CandidateType = 255
require.Equal(t, "Unknown candidate type", outOfBounds.String())
}
func TestCandidateType_Preference_DefaultCase(t *testing.T) {
const outOfBounds CandidateType = 255
require.Equal(t, uint16(0), outOfBounds.Preference())
}
func TestContainsCandidateType_NilSlice(t *testing.T) {
var list []CandidateType // nil slice
require.False(t, containsCandidateType(CandidateTypeHost, list))
}