summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_relayport_test.go
blob: 124af62a19f03cf653c9cf61a74df19a8e45fde5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package dhcpv6

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestParseRelayPort(t *testing.T) {
	opt, err := parseOptRelayPort([]byte{0x12, 0x32})
	require.NoError(t, err)
	require.Equal(t, &optRelayPort{DownstreamSourcePort: 0x1232}, opt)
}

func TestRelayPortToBytes(t *testing.T) {
	op := OptRelayPort(0x3845)
	require.Equal(t, []byte{0x38, 0x45}, op.ToBytes())
}