test: add litest_assert_not_reached()

Simpler than a specific litest_abort_msg() everywhere

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
This commit is contained in:
Peter Hutterer 2025-05-07 11:55:51 +10:00 committed by Marge Bot
parent e91e1c3111
commit 14c4667980
3 changed files with 6 additions and 3 deletions

View file

@ -162,6 +162,9 @@ litest_fail_comparison_str(const char *file,
#cond, __VA_ARGS__); \
} while(0)
#define litest_assert_not_reached() \
litest_abort_msg("Triggered unreachable code\n")
#define _litest_abort_msg(file_, line_, func_, ...) do {\
litest_fail_condition(file_, line_, func_, \
"aborting", __VA_ARGS__); \

View file

@ -1650,7 +1650,7 @@ START_TEST(gestures_hold_once_tap_n_drag)
button = BTN_MIDDLE;
break;
default:
abort();
litest_assert_not_reached();
}
switch (nfingers) {

View file

@ -680,7 +680,7 @@ START_TEST(tip_up_motion_one_axis)
start_y = 15;
break;
default:
abort();
litest_assert_not_reached();
}
/* generate enough events to fill the history and move alonge the
@ -3953,7 +3953,7 @@ get_tool_xy(struct libinput *li, double *x, double *y)
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
break;
default:
abort();
litest_assert_not_reached();
}
*x = libinput_event_tablet_tool_get_x_transformed(tev, 100);