mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 08:50:27 +01:00
test: add litest_assert_str_in/not_in() helpers
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
This commit is contained in:
parent
14c4667980
commit
ea50e1a92c
2 changed files with 23 additions and 4 deletions
|
|
@ -285,6 +285,28 @@ litest_fail_comparison_str(const char *file,
|
|||
_a, _b); \
|
||||
} while(0)
|
||||
|
||||
#define litest_assert_str_in(needle_, haystack_) \
|
||||
do { \
|
||||
const char *_needle = needle_; \
|
||||
const char *_haystack = haystack_; \
|
||||
if (!strstr(_haystack, _needle)) \
|
||||
litest_fail_comparison_str(__FILE__, __LINE__, __func__,\
|
||||
"'" #needle_ "' in: '" #haystack_ "'", \
|
||||
"in", \
|
||||
_needle, _haystack); \
|
||||
} while(0)
|
||||
|
||||
#define litest_needlessert_str_not_in(needle_, haystack_) \
|
||||
do { \
|
||||
const char *_needle = needle_; \
|
||||
const char *_haystack = haystack_; \
|
||||
if (!strstr(_haystack, _needle)) \
|
||||
litest_fail_comparison_str(__FILE__, __LINE__, __func__,\
|
||||
"'" #needle_ "' not in: '" #haystack_ "'", \
|
||||
"not in", \
|
||||
_needle, _haystack); \
|
||||
} while(0)
|
||||
|
||||
#define LITEST_DEFAULT_EPSILON 0.001
|
||||
|
||||
#define litest_assert_double_eq_epsilon(a_, b_, epsilon_)\
|
||||
|
|
|
|||
|
|
@ -142,13 +142,10 @@ axisrange_warning_log_handler(struct libinput *libinput,
|
|||
const char *format,
|
||||
va_list args)
|
||||
{
|
||||
const char *substr;
|
||||
|
||||
axisrange_log_handler_called++;
|
||||
litest_assert_notnull(format);
|
||||
|
||||
substr = strstr(format, "is outside expected range");
|
||||
litest_assert_notnull(substr);
|
||||
litest_assert_str_in("is outside expected range", format);
|
||||
}
|
||||
|
||||
START_TEST(log_axisrange_warning)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue