MCPcopy Index your code
hub / github.com/foxcpp/maddy / TestQueryString

Function TestQueryString

internal/check/dnsbl/common_test.go:30–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestQueryString(t *testing.T) {
31 test := func(ip, queryStr string) {
32 t.Helper()
33
34 parsed := net.ParseIP(ip)
35 if parsed == nil {
36 panic("Malformed IP in test")
37 }
38
39 actual := queryString(parsed)
40 if actual != queryStr {
41 t.Errorf("want queryString(%s) to be %s, got %s", ip, queryStr, actual)
42 }
43 }
44
45 test("2001:db8:1:2:3:4:567:89ab", "b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2")
46 test("2001::1:2:3:4:567:89ab", "b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.0.0.0.0.1.0.0.2")
47 test("192.0.2.99", "99.2.0.192")
48}
49
50func TestCheckDomain(t *testing.T) {
51 test := func(zones map[string]mockdns.Zone, cfg List, domain string, expectedErr error) {

Callers

nothing calls this directly

Calls 2

queryStringFunction · 0.85
testStruct · 0.85

Tested by

no test coverage detected