test: a boolean parameter is always true/false

Don't require the caller to provide the values, they're always the
same.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1123>
This commit is contained in:
Peter Hutterer 2025-01-08 15:00:20 +10:00 committed by Marge Bot
parent 86b9142a02
commit fefeab4efe
3 changed files with 42 additions and 42 deletions

View file

@ -483,7 +483,7 @@ START_TEST(parameter_permutations)
}; };
struct litest_parameters *params = litest_parameters_new("first", 'i', 3, 1, 2, 3, struct litest_parameters *params = litest_parameters_new("first", 'i', 3, 1, 2, 3,
"second", 's', 3, "a", "ab", "abc", "second", 's', 3, "a", "ab", "abc",
"third", 'b', 2, true, false, "third", 'b',
NULL); NULL);
litest_parameters_permutations(params, permutation_func, permutations); litest_parameters_permutations(params, permutation_func, permutations);

View file

@ -481,16 +481,15 @@ _litest_parameters_new(const char *name, ...) {
while (name) { while (name) {
char type = va_arg(args, int); char type = va_arg(args, int);
unsigned int nargs = va_arg(args, unsigned int);
struct litest_parameter *param = litest_parameter_new(name, type); struct litest_parameter *param = litest_parameter_new(name, type);
if (type == 'b') {
litest_parameter_add_bool(param, true);
litest_parameter_add_bool(param, false);
} else {
unsigned int nargs = va_arg(args, unsigned int);
for (unsigned int _ = 0; _ < nargs; _++) { for (unsigned int _ = 0; _ < nargs; _++) {
switch (type) { switch (type) {
case 'b': {
bool b = va_arg(args, int);
litest_parameter_add_bool(param, b);
break;
}
case 'c': { case 'c': {
char b = va_arg(args, int); char b = va_arg(args, int);
litest_parameter_add_char(param, b); litest_parameter_add_char(param, b);
@ -521,6 +520,7 @@ _litest_parameters_new(const char *name, ...) {
break; break;
} }
} }
}
litest_parameters_add(ps, param); litest_parameters_add(ps, param);
litest_parameter_unref(param); litest_parameter_unref(param);

View file

@ -7201,7 +7201,7 @@ TEST_COLLECTION(tablet)
litest_add_for_device(huion_static_btn_tool_pen_no_timeout_during_usage, LITEST_HUION_TABLET); litest_add_for_device(huion_static_btn_tool_pen_no_timeout_during_usage, LITEST_HUION_TABLET);
{ {
struct litest_parameters *params = litest_parameters_new("btn_tool_pen_timeout", 'b', 2, true, false); struct litest_parameters *params = litest_parameters_new("btn_tool_pen_timeout", 'b');
litest_add_parametrized_for_device(huion_static_btn_tool_pen_disable_quirk_on_prox_out, LITEST_HUION_TABLET, params); litest_add_parametrized_for_device(huion_static_btn_tool_pen_disable_quirk_on_prox_out, LITEST_HUION_TABLET, params);
litest_parameters_unref(params); litest_parameters_unref(params);
} }
@ -7218,10 +7218,10 @@ TEST_COLLECTION(tablet_left_handed)
litest_add_for_device(no_left_handed, LITEST_WACOM_CINTIQ); litest_add_for_device(no_left_handed, LITEST_WACOM_CINTIQ);
{ {
struct litest_parameters *params = litest_parameters_new("tablet_from", 'b', 2, true, false, struct litest_parameters *params = litest_parameters_new("tablet_from", 'b',
"touch_from", 'b', 2, true, false, "touch_from", 'b',
"tablet_to", 'b', 2, true, false, "tablet_to", 'b',
"touch_to", 'b', 2, true, false); "touch_to", 'b');
litest_add_parametrized(tablet_rotation_left_handed, LITEST_TABLET, LITEST_ANY, params); litest_add_parametrized(tablet_rotation_left_handed, LITEST_TABLET, LITEST_ANY, params);
litest_add_parametrized(tablet_rotation_left_handed_configuration, LITEST_TABLET, LITEST_ANY, params); litest_add_parametrized(tablet_rotation_left_handed_configuration, LITEST_TABLET, LITEST_ANY, params);
litest_add_parametrized(tablet_rotation_left_handed_while_in_prox, LITEST_TABLET, LITEST_ANY, params); litest_add_parametrized(tablet_rotation_left_handed_while_in_prox, LITEST_TABLET, LITEST_ANY, params);