mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-05 06:20:26 +01:00
test: Add litest_assert_double_*() macros
Converts two doubles to 24.8 fixed-width integers so assertions can be made with doubles in tests Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
204d1d7514
commit
9d96286a44
1 changed files with 17 additions and 0 deletions
|
|
@ -148,6 +148,23 @@ struct libevdev_uinput * litest_create_uinput_abs_device(const char *name,
|
|||
struct input_id *id,
|
||||
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))
|
||||
|
||||
#ifndef ck_assert_notnull
|
||||
#define ck_assert_notnull(ptr) ck_assert_ptr_ne(ptr, NULL)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue