You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
540 B
49 lines
540 B
9 years ago
|
package dns
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestOPTTtl(t *testing.T) {
|
||
|
e := &OPT{}
|
||
|
e.Hdr.Name = "."
|
||
|
e.Hdr.Rrtype = TypeOPT
|
||
|
|
||
|
if e.Do() {
|
||
|
t.Fail()
|
||
|
}
|
||
|
|
||
|
e.SetDo()
|
||
|
if !e.Do() {
|
||
|
t.Fail()
|
||
|
}
|
||
|
|
||
|
oldTtl := e.Hdr.Ttl
|
||
|
|
||
|
if e.Version() != 0 {
|
||
|
t.Fail()
|
||
|
}
|
||
|
|
||
|
e.SetVersion(42)
|
||
|
if e.Version() != 42 {
|
||
|
t.Fail()
|
||
|
}
|
||
|
|
||
|
e.SetVersion(0)
|
||
|
if e.Hdr.Ttl != oldTtl {
|
||
|
t.Fail()
|
||
|
}
|
||
|
|
||
|
if e.ExtendedRcode() != 0 {
|
||
|
t.Fail()
|
||
|
}
|
||
|
|
||
|
e.SetExtendedRcode(42)
|
||
|
if e.ExtendedRcode() != 42 {
|
||
|
t.Fail()
|
||
|
}
|
||
|
|
||
|
e.SetExtendedRcode(0)
|
||
|
if e.Hdr.Ttl != oldTtl {
|
||
|
t.Fail()
|
||
|
}
|
||
|
}
|