mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-25 10:30:07 +01:00
test: add a simple test to guard against wrong library version changes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
c6a082dfd9
commit
0c0832d06c
2 changed files with 24 additions and 0 deletions
|
|
@ -136,6 +136,7 @@ test_trackpoint_LDADD = $(TEST_LIBS)
|
|||
test_trackpoint_LDFLAGS = -no-install
|
||||
|
||||
test_misc_SOURCES = misc.c
|
||||
test_misc_CFLAGS= $(AM_CFLAGS) -DLIBINPUT_LT_VERSION="\"$(LIBINPUT_LT_VERSION)\""
|
||||
test_misc_LDADD = $(TEST_LIBS)
|
||||
test_misc_LDFLAGS = -no-install
|
||||
|
||||
|
|
|
|||
23
test/misc.c
23
test/misc.c
|
|
@ -863,6 +863,27 @@ START_TEST(fd_no_event_leak)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(library_version)
|
||||
{
|
||||
const char *version = LIBINPUT_LT_VERSION;
|
||||
int C, R, A;
|
||||
int rc;
|
||||
|
||||
rc = sscanf(version, "%d:%d:%d", &C, &R, &A);
|
||||
ck_assert_int_eq(rc, 3);
|
||||
|
||||
ck_assert_int_ge(C, 17);
|
||||
ck_assert_int_ge(R, 0);
|
||||
ck_assert_int_ge(A, 7);
|
||||
|
||||
/* Binary compatibility broken? */
|
||||
ck_assert(R != 0 || A != 0);
|
||||
|
||||
/* The first stable API in 0.12 had 10:0:0 */
|
||||
ck_assert_int_eq(C - A, 10);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
litest_setup_tests(void)
|
||||
{
|
||||
|
|
@ -888,4 +909,6 @@ litest_setup_tests(void)
|
|||
litest_add_no_device("misc:time", time_conversion);
|
||||
|
||||
litest_add_no_device("misc:fd", fd_no_event_leak);
|
||||
|
||||
litest_add_no_device("misc:library_version", library_version);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue