Files
gousb/usb/misc_test.go
2012-03-26 00:06:53 -07:00

25 lines
431 B
Go

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)
}
}
}