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

Function TestIPAddrToNetIP_Error_InvalidBytes

addr_test.go:94–101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestIPAddrToNetIP_Error_InvalidBytes(t *testing.T) {
95 bad := []byte{1} // invalid length -> AddrFromSlice returns ok=false
96 got, err := ipAddrToNetIP(bad, "")
97 require.Equal(t, netip.Addr{}, got, "should return zero addr on error")
98 require.Error(t, err)
99 require.IsType(t, ipConvertError{}, err)
100 require.Contains(t, err.Error(), "failed to convert IP")
101}
102
103func TestIPAddrToNetIP_OK_IPv4(t *testing.T) {
104 ipv4 := []byte{1, 2, 3, 4}

Callers

nothing calls this directly

Calls 3

ipAddrToNetIPFunction · 0.85
EqualMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…