summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/bsdp/bsdp_option_selected_boot_image_id_test.go
diff options
context:
space:
mode:
authorChristopher Koch <chrisko@google.com>2018-12-29 14:48:10 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2019-01-24 08:05:49 +0000
commitc90ab10024ada840e24bb028a3405961e8e4c26a (patch)
tree9b8af0c1b80ee6efc112921f9a14b92d6c73f8eb /dhcpv4/bsdp/bsdp_option_selected_boot_image_id_test.go
parent2be5cae32d33f01ddecf6f167a9c0e5290e6d58f (diff)
dhcpv4: nicer API for option parsing.
From: r := d.GetOneOption(OptionRouter).(*OptRouter).Routers d.UpdateOption(&OptRouter{Routers: []net.IP{net.IP{192, 168, 0, 1}}}) To: r := GetRouter(d.Options) d.UpdateOption(OptRouter(net.IP{192, 168, 0, 1}, ...))
Diffstat (limited to 'dhcpv4/bsdp/bsdp_option_selected_boot_image_id_test.go')
-rw-r--r--dhcpv4/bsdp/bsdp_option_selected_boot_image_id_test.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/dhcpv4/bsdp/bsdp_option_selected_boot_image_id_test.go b/dhcpv4/bsdp/bsdp_option_selected_boot_image_id_test.go
deleted file mode 100644
index e187fc7..0000000
--- a/dhcpv4/bsdp/bsdp_option_selected_boot_image_id_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package bsdp
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
- "github.com/u-root/u-root/pkg/uio"
-)
-
-func TestOptSelectedBootImageIDInterfaceMethods(t *testing.T) {
- b := BootImageID{IsInstall: true, ImageType: BootImageTypeMacOSX, Index: 1001}
- o := OptSelectedBootImageID{b}
- require.Equal(t, OptionSelectedBootImageID, o.Code(), "Code")
- require.Equal(t, uio.ToBigEndian(b), o.ToBytes(), "ToBytes")
-}
-
-func TestParseOptSelectedBootImageID(t *testing.T) {
- b := BootImageID{IsInstall: true, ImageType: BootImageTypeMacOSX, Index: 1001}
- o, err := ParseOptSelectedBootImageID(uio.ToBigEndian(b))
- require.NoError(t, err)
- require.Equal(t, &OptSelectedBootImageID{b}, o)
-
- // Short byte stream
- data := []byte{}
- _, err = ParseOptSelectedBootImageID(data)
- require.Error(t, err, "should get error from short byte stream")
-
- // Bad length
- data = []byte{1, 0, 0, 0, 0}
- _, err = ParseOptSelectedBootImageID(data)
- require.Error(t, err, "should get error from bad length")
-}
-
-func TestOptSelectedBootImageIDString(t *testing.T) {
- b := BootImageID{IsInstall: true, ImageType: BootImageTypeMacOSX, Index: 1001}
- o := OptSelectedBootImageID{b}
- require.Equal(t, "BSDP Selected Boot Image ID -> [1001] installable macOS image", o.String())
-
- b = BootImageID{IsInstall: false, ImageType: BootImageTypeMacOS9, Index: 1001}
- o = OptSelectedBootImageID{b}
- require.Equal(t, "BSDP Selected Boot Image ID -> [1001] uninstallable macOS 9 image", o.String())
-
- b = BootImageID{IsInstall: false, ImageType: BootImageType(99), Index: 1001}
- o = OptSelectedBootImageID{b}
- require.Equal(t, "BSDP Selected Boot Image ID -> [1001] uninstallable unknown image", o.String())
-}