1
0
mirror of https://github.com/kidoman/embd synced 2024-11-13 04:58:55 +01:00
embd/gpiodriver_test.go

27 lines
564 B
Go
Raw Normal View History

2014-03-22 22:02:26 +01:00
package embd
import "testing"
func TestGpioDriverDigitalPin(t *testing.T) {
var tests = []struct {
key interface{}
n int
}{
{1, 1},
}
var pinMap = PinMap{
&PinDesc{ID: "P1_1", Aliases: []string{"1"}, Caps: CapNormal, DigitalLogical: 1},
}
driver := newGPIODriver(pinMap)
for _, test := range tests {
pin, err := driver.digitalPin(test.key)
if err != nil {
t.Errorf("Looking up %v: unexpected error: %v", test.key, err)
continue
}
if pin.n != test.n {
t.Errorf("Looking up %v: got %v, want %v", test.key, pin.n, test.n)
}
}
}