gpio: increase test coverage for relay driver

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-03-21 12:14:38 +01:00
parent 4ff1b0c83c
commit ccd03a1b19
1 changed files with 12 additions and 0 deletions

View File

@ -44,3 +44,15 @@ func TestRelayDriverToggle(t *testing.T) {
d.Toggle() d.Toggle()
gobottest.Assert(t, d.State(), false) gobottest.Assert(t, d.State(), false)
} }
func TestRelayDriverCommands(t *testing.T) {
d := initTestRelayDriver(newGpioTestAdaptor())
gobottest.Assert(t, d.Command("Off")(nil), nil)
gobottest.Assert(t, d.State(), false)
gobottest.Assert(t, d.Command("On")(nil), nil)
gobottest.Assert(t, d.State(), true)
gobottest.Assert(t, d.Command("Toggle")(nil), nil)
gobottest.Assert(t, d.State(), false)
}