1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-29 13:49:14 +08:00
hybridgroup.gobot/platforms/gpio/led_driver_test.go
2014-06-13 12:39:02 -07:00

47 lines
757 B
Go

package gpio
import (
"github.com/hybridgroup/gobot"
"testing"
)
var l *LedDriver
func init() {
l = NewLedDriver(TestAdaptor{}, "myLed", "1")
}
func TestLedStart(t *testing.T) {
gobot.Expect(t, l.Start(), true)
}
func TestLedHalt(t *testing.T) {
gobot.Expect(t, l.Halt(), true)
}
func TestLedInit(t *testing.T) {
gobot.Expect(t, l.Init(), true)
}
func TestLedOn(t *testing.T) {
gobot.Expect(t, l.On(), true)
gobot.Expect(t, l.IsOn(), true)
}
func TestLedOff(t *testing.T) {
gobot.Expect(t, l.Off(), true)
gobot.Expect(t, l.IsOff(), true)
}
func TestLedToggle(t *testing.T) {
l.Off()
l.Toggle()
gobot.Expect(t, l.IsOn(), true)
l.Toggle()
gobot.Expect(t, l.IsOff(), true)
}
func TestLedBrightness(t *testing.T) {
l.Brightness(150)
}