(t *testing.T)
| 1144 | } |
| 1145 | |
| 1146 | func 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 | |
| 1199 | func TestBaseCandidateExtensionsEqual(t *testing.T) { |
| 1200 | testCases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…