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

import (
	"testing"

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

func TestParseRelayPort(t *testing.T) {
	var opt optRelayPort
	err := opt.FromBytes([]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())
}