2014-04-28 10:34:16 +08:00
|
|
|
package gpio
|
2014-04-26 18:11:51 +08:00
|
|
|
|
|
|
|
import (
|
2014-06-13 11:08: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 initTestAnalogSensorDriver() *AnalogSensorDriver {
|
|
|
|
return NewAnalogSensorDriver(TestAdaptor{}, "bot", "1")
|
2014-06-13 11:08:06 +08:00
|
|
|
}
|
2014-04-26 18:11:51 +08:00
|
|
|
|
2014-06-14 07:01:39 +08:00
|
|
|
func TestAnalogSensorDriverStart(t *testing.T) {
|
|
|
|
d := initTestAnalogSensorDriver()
|
|
|
|
gobot.Expect(t, d.Start(), true)
|
2014-06-13 11:08:06 +08:00
|
|
|
}
|
2014-06-14 03:39:02 +08:00
|
|
|
|
2014-06-14 07:01:39 +08:00
|
|
|
func TestAnalogSensorDriverHalt(t *testing.T) {
|
|
|
|
d := initTestAnalogSensorDriver()
|
|
|
|
gobot.Expect(t, d.Halt(), true)
|
2014-06-13 11:08:06 +08:00
|
|
|
}
|
2014-06-14 03:39:02 +08:00
|
|
|
|
2014-06-14 07:01:39 +08:00
|
|
|
func TestAnalogSensorDriverInit(t *testing.T) {
|
|
|
|
d := initTestAnalogSensorDriver()
|
|
|
|
gobot.Expect(t, d.Init(), true)
|
2014-06-13 11:08:06 +08:00
|
|
|
}
|
2014-06-14 03:39:02 +08:00
|
|
|
|
2014-06-14 07:01:39 +08:00
|
|
|
func TestAnalogSensorDriverRead(t *testing.T) {
|
|
|
|
d := initTestAnalogSensorDriver()
|
|
|
|
gobot.Expect(t, d.Read(), 99)
|
2014-06-13 11:08:06 +08:00
|
|
|
}
|