Skip to content

Commit

Permalink
gpio: increase test coverage for motor 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 4c7c57c commit dae55b5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/gpio/motor_driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,16 @@ func TestMotorDriverDirection(t *testing.T) {
d.Direction("backward")
}

func TestMotorDriverDigitalForwardBackward(t *testing.T) {
func TestMotorDriverDigital(t *testing.T) {
d := initTestMotorDriver()
d.CurrentMode = "digital"
d.ForwardPin = "2"
d.BackwardPin = "3"

d.Forward(100)
gobottest.Assert(t, d.CurrentSpeed, uint8(100))
gobottest.Assert(t, d.CurrentDirection, "forward")

d.Backward(100)
gobottest.Assert(t, d.CurrentSpeed, uint8(100))
gobottest.Assert(t, d.CurrentDirection, "backward")
d.On()
gobottest.Assert(t, d.CurrentState, uint8(1))
d.Off()
gobottest.Assert(t, d.CurrentState, uint8(0))
}

func TestMotorDriverDefaultName(t *testing.T) {
Expand Down

0 comments on commit dae55b5

Please sign in to comment.