2016-12-19 23:21:47 +08:00
|
|
|
package bb8
|
|
|
|
|
2016-12-23 16:36:16 +08:00
|
|
|
import (
|
2017-02-02 23:42:43 +08:00
|
|
|
"strings"
|
|
|
|
"testing"
|
2016-12-23 16:36:16 +08:00
|
|
|
|
2017-02-02 23:42:43 +08:00
|
|
|
"gobot.io/x/gobot"
|
|
|
|
"gobot.io/x/gobot/gobottest"
|
2016-12-23 16:36:16 +08:00
|
|
|
)
|
2016-12-19 23:21:47 +08:00
|
|
|
|
2016-12-23 16:23:18 +08:00
|
|
|
var _ gobot.Driver = (*BB8Driver)(nil)
|
2016-12-23 16:36:16 +08:00
|
|
|
|
|
|
|
func initTestBB8Driver() *BB8Driver {
|
2017-04-05 18:58:04 +08:00
|
|
|
d := NewDriver(NewBleTestAdaptor())
|
2016-12-23 16:36:16 +08:00
|
|
|
return d
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBB8Driver(t *testing.T) {
|
|
|
|
d := initTestBB8Driver()
|
2017-02-02 23:42:43 +08:00
|
|
|
gobottest.Assert(t, strings.HasPrefix(d.Name(), "BB8"), true)
|
2017-04-05 18:58:04 +08:00
|
|
|
d.SetName("NewName")
|
|
|
|
gobottest.Assert(t, d.Name(), "NewName")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBB8DriverStartAndHalt(t *testing.T) {
|
|
|
|
d := initTestBB8Driver()
|
|
|
|
gobottest.Assert(t, d.Start(), nil)
|
|
|
|
gobottest.Assert(t, d.Halt(), nil)
|
2016-12-23 16:36:16 +08:00
|
|
|
}
|