Add extra length test for issue #105

This commit is contained in:
Miek Gieben 2014-08-22 08:15:35 +01:00
parent f0bd4137e2
commit 9f5fcf8459
1 changed files with 16 additions and 0 deletions

View File

@ -316,6 +316,22 @@ func TestMsgLength2(t *testing.T) {
}
}
func testMsgLengthCompressionMalformed(t *testing.T) {
// SOA with empty hostmaster, which is illegal
soa := &SOA{Hdr: RR_Header{Name: ".", Rrtype: TypeSOA, Class: ClassINET, Ttl: 12345},
Ns: ".",
Mbox: "",
Serial: 0,
Refresh: 28800,
Retry: 7200,
Expire: 604800,
Minttl: 60}
m := new(Msg)
m.Compress = true
m.Ns = []RR{soa}
m.Len()
}
func BenchmarkMsgLength(b *testing.B) {
b.StopTimer()
makeMsg := func(question string, ans, ns, e []RR) *Msg {