1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-24 13:48:49 +08:00

neurosky: increase test coverage

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-04-06 10:58:34 +02:00
parent 2b8750b239
commit 6bbf9989ed
2 changed files with 17 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package neurosky
import (
"errors"
"io"
"strings"
"sync"
"testing"
@ -65,6 +66,13 @@ func TestNeuroskyAdaptor(t *testing.T) {
gobottest.Assert(t, a.Port(), "/dev/null")
}
func TestNeuroskyAdaptorName(t *testing.T) {
a := NewAdaptor("/dev/null")
gobottest.Assert(t, strings.HasPrefix(a.Name(), "Neurosky"), true)
a.SetName("NewName")
gobottest.Assert(t, a.Name(), "NewName")
}
func TestNeuroskyAdaptorConnect(t *testing.T) {
a := initTestNeuroskyAdaptor()
gobottest.Assert(t, a.Connect(), nil)

View File

@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"io"
"strings"
"testing"
"time"
@ -26,6 +27,14 @@ func TestNeuroskyDriver(t *testing.T) {
d := initTestNeuroskyDriver()
gobottest.Refute(t, d.Connection(), nil)
}
func TestNeuroskyDriverName(t *testing.T) {
d := initTestNeuroskyDriver()
gobottest.Assert(t, strings.HasPrefix(d.Name(), "Neurosky"), true)
d.SetName("NewName")
gobottest.Assert(t, d.Name(), "NewName")
}
func TestNeuroskyDriverStart(t *testing.T) {
sem := make(chan bool, 0)