raspi: increase test coverage

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-05-01 10:41:24 +02:00
parent 135a0f9b4d
commit ac74498342
2 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package raspi
import (
"errors"
"testing"
"gobot.io/x/gobot/gobottest"
@ -33,6 +34,10 @@ func TestPwmPin(t *testing.T) {
dc, _ = pin.DutyCycle()
gobottest.Assert(t, dc, uint32(10000))
gobottest.Assert(t, pin.SetDutyCycle(999999999), errors.New("Duty cycle exceeds period."))
dc, _ = pin.DutyCycle()
gobottest.Assert(t, dc, uint32(10000))
// call currently fails in test
gobottest.Refute(t, pin.Unexport(), nil)
}

View File

@ -147,6 +147,10 @@ func TestAdaptorDigitalIO(t *testing.T) {
fs.WithReadError = true
_, err := a.DigitalRead("13")
gobottest.Assert(t, err, errors.New("read error"))
fs.WithWriteError = true
_, err = a.DigitalRead("7")
gobottest.Assert(t, err, errors.New("write error"))
}
func TestAdaptorI2c(t *testing.T) {