diff options
| author | Michael Biebl <biebl@debian.org> | 2018-05-11 22:08:45 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-05-11 22:08:45 +0200 |
| commit | ee9c73a923909e23a649407be77e25235d769e25 (patch) | |
| tree | e21c923621fa278e737da693df9eb60ea31a6067 /src/platform/tests/test-nmp-object.c | |
| parent | f60117b41d5433be1b4a96d82cd11d0c3dce9b63 (diff) | |
New upstream version 1.10.8 upstream/1.10.8
Diffstat (limited to 'src/platform/tests/test-nmp-object.c')
| -rw-r--r-- | src/platform/tests/test-nmp-object.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/platform/tests/test-nmp-object.c b/src/platform/tests/test-nmp-object.c index 047d7a85..3228de83 100644 --- a/src/platform/tests/test-nmp-object.c +++ b/src/platform/tests/test-nmp-object.c @@ -54,20 +54,27 @@ test_obj_base (void) gs_unref_object GCancellable *obj_cancellable = g_cancellable_new (); nm_auto_nmpobj NMPObject *obj_link = nmp_object_new_link (10); - g_assert (&g->g_type_instance == (void *) &o->_class); - g_assert (&g->g_type_instance.g_class == (void *) &o->_class); +#define STATIC_ASSERT(cond) \ + G_STMT_START { \ + G_STATIC_ASSERT (cond); \ + G_STATIC_ASSERT_EXPR (cond); \ + g_assert (cond); \ + } G_STMT_END - g_assert (sizeof (o->parent.parent) == sizeof (GTypeInstance)); + STATIC_ASSERT (&g->g_type_instance == (void *) &o->_class); + STATIC_ASSERT (&g->g_type_instance.g_class == (void *) &o->_class); - g_assert (&c->parent == (void *) c); - g_assert (&c->parent.parent.g_type_class == (void *) c); - g_assert (&c->parent.parent.g_type == (void *) c); - g_assert (&c->parent.parent.g_type == &k->g_type); + STATIC_ASSERT (sizeof (o->parent.parent) == sizeof (GTypeInstance)); - g_assert (sizeof (c->parent.parent) == sizeof (GTypeClass)); + STATIC_ASSERT (&c->parent == (void *) c); + STATIC_ASSERT (&c->parent.parent.g_type_class == (void *) c); + STATIC_ASSERT (&c->parent.parent.g_type == (void *) c); + STATIC_ASSERT (&c->parent.parent.g_type == &k->g_type); - g_assert (&o->parent == (void *) o); - g_assert (&o->parent.klass == (void *) &o->_class); + STATIC_ASSERT (sizeof (c->parent.parent) == sizeof (GTypeClass)); + + STATIC_ASSERT (&o->parent == (void *) o); + STATIC_ASSERT (&o->parent.klass == (void *) &o->_class); obj = (NMObjBaseInst *) obj_cancellable; g_assert (!NMP_CLASS_IS_VALID ((NMPClass *) obj->klass)); |