shared: add weston_assert_false()
Complement to weston_assert_true(), to avoid having to use !. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
c310516d1d
commit
cd622900ee
@ -7662,7 +7662,7 @@ WL_EXPORT void
|
||||
weston_output_set_eotf_mode(struct weston_output *output,
|
||||
enum weston_eotf_mode eotf_mode)
|
||||
{
|
||||
assert(!output->enabled);
|
||||
weston_assert_false(output->compositor, output->enabled);
|
||||
|
||||
output->eotf_mode = eotf_mode;
|
||||
}
|
||||
|
@ -85,6 +85,9 @@ do { \
|
||||
#define weston_assert_true(compositor, a) \
|
||||
weston_assert_(compositor, a, true, bool, "%d", ==)
|
||||
|
||||
#define weston_assert_false(compositor, a) \
|
||||
weston_assert_(compositor, a, false, bool, "%d", ==)
|
||||
|
||||
#define weston_assert_ptr(compositor, a) \
|
||||
weston_assert_(compositor, a, NULL, const void *, "%p", !=)
|
||||
|
||||
|
@ -86,6 +86,12 @@ TEST(asserts)
|
||||
ret = weston_assert_true(compositor, true);
|
||||
abort_if_not(ret);
|
||||
|
||||
ret = weston_assert_false(compositor, true);
|
||||
abort_if_not(ret == false);
|
||||
|
||||
ret = weston_assert_false(compositor, false);
|
||||
abort_if_not(ret);
|
||||
|
||||
ret = weston_assert_true(compositor, true && false);
|
||||
abort_if_not(ret == false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user