fix PWM related read/write tests
This commit is contained in:
parent
47858044a4
commit
5977c05f6c
|
@ -113,11 +113,11 @@ func TestBeagleboneAdaptor(t *testing.T) {
|
|||
gobottest.Assert(t, a.ServoWrite("P9_99", 175), errors.New("Not a valid PWM pin"))
|
||||
|
||||
fs.WithReadError = true
|
||||
gobottest.Assert(t, a.PwmWrite("P9_21", 175), errors.New("read error"))
|
||||
gobottest.Assert(t, strings.Contains(a.PwmWrite("P9_21", 175).Error(), "read error"), true)
|
||||
fs.WithReadError = false
|
||||
|
||||
fs.WithWriteError = true
|
||||
gobottest.Assert(t, a.PwmWrite("P9_22", 175), errors.New("write error"))
|
||||
gobottest.Assert(t, strings.Contains(a.PwmWrite("P9_22", 175).Error(), "write error"), true)
|
||||
fs.WithWriteError = false
|
||||
|
||||
// Analog
|
||||
|
|
|
@ -208,7 +208,7 @@ func TestAdaptorPwmWriteError(t *testing.T) {
|
|||
fs.WithWriteError = true
|
||||
|
||||
err := a.PwmWrite("PWM0", 100)
|
||||
gobottest.Assert(t, err, errors.New("write error"))
|
||||
gobottest.Assert(t, strings.Contains(err.Error(), "write error"), true)
|
||||
}
|
||||
|
||||
func TestAdaptorPwmReadError(t *testing.T) {
|
||||
|
@ -216,7 +216,7 @@ func TestAdaptorPwmReadError(t *testing.T) {
|
|||
fs.WithReadError = true
|
||||
|
||||
err := a.PwmWrite("PWM0", 100)
|
||||
gobottest.Assert(t, err, errors.New("read error"))
|
||||
gobottest.Assert(t, strings.Contains(err.Error(), "read error"), true)
|
||||
}
|
||||
|
||||
func TestChipDefaultBus(t *testing.T) {
|
||||
|
|
|
@ -479,7 +479,7 @@ func TestAdaptorPwmWriteError(t *testing.T) {
|
|||
fs.WithWriteError = true
|
||||
|
||||
err := a.PwmWrite("5", 100)
|
||||
gobottest.Assert(t, err, errors.New("write error"))
|
||||
gobottest.Assert(t, strings.Contains(err.Error(), "write error"), true)
|
||||
}
|
||||
|
||||
func TestAdaptorPwmReadError(t *testing.T) {
|
||||
|
@ -488,7 +488,7 @@ func TestAdaptorPwmReadError(t *testing.T) {
|
|||
fs.WithReadError = true
|
||||
|
||||
err := a.PwmWrite("5", 100)
|
||||
gobottest.Assert(t, err, errors.New("read error"))
|
||||
gobottest.Assert(t, strings.Contains(err.Error(), "read error"), true)
|
||||
}
|
||||
|
||||
func TestAdaptorAnalog(t *testing.T) {
|
||||
|
|
|
@ -169,7 +169,7 @@ func TestUP2AdaptorPwmWriteError(t *testing.T) {
|
|||
fs.WithWriteError = true
|
||||
|
||||
err := a.PwmWrite("32", 100)
|
||||
gobottest.Assert(t, err, errors.New("write error"))
|
||||
gobottest.Assert(t, strings.Contains(err.Error(), "write error"), true)
|
||||
}
|
||||
|
||||
func TestUP2AdaptorPwmReadError(t *testing.T) {
|
||||
|
@ -177,7 +177,7 @@ func TestUP2AdaptorPwmReadError(t *testing.T) {
|
|||
fs.WithReadError = true
|
||||
|
||||
err := a.PwmWrite("32", 100)
|
||||
gobottest.Assert(t, err, errors.New("read error"))
|
||||
gobottest.Assert(t, strings.Contains(err.Error(), "read error"), true)
|
||||
}
|
||||
|
||||
func TestUP2I2CDefaultBus(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue