gobot.io/x/gobot/v2@v2.1.0/platforms/sphero/sprkplus/sprkplus_driver_test.go (about)

     1  package sprkplus
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"gobot.io/x/gobot/v2"
     8  	"gobot.io/x/gobot/v2/gobottest"
     9  )
    10  
    11  var _ gobot.Driver = (*SPRKPlusDriver)(nil)
    12  
    13  func initTestSPRKPlusDriver() *SPRKPlusDriver {
    14  	d := NewDriver(NewBleTestAdaptor())
    15  	return d
    16  }
    17  
    18  func TestSPRKPlusDriver(t *testing.T) {
    19  	d := initTestSPRKPlusDriver()
    20  	gobottest.Assert(t, strings.HasPrefix(d.Name(), "SPRK"), true)
    21  	d.SetName("NewName")
    22  	gobottest.Assert(t, d.Name(), "NewName")
    23  }
    24  
    25  func TestSPRKPlusDriverStartAndHalt(t *testing.T) {
    26  	d := initTestSPRKPlusDriver()
    27  	gobottest.Assert(t, d.Start(), nil)
    28  	gobottest.Assert(t, d.Halt(), nil)
    29  }