diff options
Diffstat (limited to 'plugin/pkg/dnsutil/reverse_test.go')
-rw-r--r-- | plugin/pkg/dnsutil/reverse_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/plugin/pkg/dnsutil/reverse_test.go b/plugin/pkg/dnsutil/reverse_test.go index 25bd897ac..3cf2f0c51 100644 --- a/plugin/pkg/dnsutil/reverse_test.go +++ b/plugin/pkg/dnsutil/reverse_test.go @@ -49,3 +49,23 @@ func TestExtractAddressFromReverse(t *testing.T) { } } } + +func TestIsReverse(t *testing.T) { + tests := []struct { + name string + expected int + }{ + {"b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.", 2}, + {"d.0.1.0.0.2.in-addr.arpa.", 1}, + {"example.com.", 0}, + {"", 0}, + {"in-addr.arpa.example.com.", 0}, + } + for i, tc := range tests { + got := IsReverse(tc.name) + if got != tc.expected { + t.Errorf("Test %d, got %d, expected %d for %s", i, got, tc.expected, tc.name) + } + + } +} |