diff options
Diffstat (limited to 'dhcpv4/option_bootfile_name_test.go')
-rw-r--r-- | dhcpv4/option_bootfile_name_test.go | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/dhcpv4/option_bootfile_name_test.go b/dhcpv4/option_bootfile_name_test.go index 0c7c200..2671ac5 100644 --- a/dhcpv4/option_bootfile_name_test.go +++ b/dhcpv4/option_bootfile_name_test.go @@ -13,7 +13,7 @@ func TestOptBootfileNameCode(t *testing.T) { func TestOptBootfileNameToBytes(t *testing.T) { opt := OptBootfileName{ - BootfileName: []byte("linuxboot"), + BootfileName: "linuxboot", } data := opt.ToBytes() expected := []byte{ @@ -26,40 +26,15 @@ func TestOptBootfileNameToBytes(t *testing.T) { func TestParseOptBootfileName(t *testing.T) { expected := []byte{ - 67, 9, 'l', 'i', 'n', 'u', 'x', 'b', 'o', 'o', 't', + 'l', 'i', 'n', 'u', 'x', 'b', 'o', 'o', 't', } opt, err := ParseOptBootfileName(expected) require.NoError(t, err) require.Equal(t, 9, opt.Length()) - require.Equal(t, "linuxboot", string(opt.BootfileName)) -} - -func TestParseOptBootfileNameZeroLength(t *testing.T) { - expected := []byte{ - 67, 0, - } - _, err := ParseOptBootfileName(expected) - require.Error(t, err) -} - -func TestParseOptBootfileNameInvalidLength(t *testing.T) { - expected := []byte{ - 67, 9, 'l', 'i', 'n', 'u', 'x', 'b', - } - _, err := ParseOptBootfileName(expected) - require.Error(t, err) -} - -func TestParseOptBootfileNameShortLength(t *testing.T) { - expected := []byte{ - 67, 4, 'l', 'i', 'n', 'u', 'x', - } - opt, err := ParseOptBootfileName(expected) - require.NoError(t, err) - require.Equal(t, []byte("linu"), opt.BootfileName) + require.Equal(t, "linuxboot", opt.BootfileName) } func TestOptBootfileNameString(t *testing.T) { - o := OptBootfileName{BootfileName: []byte("testy test")} + o := OptBootfileName{BootfileName: "testy test"} require.Equal(t, "Bootfile Name -> testy test", o.String()) } |