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

52 lines
924 B
Go

package gpio
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DirectPin", func() {
var (
t TestAdaptor
d *DirectPinDriver
)
BeforeEach(func() {
d = NewDirectPinDriver(t, "bot", "1")
})
It("Should be able to DigitalRead", func() {
Expect(d.DigitalRead()).To(Equal(1))
})
It("Should be able to DigitalWrite", func() {
d.DigitalWrite(1)
})
It("Should be able to AnalogRead", func() {
Expect(d.AnalogRead()).To(Equal(99))
})
It("Should be able to AnalogWrite", func() {
d.AnalogWrite(100)
})
It("Should be able to PwmWrite", func() {
d.PwmWrite(100)
})
It("Should be able to ServoWrite", func() {
d.ServoWrite(100)
})
It("Should be able to Start", func() {
Expect(d.Start()).To(BeTrue())
})
It("Should be able to Halt", func() {
Expect(d.Halt()).To(BeTrue())
})
It("Should be able to Init", func() {
Expect(d.Init()).To(BeTrue())
})
})