File: option_relayport_test.go

package info (click to toggle)
golang-github-insomniacslk-dhcp 0.0~git20250417.5f8cf70-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 1,096 kB
  • sloc: makefile: 3
file content (19 lines) | stat: -rw-r--r-- 402 bytes parent folder | download
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())
}