2014-08-01 14:39:52 +08:00
|
|
|
package mavlink
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
|
|
|
)
|
|
|
|
|
|
|
|
func initTestMavlinkAdaptor() *MavlinkAdaptor {
|
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 m
|
2014-08-01 14:39:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestMavlinkAdaptorConnect(t *testing.T) {
|
|
|
|
a := initTestMavlinkAdaptor()
|
2014-11-17 04:25:48 +08:00
|
|
|
gobot.Assert(t, a.Connect(), nil)
|
2014-08-01 14:39:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestMavlinkAdaptorFinalize(t *testing.T) {
|
|
|
|
a := initTestMavlinkAdaptor()
|
2014-11-17 04:25:48 +08:00
|
|
|
gobot.Assert(t, a.Finalize(), nil)
|
2014-08-01 14:39:52 +08:00
|
|
|
}
|