From 15049727d82226a51a45abe5f4f67f714bdaca14 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 6 Apr 2017 11:05:23 +0200 Subject: [PATCH] ardrone: increase test coverage Signed-off-by: deadprogram --- platforms/parrot/ardrone/ardrone_adaptor_test.go | 8 ++++++++ platforms/parrot/ardrone/ardrone_driver_test.go | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/platforms/parrot/ardrone/ardrone_adaptor_test.go b/platforms/parrot/ardrone/ardrone_adaptor_test.go index b9d1159c..02790233 100644 --- a/platforms/parrot/ardrone/ardrone_adaptor_test.go +++ b/platforms/parrot/ardrone/ardrone_adaptor_test.go @@ -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) diff --git a/platforms/parrot/ardrone/ardrone_driver_test.go b/platforms/parrot/ardrone/ardrone_driver_test.go index b77c0863..99495565 100644 --- a/platforms/parrot/ardrone/ardrone_driver_test.go +++ b/platforms/parrot/ardrone/ardrone_driver_test.go @@ -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)