package button_test import ( "mayhem-party/src/device/input/button" "testing" ) func TestV01(t *testing.T) { src := constSrc(`{"T":1,"U":"bel","Y":"abc","N":"cde"}`) t.Logf("(%v) %s", len(src), src.Read()) v01 := button.NewV01(src) got := v01.Read() want := []button.Button{ {Down: true, Char: 'a'}, {Down: true, Char: 'b'}, {Down: true, Char: 'c'}, {Down: false, Char: 'c'}, {Down: false, Char: 'd'}, {Down: false, Char: 'e'}, } if len(got) != len(want) { t.Fatal(len(want), len(got)) } for i := range got { if got[i] != want[i] { t.Errorf("[%d] want %+v got %+v", i, want[i], got[i]) } } }