From a2d76749ca9ff99342451f02a23a58519000c696 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 6 Apr 2017 09:50:01 +0200 Subject: [PATCH] audio: increase test coverage Signed-off-by: deadprogram --- platforms/audio/audio_adaptor_test.go | 8 ++++++++ platforms/audio/audio_driver_test.go | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/platforms/audio/audio_adaptor_test.go b/platforms/audio/audio_adaptor_test.go index c9ef6c9f..d1af90f2 100644 --- a/platforms/audio/audio_adaptor_test.go +++ b/platforms/audio/audio_adaptor_test.go @@ -3,6 +3,7 @@ package audio import ( "os/exec" + "strings" "testing" "gobot.io/x/gobot" @@ -18,6 +19,13 @@ func TestAudioAdaptor(t *testing.T) { gobottest.Assert(t, a.Finalize(), nil) } +func TestAudioAdaptorName(t *testing.T) { + a := NewAdaptor() + gobottest.Assert(t, strings.HasPrefix(a.Name(), "Audio"), true) + a.SetName("NewName") + gobottest.Assert(t, a.Name(), "NewName") +} + func TestAudioAdaptorCommandsWav(t *testing.T) { cmd, _ := CommandName("whatever.wav") gobottest.Assert(t, cmd, "aplay") diff --git a/platforms/audio/audio_driver_test.go b/platforms/audio/audio_driver_test.go index 84eafae3..d7e7a0c7 100644 --- a/platforms/audio/audio_driver_test.go +++ b/platforms/audio/audio_driver_test.go @@ -4,6 +4,7 @@ package audio import ( "os/exec" + "strings" "testing" "gobot.io/x/gobot" @@ -24,6 +25,13 @@ func TestAudioDriver(t *testing.T) { gobottest.Assert(t, d.Halt(), nil) } +func TestAudioDriverName(t *testing.T) { + d := NewDriver(NewAdaptor(), "") + gobottest.Assert(t, strings.HasPrefix(d.Name(), "Audio"), true) + d.SetName("NewName") + gobottest.Assert(t, d.Name(), "NewName") +} + func TestAudioDriverSoundWithNoFilename(t *testing.T) { d := NewDriver(NewAdaptor(), "")