ardrone: increase test coverage

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-04-06 11:05:23 +02:00
parent 7f61b2d7dd
commit 15049727d8
2 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package ardrone
import (
"errors"
"strings"
"testing"
"gobot.io/x/gobot"
@ -36,6 +37,13 @@ func TestArdroneAdaptorConnect(t *testing.T) {
gobottest.Assert(t, a.Connect(), errors.New("connection error"))
}
func TestArdroneAdaptorName(t *testing.T) {
a := initTestArdroneAdaptor()
gobottest.Assert(t, strings.HasPrefix(a.Name(), "ARDrone"), true)
a.SetName("NewName")
gobottest.Assert(t, a.Name(), "NewName")
}
func TestArdroneAdaptorFinalize(t *testing.T) {
a := initTestArdroneAdaptor()
gobottest.Assert(t, a.Finalize(), nil)

View File

@ -25,6 +25,13 @@ func TestArdroneDriver(t *testing.T) {
gobottest.Assert(t, d.Name(), "mydrone")
}
func TestArdroneDriverName(t *testing.T) {
d := initTestArdroneDriver()
gobottest.Assert(t, d.Name(), "mydrone")
d.SetName("NewName")
gobottest.Assert(t, d.Name(), "NewName")
}
func TestArdroneDriverStart(t *testing.T) {
d := initTestArdroneDriver()
gobottest.Assert(t, d.Start(), nil)