1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package dhcpv4
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestOptDomainNameInterfaceMethods(t *testing.T) {
o := OptDomainName{DomainName: "foo"}
require.Equal(t, OptionDomainName, o.Code(), "Code")
require.Equal(t, []byte{'f', 'o', 'o'}, o.ToBytes(), "ToBytes")
}
func TestParseOptDomainName(t *testing.T) {
data := []byte{'t', 'e', 's', 't'}
o, err := ParseOptDomainName(data)
require.NoError(t, err)
require.Equal(t, &OptDomainName{DomainName: "test"}, o)
}
func TestOptDomainNameString(t *testing.T) {
o := OptDomainName{DomainName: "testy test"}
require.Equal(t, "Domain Name -> testy test", o.String())
}
|