blob: 2da2a5d28beb2b467f0c5af31c100c99f9006149 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package dhcpv4
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestOptionGenericCode(t *testing.T) {
o := OptGeneric(OptionDHCPMessageType, []byte{byte(MessageTypeDiscover)})
require.Equal(t, OptionDHCPMessageType, o.Code)
require.Equal(t, []byte{1}, o.Value.ToBytes())
require.Equal(t, "DHCP Message Type: \x01 ([1])", o.String())
}
func TestOptionGenericStringUnknown(t *testing.T) {
o := OptGeneric(optionCode(102), []byte{byte(MessageTypeDiscover)})
require.Equal(t, "unknown (102): \x01 ([1])", o.String())
}
|