Skip to content

Commit

Permalink
gpio: increase test coverage for relay driver
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Mar 21, 2017
1 parent ccd03a1 commit 224f089
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/gpio/relay_driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ func initTestRelayDriver(conn DigitalWriter) *RelayDriver {
return NewRelayDriver(conn, "1")
}

func TestRelayDriverName(t *testing.T) {
func TestRelayDriverDefaultName(t *testing.T) {
g := initTestRelayDriver(newGpioTestAdaptor())
gobottest.Refute(t, g.Connection(), nil)
gobottest.Assert(t, strings.HasPrefix(g.Name(), "Relay"), true)
}

func TestRelayDriverSetName(t *testing.T) {
g := initTestRelayDriver(newGpioTestAdaptor())
g.SetName("mybot")
gobottest.Assert(t, g.Name(), "mybot")
}

func TestRelayDriverStart(t *testing.T) {
d := initTestRelayDriver(newGpioTestAdaptor())
gobottest.Assert(t, d.Start(), nil)
Expand Down

0 comments on commit 224f089

Please sign in to comment.