MCPcopy Create free account
hub / github.com/pion/ice / TestBaseCandidateMarshalExtensions

Function TestBaseCandidateMarshalExtensions

candidate_test.go:1146–1197  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1144}
1145
1146func TestBaseCandidateMarshalExtensions(t *testing.T) {
1147 t.Run("Marshal extension", func(t *testing.T) {
1148 extensions := []CandidateExtension{
1149 {"generation", "0"},
1150 {"ValuE", "KeE"},
1151 {"empty", ""},
1152 {"another", "value"},
1153 }
1154 candidate, err := NewCandidateHost(&CandidateHostConfig{
1155 Network: NetworkTypeUDP4.String(),
1156 Address: "fcd9:e3b8:12ce:9fc5:74a5:c6bb:d8b:e08a",
1157 Port: 53987,
1158 Priority: 500,
1159 Foundation: "750",
1160 })
1161 require.NoError(t, err)
1162
1163 candidate.setExtensions(extensions)
1164
1165 value := candidate.marshalExtensions()
1166 require.Equal(t, "generation 0 ValuE KeE empty another value", value)
1167 })
1168
1169 t.Run("Marshal Empty", func(t *testing.T) {
1170 candidate, err := NewCandidateHost(&CandidateHostConfig{
1171 Network: NetworkTypeUDP4.String(),
1172 Address: "fcd9:e3b8:12ce:9fc5:74a5:c6bb:d8b:e08a",
1173 Port: 53987,
1174 Priority: 500,
1175 Foundation: "750",
1176 })
1177 require.NoError(t, err)
1178
1179 value := candidate.marshalExtensions()
1180 require.Equal(t, "", value)
1181 })
1182
1183 t.Run("Marshal TCPType no extension", func(t *testing.T) {
1184 candidate, err := NewCandidateHost(&CandidateHostConfig{
1185 Network: NetworkTypeUDP4.String(),
1186 Address: "fcd9:e3b8:12ce:9fc5:74a5:c6bb:d8b:e08a",
1187 Port: 53987,
1188 Priority: 500,
1189 Foundation: "750",
1190 TCPType: TCPTypeActive,
1191 })
1192 require.NoError(t, err)
1193
1194 value := candidate.marshalExtensions()
1195 require.Equal(t, "tcptype active", value)
1196 })
1197}
1198
1199func TestBaseCandidateExtensionsEqual(t *testing.T) {
1200 testCases := []struct {

Callers

nothing calls this directly

Calls 6

NewCandidateHostFunction · 0.85
RunMethod · 0.80
setExtensionsMethod · 0.80
marshalExtensionsMethod · 0.80
StringMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…