2014-08-01 14:39:52 +08:00
|
|
|
package mavlink
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
|
|
|
)
|
|
|
|
|
|
|
|
func initTestMavlinkDriver() *MavlinkDriver {
|
2014-08-05 03:06:54 +08:00
|
|
|
m := NewMavlinkAdaptor("myAdaptor", "/dev/null")
|
|
|
|
m.sp = gobot.NullReadWriteCloser{}
|
2014-11-20 08:03:50 +08:00
|
|
|
m.connect = func(a *MavlinkAdaptor) (err error) { return nil }
|
2014-08-05 03:06:54 +08:00
|
|
|
return NewMavlinkDriver(m, "myDriver")
|
2014-08-01 14:39:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestMavlinkDriverStart(t *testing.T) {
|
|
|
|
d := initTestMavlinkDriver()
|
2014-11-17 04:25:48 +08:00
|
|
|
gobot.Assert(t, d.Start(), nil)
|
2014-08-01 14:39:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestMavlinkDriverHalt(t *testing.T) {
|
|
|
|
d := initTestMavlinkDriver()
|
2014-11-17 04:25:48 +08:00
|
|
|
gobot.Assert(t, d.Halt(), nil)
|
2014-08-01 14:39:52 +08:00
|
|
|
}
|