1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-02 22:17:12 +08:00
hybridgroup.gobot/platforms/gpio/servo_driver_test.go
2014-06-13 12:39:02 -07:00

49 lines
797 B
Go

package gpio
import (
"github.com/hybridgroup/gobot"
"testing"
)
var s *ServoDriver
func init() {
s = NewServoDriver(TestAdaptor{}, "bot", "1")
}
func TestServoStart(t *testing.T) {
gobot.Expect(t, l.Start(), true)
}
func TestServoHalt(t *testing.T) {
gobot.Expect(t, l.Halt(), true)
}
func TestServoInit(t *testing.T) {
gobot.Expect(t, l.Init(), true)
}
func TestServoMove(t *testing.T) {
s.Move(100)
gobot.Expect(t, s.CurrentAngle, uint8(100))
}
func TestServoMin(t *testing.T) {
s.Min()
gobot.Expect(t, s.CurrentAngle, uint8(0))
}
func TestServoMax(t *testing.T) {
s.Max()
gobot.Expect(t, s.CurrentAngle, uint8(180))
}
func TestServoCenter(t *testing.T) {
s.Center()
gobot.Expect(t, s.CurrentAngle, uint8(90))
}
func TestServoInitServo(t *testing.T) {
s.InitServo()
}