package devicepath_test import ( "testing" "git.faercol.me/faercol/devicepath" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestOK(t *testing.T) { input := "Sata(1,65535,0)" res, err := devicepath.Parsenode(input) require.NoError(t, err) assert.Equal(t, devicepath.MessagingDevicePath, res.Type()) assert.Equal(t, devicepath.SATAMessaging, res.SubType()) assert.Equal(t, "Sata(1,65535,0)", res.String()) } func TestParseDevicePathOK(t *testing.T) { input := "PciRoot(0x0)/Pci(0x1,0x2)/Pci(0x0,0x1)/Sata(0,65535,0)/HD(1,GPT,16f06d01-50da-6544-86bd-f3457f980086,0x1000,0x96000)/File(\\EFI\\HTTPBOOT\\HTTP_BOOT_CLIENT.EFI)" res, err := devicepath.ParseDevicePath(input) require.NoError(t, err) assert.Equal(t, "PciRoot(0x0)/Pci(0x1,0x2)/Pci(0x0,0x1)/Sata(0,65535,0)/HD(1,GPT,16f06d01-50da-6544-86bd-f3457f980086,0x1000,0x96000)/File(\\EFI\\HTTPBOOT\\HTTP_BOOT_CLIENT.EFI)", res.String()) }