add getEventSlices

This commit is contained in:
2022-07-19 21:00:13 -07:00
parent a0a4684c95
commit c0c37a203b
2 changed files with 88 additions and 8 deletions

View File

@@ -40,6 +40,28 @@ func TestParseInputToEvent(t *testing.T) {
}
}
func TestGetEventSlices(t *testing.T) {
testCases := []struct {
name string
testFile string
touchSetCount int
}{
{"pixel", pixel, 7},
{"tablet", tablet, 8},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
lines := strings.Split(tc.testFile, "\n")
lines = trimDeviceDescriptors(lines)
touchEvents := parseInputToEvent(lines)
touches := getEventSlices(touchEvents)
if len(touches) != tc.touchSetCount {
t.Errorf("Expected %d touches but found %d", tc.touchSetCount, len(touches))
}
})
}
}
func TestTrimDeviceDescriptors(t *testing.T) {
testCases := []struct {
name string