mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-29 13:49:14 +08:00
41 lines
802 B
Go
41 lines
802 B
Go
![]() |
package leap
|
||
|
|
||
|
import (
|
||
|
"github.com/hybridgroup/gobot"
|
||
|
"io/ioutil"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
var d *LeapMotionDriver
|
||
|
|
||
|
func init() {
|
||
|
d = NewLeapMotionDriver(NewLeapMotionAdaptor("bot", "/dev/null"), "bot")
|
||
|
}
|
||
|
|
||
|
func TestStart(t *testing.T) {
|
||
|
t.SkipNow()
|
||
|
gobot.Expect(t, d.Start(), true)
|
||
|
}
|
||
|
|
||
|
func TestHalt(t *testing.T) {
|
||
|
t.SkipNow()
|
||
|
gobot.Expect(t, d.Halt(), true)
|
||
|
}
|
||
|
|
||
|
func TestInit(t *testing.T) {
|
||
|
t.SkipNow()
|
||
|
gobot.Expect(t, d.Init(), true)
|
||
|
}
|
||
|
|
||
|
func TestParser(t *testing.T) {
|
||
|
file, _ := ioutil.ReadFile("./test/support/example_frame.json")
|
||
|
parsedFrame := d.ParseFrame(file)
|
||
|
|
||
|
if parsedFrame.Hands == nil || parsedFrame.Pointables == nil || parsedFrame.Gestures == nil {
|
||
|
t.Errorf("ParseFrame incorrectly parsed frame")
|
||
|
}
|
||
|
|
||
|
parsedFrame = d.ParseFrame([]byte{})
|
||
|
gobot.Expect(t, parsedFrame.Timestamp, 0)
|
||
|
}
|