From 7f61b2d7dddc3c7b0f35dda7fa0f5b3e9bd55f1c Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 6 Apr 2017 11:01:57 +0200 Subject: [PATCH] opencv: increase test coverage Signed-off-by: deadprogram --- platforms/opencv/camera_driver_test.go | 8 ++++++++ platforms/opencv/window_driver_test.go | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/platforms/opencv/camera_driver_test.go b/platforms/opencv/camera_driver_test.go index 6794f9de..5eeed794 100644 --- a/platforms/opencv/camera_driver_test.go +++ b/platforms/opencv/camera_driver_test.go @@ -1,6 +1,7 @@ package opencv import ( + "strings" "testing" "time" @@ -25,6 +26,13 @@ func TestCameraDriver(t *testing.T) { gobottest.Assert(t, d.Connection(), (gobot.Connection)(nil)) } +func TestCameraDriverName(t *testing.T) { + d := initTestCameraDriver() + gobottest.Assert(t, strings.HasPrefix(d.Name(), "Camera"), true) + d.SetName("NewName") + gobottest.Assert(t, d.Name(), "NewName") +} + func TestCameraDriverStart(t *testing.T) { sem := make(chan bool) d := initTestCameraDriver() diff --git a/platforms/opencv/window_driver_test.go b/platforms/opencv/window_driver_test.go index 94a87f3c..6dfd82fe 100644 --- a/platforms/opencv/window_driver_test.go +++ b/platforms/opencv/window_driver_test.go @@ -3,6 +3,7 @@ package opencv import ( "path" "runtime" + "strings" "testing" cv "github.com/lazywei/go-opencv/opencv" @@ -23,6 +24,13 @@ func TestWindowDriver(t *testing.T) { gobottest.Assert(t, d.Connection(), (gobot.Connection)(nil)) } +func TestWindowDriverName(t *testing.T) { + d := initTestWindowDriver() + gobottest.Assert(t, strings.HasPrefix(d.Name(), "Window"), true) + d.SetName("NewName") + gobottest.Assert(t, d.Name(), "NewName") +} + func TestWindowDriverStart(t *testing.T) { d := initTestWindowDriver() gobottest.Assert(t, d.Start(), nil)