hybridgroup.gobot/platforms/ardrone/ardrone_adaptor_test.go

37 lines
664 B
Go
Raw Normal View History

2014-04-29 02:23:12 +08:00
package ardrone
import (
2014-06-13 07:07:40 +08:00
"github.com/hybridgroup/gobot"
"testing"
)
2014-06-13 07:07:40 +08:00
var adaptor *ArdroneAdaptor
var d *testDrone
2014-06-13 07:07:40 +08:00
func init() {
d = &testDrone{}
adaptor = NewArdroneAdaptor("drone")
adaptor.connect = func(a *ArdroneAdaptor) {
a.drone = d
}
}
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)
}