From 724e13b346990be85c4bc332c78f29ed7ce83121 Mon Sep 17 00:00:00 2001 From: igo95862 Date: Fri, 10 Jun 2022 20:51:04 +0300 Subject: test-bus-objects: Test GetManagedObjects interfaces are correct Objects without ObjectManager should not have `org.freedesktop.DBus.ObjectManager` interface. Object with ObjectManager should do. Also added ASSERT_SE_NONNEG and ASSERT_NONNEG macros. --- src/fundamental/macro-fundamental.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/fundamental') diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h index 7cc34b6f1a..e5f6dc7f8c 100644 --- a/src/fundamental/macro-fundamental.h +++ b/src/fundamental/macro-fundamental.h @@ -95,6 +95,20 @@ _expr_; \ }) +#define ASSERT_NONNEG(expr) \ + ({ \ + typeof(expr) _expr_ = (expr), _zero = 0; \ + assert(_expr_ >= _zero); \ + _expr_; \ + }) + +#define ASSERT_SE_NONNEG(expr) \ + ({ \ + typeof(expr) _expr_ = (expr), _zero = 0; \ + assert_se(_expr_ >= _zero); \ + _expr_; \ + }) + #define assert_cc(expr) static_assert(expr, #expr) -- cgit v1.2.1