Commit graph

9 commits

Author SHA1 Message Date
Peter Hutterer
c5494e9b1e Fix varius typos across the codebase
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/385>
2026-03-23 12:37:45 +10:00
Peter Hutterer
a6028a7b87 Format the code with clang-format
clang-format taken from libinput, except for
  ColumnLimit: 100
and some macro definitions (which don't all have an effect anyway...)

It's not perfect but good enough and at least consistent.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/383>
2026-03-12 13:55:19 +10:00
Peter Hutterer
08d7d5918f util: free the test parameters after the run
And also ensure we have the null-termination even if
MUNIT_TEST_MAX_PARAMS are given.

Fixes: 2996a66b37 ("util: add support for parametrized tests")
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/372>
2025-12-16 00:32:21 +00:00
Peter Hutterer
2996a66b37 util: add support for parametrized tests
munit supports test parameters (char* only) but the setup is a big
awkward/impossible in C to define statically. So lets simply pass the
parameters as one NULL-terminated string list and require names to be
prefixed with an @. During the test setup we can split that list up into
multiple parameters and pass those to the munit setup where they're
accessible via another wrapper macro:

MUNIT_TEST_WITH_PARAMS(test_foo, "@x", "1", "2", "@y", "100", "200") {
   const char *x = MUNIT_TEST_PARAM("@x");
   const char *y = MUNIT_TEST_PARAM("@y");
}

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/365>
2025-12-03 14:51:55 +10:00
Peter Hutterer
f558eedae2 util: add a global setup option to our munit wrapper
This allows us to handle/manipulate argv and/or pass a userdata to the
tests. Same ELF section approach as we already have with the MUNIT_TEST
macro but this time it's for a global setup.

Note that for the generated __start and __stop section variables we have
to have at least one entry in that section which we do with one
hardcoded (and ignored) one.
2023-10-24 18:25:25 +10:00
Peter Hutterer
6758b9970d util: add helper macros for the ELF section handling 2023-10-24 18:25:25 +10:00
Peter Hutterer
46681e2855 Add SPDX identifiers to all source files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-03-03 00:27:36 +00:00
Peter Hutterer
472f2ee84d util: disable coredumps for the munit helper
Really no need for those in a test suite

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-30 13:09:57 +10:00
Peter Hutterer
1fe93ae8be Factor out munit test handling into a set of helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00