mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-27 13:48:56 +08:00
i2c: increase test coverage for jhd1313m1
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
dbb1ffd4f6
commit
8b4c1e1b8a
@ -115,12 +115,32 @@ func TestJHD1313MDriverWrite(t *testing.T) {
|
||||
gobottest.Assert(t, d.Write("Hello"), nil)
|
||||
}
|
||||
|
||||
func TestJHD1313MDriverWriteError(t *testing.T) {
|
||||
d, a := initTestJHD1313M1DriverWithStubbedAdaptor()
|
||||
d.Start()
|
||||
a.i2cWriteImpl = func([]byte) (int, error) {
|
||||
return 0, errors.New("write error")
|
||||
}
|
||||
|
||||
gobottest.Assert(t, d.Write("Hello"), errors.New("write error"))
|
||||
}
|
||||
|
||||
func TestJHD1313MDriverWriteTwoLines(t *testing.T) {
|
||||
d, _ := initTestJHD1313M1DriverWithStubbedAdaptor()
|
||||
d.Start()
|
||||
gobottest.Assert(t, d.Write("Hello\nthere"), nil)
|
||||
}
|
||||
|
||||
func TestJHD1313MDriverWriteTwoLinesError(t *testing.T) {
|
||||
d, a := initTestJHD1313M1DriverWithStubbedAdaptor()
|
||||
d.Start()
|
||||
|
||||
a.i2cWriteImpl = func([]byte) (int, error) {
|
||||
return 0, errors.New("write error")
|
||||
}
|
||||
gobottest.Assert(t, d.Write("Hello\nthere"), errors.New("write error"))
|
||||
}
|
||||
|
||||
func TestJHD1313MDriverSetPosition(t *testing.T) {
|
||||
d, _ := initTestJHD1313M1DriverWithStubbedAdaptor()
|
||||
d.Start()
|
||||
|
Loading…
x
Reference in New Issue
Block a user