Files
gousb/usb/config_test.go
Sebastian Zagrodzki e0f30623b3 Modify EndpointInfo to provide meaningful data rather than raw USB
descriptor values. E.g. for the user, the distinction between
MaxIsoPkt and MaxPktSize is irrelevant, only the calculated max packet
size matters.
2017-04-08 23:49:10 +02:00

36 lines
809 B
Go

package usb
import "testing"
func TestEndpointInfo(t *testing.T) {
for _, tc := range []struct {
ep EndpointInfo
want string
}{
{
ep: EndpointInfo{
Number: 6,
Direction: EndpointDirectionIn,
TransferType: TransferTypeBulk,
MaxPacketSize: 512,
},
want: "Endpoint #6 IN (address 0x86) bulk [512 bytes]",
},
{
ep: EndpointInfo{
Number: 2,
Direction: EndpointDirectionOut,
TransferType: TransferTypeIsochronous,
MaxPacketSize: 512,
IsoSyncType: IsoSyncTypeAsync,
UsageType: IsoUsageTypeData,
},
want: "Endpoint #2 OUT (address 0x02) isochronous - asynchronous data [512 bytes]",
},
} {
if got := tc.ep.String(); got != tc.want {
t.Errorf("%#v.String(): got %q, want %q", tc.ep, got, tc.want)
}
}
}