package dhcp import ( "bytes" "net/netip" "testing" ) func Test_parameterSubnetMask(t *testing.T) { expected := []byte{ byte(OptionTagSubnetMask), 4, 255, 255, 255, 0, } prefix := netip.MustParseAddr("255.255.255.0") param := ParameterSubnetMask(prefix) out := param.Bytes() if !bytes.Equal(expected, out) { t.Fatalf("invalid parameter subnet mask: have %x, want %x", out, expected) } } func Test_parameterRouter(t *testing.T) { expected := []byte{ byte(OptionTagRouter), 4, 192, 168, 1, 1, } router := netip.MustParseAddr("192.168.1.1") param := ParameterRouter(router) out := param.Bytes() if !bytes.Equal(expected, out) { t.Fatalf("invalid parameter router: have %x, want %x", out, expected) } }