1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-01 13:48:57 +08:00
hybridgroup.gobot/platforms/gpio/direct_pin_driver_test.go

49 lines
745 B
Go
Raw Normal View History

2014-04-27 19:34:16 -07:00
package gpio
import (
2014-06-12 20:08:06 -07:00
"github.com/hybridgroup/gobot"
"testing"
)
2014-06-12 20:08:06 -07:00
var d *DirectPinDriver
func init() {
d = NewDirectPinDriver(TestAdaptor{}, "bot", "1")
}
func TestStart(t *testing.T) {
gobot.Expect(t, a.Start(), true)
}
func TestHalt(t *testing.T) {
gobot.Expect(t, a.Halt(), true)
}
func TestInit(t *testing.T) {
gobot.Expect(t, a.Init(), true)
}
func TestDigitalRead(t *testing.T) {
gobot.Expect(t, d.DigitalRead(), 1)
}
func TestDigitalWrite(t *testing.T) {
d.DigitalWrite(1)
}
func TestAnalogRead(t *testing.T) {
gobot.Expect(t, d.AnalogRead(), 99)
}
func TestAnalogWrite(t *testing.T) {
d.AnalogWrite(100)
}
func TestPwmWrite(t *testing.T) {
d.PwmWrite(100)
}
func TestServoWrite(t *testing.T) {
d.ServoWrite(100)
}