1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00
hybridgroup.gobot/platforms/gpio/servo_driver_test.go
2014-05-22 21:29:37 -07:00

52 lines
962 B
Go

package gpio
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Servo", func() {
var (
t TestAdaptor
s *ServoDriver
)
BeforeEach(func() {
s = NewServoDriver(t, "bot", "1")
})
It("Should be able to Move", func() {
s.Move(100)
Expect(s.CurrentAngle).To(Equal(uint8(100)))
})
It("Should be able to move to Min", func() {
s.Min()
Expect(s.CurrentAngle).To(Equal(uint8(0)))
})
It("Should be able to move to Max", func() {
s.Max()
Expect(s.CurrentAngle).To(Equal(uint8(180)))
})
It("Should be able to move to Center", func() {
s.Center()
Expect(s.CurrentAngle).To(Equal(uint8(90)))
})
It("Should be able to move to init servo", func() {
s.InitServo()
})
It("Must be able to Start", func() {
Expect(s.Start()).To(Equal(true))
})
It("Must be able to Init", func() {
Expect(s.Init()).To(Equal(true))
})
It("Must be able to Halt", func() {
Expect(s.Halt()).To(Equal(true))
})
})