diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-03-22 13:50:44 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-03-23 09:38:38 +1000 |
commit | 880512f84c26cddbfc1a8ff495890595424466f2 (patch) | |
tree | 0cbc90466f06e91a440eb42d7733f424218affb7 /test | |
parent | aadf1e0d215e3e7dfe119c3e541d35854de2326a (diff) |
wcmUSB: change MOD_BUTTONS macro into a function
Values in, values out. No magic state structs, keep it simple.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Ping Cheng <pinglinux@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/wacom-tests.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/wacom-tests.c b/test/wacom-tests.c index 1eec90e..f7b0fcc 100644 --- a/test/wacom-tests.c +++ b/test/wacom-tests.c @@ -428,6 +428,21 @@ test_tilt_to_rotation(void) } +static void +test_mod_buttons(void) +{ + int i; + for (i = 0; i < sizeof(int); i++) + { + int buttons = mod_buttons(0, i, 1); + assert(buttons == (1 << i)); + buttons = mod_buttons(0, i, 0); + assert(buttons == 0); + } + + assert(mod_buttons(0, sizeof(int), 1) == 0); +} + int main(int argc, char** argv) { test_common_ref(); @@ -436,6 +451,7 @@ int main(int argc, char** argv) test_suppress(); test_initial_size(); test_tilt_to_rotation(); + test_mod_buttons(); return 0; } |