From c1a7fec54192db8fe2e0131b08d92693aa50e5c3 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Sat, 18 Mar 2017 17:53:10 +0100 Subject: [PATCH] i2c: increase jhd1313m1 test coverage Signed-off-by: deadprogram --- drivers/i2c/jhd1313m1_driver_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/i2c/jhd1313m1_driver_test.go b/drivers/i2c/jhd1313m1_driver_test.go index f63d992b..93d954ec 100644 --- a/drivers/i2c/jhd1313m1_driver_test.go +++ b/drivers/i2c/jhd1313m1_driver_test.go @@ -57,6 +57,12 @@ func TestJHD1313MDriverStart(t *testing.T) { gobottest.Assert(t, d.Start(), nil) } +func TestJHD1313MDriverHalt(t *testing.T) { + d := initTestJHD1313M1Driver() + d.Start() + gobottest.Assert(t, d.Halt(), nil) +} + func TestJHD1313MDriverSetRgb(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() d.Start() @@ -81,18 +87,36 @@ func TestJHD1313MDriverWrite(t *testing.T) { gobottest.Assert(t, d.Write("Hello"), nil) } +func TestJHD1313MDriverWriteTwoLines(t *testing.T) { + d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() + d.Start() + gobottest.Assert(t, d.Write("Hello\nthere"), nil) +} + func TestJHD1313MDriverSetPosition(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() d.Start() gobottest.Assert(t, d.SetPosition(2), nil) } +func TestJHD1313MDriverSetSecondLinePosition(t *testing.T) { + d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() + d.Start() + gobottest.Assert(t, d.SetPosition(18), nil) +} + func TestJHD1313MDriverScroll(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() d.Start() gobottest.Assert(t, d.Scroll(true), nil) } +func TestJHD1313MDriverReverseScroll(t *testing.T) { + d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() + d.Start() + gobottest.Assert(t, d.Scroll(false), nil) +} + func TestJHD1313MDriverSetCustomChar(t *testing.T) { d, _ := initTestJHD1313M1DriverWithStubbedAdaptor() data := [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}