forked from hybridgroup/gobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bebop hull protection setting and beginning of test coverage
- Loading branch information
1 parent
810e07b
commit 360585a
Showing
8 changed files
with
176 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package bebop | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/hybridgroup/gobot" | ||
) | ||
|
||
func initTestBebopAdaptor() *BebopAdaptor { | ||
a := NewBebopAdaptor("bot") | ||
a.connect = func(b *BebopAdaptor) (err error) { | ||
b.drone = &testDrone{} | ||
return nil | ||
} | ||
return a | ||
} | ||
|
||
func TestBebopAdaptorConnect(t *testing.T) { | ||
a := initTestBebopAdaptor() | ||
gobot.Assert(t, len(a.Connect()), 0) | ||
|
||
a.connect = func(a *BebopAdaptor) (error) { | ||
return errors.New("connection error") | ||
} | ||
gobot.Assert(t, a.Connect()[0], errors.New("connection error")) | ||
} | ||
|
||
func TestBebopAdaptorFinalize(t *testing.T) { | ||
a := initTestBebopAdaptor() | ||
a.Connect() | ||
gobot.Assert(t, len(a.Finalize()), 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package bebop | ||
|
||
type testDrone struct{} | ||
|
||
//func (t testDrone) Close() {} | ||
func (t testDrone) TakeOff() error { return nil } | ||
func (t testDrone) Land() error { return nil } | ||
func (t testDrone) Up(n int) error { return nil } | ||
func (t testDrone) Down(n int) error { return nil } | ||
func (t testDrone) Left(n int) error { return nil} | ||
func (t testDrone) Right(n int) error { return nil } | ||
func (t testDrone) Forward(n int) error { return nil } | ||
func (t testDrone) Backward(n int) error { return nil } | ||
func (t testDrone) Clockwise(n int) error { return nil } | ||
func (t testDrone) CounterClockwise(n int) error { return nil } | ||
func (t testDrone) Stop() error { return nil } | ||
func (t testDrone) Connect() error { return nil } | ||
func (t testDrone) Video() chan []byte { return nil } | ||
func (t testDrone) StartRecording() error { return nil } | ||
func (t testDrone) StopRecording() error { return nil } | ||
func (t testDrone) HullProtection(protect bool) error { return nil } |