1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-29 13:49:14 +08:00
hybridgroup.gobot/platforms/gpio/direct_pin_driver_test.go

56 lines
1.2 KiB
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-13 16:01:39 -07:00
func initTestDirectPinDriver() *DirectPinDriver {
return NewDirectPinDriver(TestAdaptor{}, "bot", "1")
2014-06-12 20:08:06 -07:00
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverStart(t *testing.T) {
d := initTestDirectPinDriver()
gobot.Expect(t, d.Start(), true)
2014-06-12 20:08:06 -07:00
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverHalt(t *testing.T) {
d := initTestDirectPinDriver()
gobot.Expect(t, d.Halt(), true)
2014-06-12 20:08:06 -07:00
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverInit(t *testing.T) {
d := initTestDirectPinDriver()
gobot.Expect(t, d.Init(), true)
2014-06-12 20:08:06 -07:00
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverDigitalRead(t *testing.T) {
d := initTestDirectPinDriver()
2014-06-12 20:08:06 -07:00
gobot.Expect(t, d.DigitalRead(), 1)
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverDigitalWrite(t *testing.T) {
d := initTestDirectPinDriver()
2014-06-12 20:08:06 -07:00
d.DigitalWrite(1)
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverAnalogRead(t *testing.T) {
d := initTestDirectPinDriver()
2014-06-12 20:08:06 -07:00
gobot.Expect(t, d.AnalogRead(), 99)
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverAnalogWrite(t *testing.T) {
d := initTestDirectPinDriver()
2014-06-12 20:08:06 -07:00
d.AnalogWrite(100)
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverPwmWrite(t *testing.T) {
d := initTestDirectPinDriver()
2014-06-12 20:08:06 -07:00
d.PwmWrite(100)
}
2014-06-13 16:01:39 -07:00
func TestDirectPinDriverServoWrite(t *testing.T) {
d := initTestDirectPinDriver()
2014-06-12 20:08:06 -07:00
d.ServoWrite(100)
}