2014-04-28 19:23:15 +08:00
|
|
|
package digispark
|
2014-04-26 18:11:51 +08:00
|
|
|
|
|
|
|
import (
|
2014-06-13 07:15:06 +08:00
|
|
|
"github.com/hybridgroup/gobot"
|
|
|
|
"testing"
|
2014-04-26 18:11:51 +08:00
|
|
|
)
|
|
|
|
|
2014-06-14 07:01:39 +08:00
|
|
|
func initTestDigisparkAdaptor() *DigisparkAdaptor {
|
|
|
|
a := NewDigisparkAdaptor("bot")
|
|
|
|
a.connect = func(a *DigisparkAdaptor) {}
|
|
|
|
return a
|
2014-06-13 07:15:06 +08:00
|
|
|
}
|
2014-04-26 18:11:51 +08:00
|
|
|
|
2014-06-14 07:01:39 +08:00
|
|
|
func TestDigisparkAdaptorFinalize(t *testing.T) {
|
|
|
|
a := initTestDigisparkAdaptor()
|
2014-07-18 02:41:47 +08:00
|
|
|
gobot.Assert(t, a.Finalize(), true)
|
2014-06-13 07:15:06 +08:00
|
|
|
}
|
2014-06-14 07:01:39 +08:00
|
|
|
|
|
|
|
func TestDigisparkAdaptorConnect(t *testing.T) {
|
|
|
|
a := initTestDigisparkAdaptor()
|
2014-07-18 02:41:47 +08:00
|
|
|
gobot.Assert(t, a.Connect(), true)
|
2014-06-13 07:15:06 +08:00
|
|
|
}
|
2014-06-14 07:01:39 +08:00
|
|
|
|
|
|
|
func TestDigisparkAdaptorDisconnect(t *testing.T) {
|
|
|
|
a := initTestDigisparkAdaptor()
|
2014-07-18 02:41:47 +08:00
|
|
|
gobot.Assert(t, a.Disconnect(), true)
|
2014-06-13 07:15:06 +08:00
|
|
|
}
|
2014-06-14 07:01:39 +08:00
|
|
|
|
|
|
|
func TestDigisparkAdaptorReconnect(t *testing.T) {
|
|
|
|
a := initTestDigisparkAdaptor()
|
2014-07-18 02:41:47 +08:00
|
|
|
gobot.Assert(t, a.Reconnect(), true)
|
2014-06-13 07:15:06 +08:00
|
|
|
}
|