First cut
This commit is contained in:
24
usb/misc_test.go
Normal file
24
usb/misc_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package usb
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBCD(t *testing.T) {
|
||||
tests := []struct{
|
||||
BCD
|
||||
Int int
|
||||
Str string
|
||||
}{
|
||||
{0x1234, 1234, "12.34"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
if got, want := test.BCD.Int(), test.Int; got != want {
|
||||
t.Errorf("Int(%x) = %d, want %d", test.BCD, got, want)
|
||||
}
|
||||
if got, want := test.BCD.String(), test.Str; got != want {
|
||||
t.Errorf("String(%x) = %q, want %q", test.BCD, got, want)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user