Use testify, write a couple more tests, and start a major refactor.

This commit is contained in:
Anna Rose Wiggins 2025-07-04 23:40:34 -04:00
parent 649fb5e377
commit 3b75fd30e4
10 changed files with 286 additions and 185 deletions

View file

@ -0,0 +1,35 @@
package mappingrules
import "github.com/holoplot/go-evdev"
type RuleTargetBase struct {
DeviceName string
Device *evdev.InputDevice
Code evdev.EvCode
Inverted bool
}
func NewRuleTargetBase(device_name string,
device *evdev.InputDevice,
code evdev.EvCode,
inverted bool) RuleTargetBase {
return RuleTargetBase{
DeviceName: device_name,
Device: device,
Code: code,
Inverted: inverted,
}
}
func (target *RuleTargetBase) GetCode() evdev.EvCode {
return target.Code
}
func (target *RuleTargetBase) GetDeviceName() string {
return target.DeviceName
}
func (target *RuleTargetBase) GetDevice() *evdev.InputDevice {
return target.Device
}