| 1 |
package dnsutil |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
) |
| 6 |
|
| 7 |
func TestNSEC3Name(t *testing.T) { |
| 8 |
// cases from RFC 5155, Appendix A. |
| 9 |
testcases := []struct { |
| 10 |
in, exp string |
| 11 |
}{ |
| 12 |
{"example.", "0P9MHAVEQVM6T7VBL5LOP2U3T2RP3TOM"}, |
| 13 |
{"ns2.example.", "Q04JKCEVQVMU85R014C7DKBA38O0JI5R"}, |
| 14 |
{"*.w.example.", "R53BQ7CC2UVMUBFU5OCMM6PERS9TK9EN"}, |
| 15 |
} |
| 16 |
|
| 17 |
for i, tc := range testcases { |
| 18 |
got := NSEC3Name(tc.in, "aabbccdd", 12) |
| 19 |
if got != tc.exp { |
| 20 |
t.Errorf("test %d, expected %s, got %s", i, tc.exp, got) |
| 21 |
} |
| 22 |
} |
| 23 |
} |