diff options
author | Chris Koch <chrisko@google.com> | 2023-02-18 20:31:32 -0800 |
---|---|---|
committer | Chris K <c@chrisko.ch> | 2023-02-19 22:39:16 -0800 |
commit | 336d4b9bd652b2bf0bc1bd0feae3f2f51009c13f (patch) | |
tree | 9c99ebb8f3067a39981d8bea07109fd7e7ba0d17 /dhcpv6/option_remoteid_test.go | |
parent | 1e0fe5ce427973ca92a0dfb1a06a252ddb0dd4be (diff) |
dhcpv6: convert every Parse function to FromBytes
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/option_remoteid_test.go')
-rw-r--r-- | dhcpv6/option_remoteid_test.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dhcpv6/option_remoteid_test.go b/dhcpv6/option_remoteid_test.go index 77835de..d8f848b 100644 --- a/dhcpv6/option_remoteid_test.go +++ b/dhcpv6/option_remoteid_test.go @@ -11,8 +11,8 @@ func TestOptRemoteID(t *testing.T) { expected := []byte{0xaa, 0xbb, 0xcc, 0xdd} remoteId := []byte("DSLAM01 eth2/1/01/21") expected = append(expected, remoteId...) - opt, err := ParseOptRemoteID(expected) - if err != nil { + var opt OptRemoteID + if err := opt.FromBytes(expected); err != nil { t.Fatal(err) } if en := opt.EnterpriseNumber; en != 0xaabbccdd { @@ -37,7 +37,8 @@ func TestOptRemoteIDToBytes(t *testing.T) { func TestOptRemoteIDParseOptRemoteIDTooShort(t *testing.T) { buf := []byte{0xaa, 0xbb, 0xcc} - _, err := ParseOptRemoteID(buf) + var opt OptRemoteID + err := opt.FromBytes(buf) require.Error(t, err, "A short option should return an error") } @@ -46,7 +47,8 @@ func TestOptRemoteIDString(t *testing.T) { remoteId := []byte("Test1234") buf = append(buf, remoteId...) - opt, err := ParseOptRemoteID(buf) + var opt OptRemoteID + err := opt.FromBytes(buf) require.NoError(t, err) str := opt.String() require.Contains( |