2014-04-29 02:23:12 +08:00
|
|
|
package ardrone
|
2014-04-26 18:11:51 +08:00
|
|
|
|
|
|
|
import (
|
2014-06-13 07:07:40 +08:00
|
|
|
"github.com/hybridgroup/gobot"
|
|
|
|
"testing"
|
2014-04-26 18:11:51 +08:00
|
|
|
)
|
|
|
|
|
2014-06-13 07:07:40 +08:00
|
|
|
var adaptor *ArdroneAdaptor
|
|
|
|
var d *testDrone
|
2014-04-26 18:11:51 +08:00
|
|
|
|
2014-06-13 07:07:40 +08:00
|
|
|
func init() {
|
|
|
|
d = &testDrone{}
|
|
|
|
adaptor = NewArdroneAdaptor("drone")
|
|
|
|
adaptor.connect = func(a *ArdroneAdaptor) {
|
|
|
|
a.drone = d
|
|
|
|
}
|
|
|
|
}
|
2014-04-26 18:11:51 +08:00
|
|
|
|
2014-06-13 07:07:40 +08:00
|
|
|
func TestFinalize(t *testing.T) {
|
|
|
|
gobot.Expect(t, adaptor.Finalize(), true)
|
|
|
|
}
|
|
|
|
func TestConnect(t *testing.T) {
|
|
|
|
gobot.Expect(t, adaptor.Connect(), true)
|
|
|
|
}
|
|
|
|
func TestDisconnect(t *testing.T) {
|
|
|
|
gobot.Expect(t, adaptor.Disconnect(), true)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestReconnect(t *testing.T) {
|
|
|
|
gobot.Expect(t, adaptor.Reconnect(), true)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestDrone(t *testing.T) {
|
|
|
|
adaptor.Connect()
|
|
|
|
gobot.Expect(t, adaptor.Drone(), d)
|
|
|
|
}
|