2015-06-07 12:38:19 -07:00
|
|
|
package ble
|
|
|
|
|
|
|
|
import (
|
2017-02-02 15:56:26 +01:00
|
|
|
"strings"
|
2015-06-07 12:38:19 -07:00
|
|
|
"testing"
|
|
|
|
|
2016-12-27 19:44:07 +01:00
|
|
|
"gobot.io/x/gobot"
|
2016-12-08 13:24:03 +01:00
|
|
|
"gobot.io/x/gobot/gobottest"
|
2015-06-07 12:38:19 -07:00
|
|
|
)
|
|
|
|
|
2016-12-27 19:44:07 +01:00
|
|
|
var _ gobot.Adaptor = (*ClientAdaptor)(nil)
|
|
|
|
|
2016-09-25 20:14:05 +02:00
|
|
|
func initTestBLEClientAdaptor() *ClientAdaptor {
|
|
|
|
a := NewClientAdaptor("D7:99:5A:26:EC:38")
|
2015-06-07 12:38:19 -07:00
|
|
|
return a
|
|
|
|
}
|
|
|
|
|
2016-07-08 20:36:53 +02:00
|
|
|
func TestBLEClientAdaptor(t *testing.T) {
|
2016-09-25 20:14:05 +02:00
|
|
|
a := NewClientAdaptor("D7:99:5A:26:EC:38")
|
2016-12-28 17:53:41 +01:00
|
|
|
gobottest.Assert(t, a.Address(), "D7:99:5A:26:EC:38")
|
2017-02-02 15:56:26 +01:00
|
|
|
gobottest.Assert(t, strings.HasPrefix(a.Name(), "BLEClient"), true)
|
2017-01-31 21:41:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestBLEClientAdaptorName(t *testing.T) {
|
|
|
|
a := NewClientAdaptor("D7:99:5A:26:EC:38")
|
|
|
|
a.SetName("awesome")
|
|
|
|
gobottest.Assert(t, a.Name(), "awesome")
|
2015-06-07 12:38:19 -07:00
|
|
|
}
|