devicepath/parser_test.go
2023-09-16 16:20:09 +02:00

25 lines
730 B
Go

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)"
res, err := devicepath.ParseDevicePath(input)
require.NoError(t, err)
assert.Equal(t, "PciRoot(0x0)/Pci(0x1,0x2)/Pci(0x0,0x1)/Sata(0,65535,0)", res.String())
}