mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 10:38:23 +02:00
test: move litest_assert_ macros and helpers up to the rest of the defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
aaea4a63ec
commit
beee8403e9
1 changed files with 40 additions and 40 deletions
|
|
@ -35,6 +35,28 @@
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
litest_fail_condition(const char *file,
|
||||||
|
int line,
|
||||||
|
const char *func,
|
||||||
|
const char *condition,
|
||||||
|
const char *message,
|
||||||
|
...);
|
||||||
|
void
|
||||||
|
litest_fail_comparison_int(const char *file,
|
||||||
|
int line,
|
||||||
|
const char *func,
|
||||||
|
const char *operator,
|
||||||
|
int a,
|
||||||
|
int b,
|
||||||
|
const char *astr,
|
||||||
|
const char *bstr);
|
||||||
|
void
|
||||||
|
litest_fail_comparison_ptr(const char *file,
|
||||||
|
int line,
|
||||||
|
const char *func,
|
||||||
|
const char *comparison);
|
||||||
|
|
||||||
#define litest_assert(cond) \
|
#define litest_assert(cond) \
|
||||||
do { \
|
do { \
|
||||||
if (!(cond)) \
|
if (!(cond)) \
|
||||||
|
|
@ -111,6 +133,24 @@
|
||||||
#define litest_assert_ptr_notnull(a_) \
|
#define litest_assert_ptr_notnull(a_) \
|
||||||
litest_assert_comparison_ptr_(a_, !=, NULL)
|
litest_assert_comparison_ptr_(a_, !=, NULL)
|
||||||
|
|
||||||
|
#define litest_assert_double_eq(a_, b_)\
|
||||||
|
ck_assert_int_eq((int)((a_) * 256), (int)((b_) * 256))
|
||||||
|
|
||||||
|
#define litest_assert_double_ne(a_, b_)\
|
||||||
|
ck_assert_int_ne((int)((a_) * 256), (int)((b_) * 256))
|
||||||
|
|
||||||
|
#define litest_assert_double_lt(a_, b_)\
|
||||||
|
ck_assert_int_lt((int)((a_) * 256), (int)((b_) * 256))
|
||||||
|
|
||||||
|
#define litest_assert_double_le(a_, b_)\
|
||||||
|
ck_assert_int_le((int)((a_) * 256), (int)((b_) * 256))
|
||||||
|
|
||||||
|
#define litest_assert_double_gt(a_, b_)\
|
||||||
|
ck_assert_int_gt((int)((a_) * 256), (int)((b_) * 256))
|
||||||
|
|
||||||
|
#define litest_assert_double_ge(a_, b_)\
|
||||||
|
ck_assert_int_ge((int)((a_) * 256), (int)((b_) * 256))
|
||||||
|
|
||||||
enum litest_device_type {
|
enum litest_device_type {
|
||||||
LITEST_NO_DEVICE = -1,
|
LITEST_NO_DEVICE = -1,
|
||||||
LITEST_SYNAPTICS_CLICKPAD = -2,
|
LITEST_SYNAPTICS_CLICKPAD = -2,
|
||||||
|
|
@ -211,28 +251,6 @@ struct libinput *litest_create_context(void);
|
||||||
void litest_disable_log_handler(struct libinput *libinput);
|
void litest_disable_log_handler(struct libinput *libinput);
|
||||||
void litest_restore_log_handler(struct libinput *libinput);
|
void litest_restore_log_handler(struct libinput *libinput);
|
||||||
|
|
||||||
void
|
|
||||||
litest_fail_condition(const char *file,
|
|
||||||
int line,
|
|
||||||
const char *func,
|
|
||||||
const char *condition,
|
|
||||||
const char *message,
|
|
||||||
...);
|
|
||||||
void
|
|
||||||
litest_fail_comparison_int(const char *file,
|
|
||||||
int line,
|
|
||||||
const char *func,
|
|
||||||
const char *operator,
|
|
||||||
int a,
|
|
||||||
int b,
|
|
||||||
const char *astr,
|
|
||||||
const char *bstr);
|
|
||||||
void
|
|
||||||
litest_fail_comparison_ptr(const char *file,
|
|
||||||
int line,
|
|
||||||
const char *func,
|
|
||||||
const char *comparison);
|
|
||||||
|
|
||||||
#define litest_add(name_, func_, ...) \
|
#define litest_add(name_, func_, ...) \
|
||||||
_litest_add(name_, #func_, func_, __VA_ARGS__)
|
_litest_add(name_, #func_, func_, __VA_ARGS__)
|
||||||
#define litest_add_ranged(name_, func_, ...) \
|
#define litest_add_ranged(name_, func_, ...) \
|
||||||
|
|
@ -429,24 +447,6 @@ struct libevdev_uinput * litest_create_uinput_abs_device(const char *name,
|
||||||
struct input_id *id,
|
struct input_id *id,
|
||||||
const struct input_absinfo *abs,
|
const struct input_absinfo *abs,
|
||||||
...);
|
...);
|
||||||
#define litest_assert_double_eq(a_, b_)\
|
|
||||||
ck_assert_int_eq((int)((a_) * 256), (int)((b_) * 256))
|
|
||||||
|
|
||||||
#define litest_assert_double_ne(a_, b_)\
|
|
||||||
ck_assert_int_ne((int)((a_) * 256), (int)((b_) * 256))
|
|
||||||
|
|
||||||
#define litest_assert_double_lt(a_, b_)\
|
|
||||||
ck_assert_int_lt((int)((a_) * 256), (int)((b_) * 256))
|
|
||||||
|
|
||||||
#define litest_assert_double_le(a_, b_)\
|
|
||||||
ck_assert_int_le((int)((a_) * 256), (int)((b_) * 256))
|
|
||||||
|
|
||||||
#define litest_assert_double_gt(a_, b_)\
|
|
||||||
ck_assert_int_gt((int)((a_) * 256), (int)((b_) * 256))
|
|
||||||
|
|
||||||
#define litest_assert_double_ge(a_, b_)\
|
|
||||||
ck_assert_int_ge((int)((a_) * 256), (int)((b_) * 256))
|
|
||||||
|
|
||||||
void litest_timeout_tap(void);
|
void litest_timeout_tap(void);
|
||||||
void litest_timeout_tapndrag(void);
|
void litest_timeout_tapndrag(void);
|
||||||
void litest_timeout_softbuttons(void);
|
void litest_timeout_softbuttons(void);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue