Debian Codegraph @

tests/cbd-test.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2025 The Phosh.mobi e.V.
3 *
4 * SPDX-License-Identifier: GPL-3.0+
5 */
6
7 #pragma once
8
9 #include "cbd-channel-manager.h"
10
11 #include <glib.h>
12
13 G_BEGIN_DECLS
14
15 #define cbd_assert_cmp_channel_range(e, t) G_STMT_START { \
16 g_test_message ("Checking %d, %d-%d", t.level, t.start, t.end); \
17 if (e.level != t.level) { \
18 g_autofree char *__msg = \
19 g_strdup_printf ("Level %d != %d of element %d ", e.level, t.level, i); \
20 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
21 } \
22 if (e.start != t.start) { \
23 g_autofree char *__msg = \
24 g_strdup_printf ("Start channel %d != %d of element %d ", e.start, t.start, i); \
25 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
26 } \
27 if (e.end != t.end) { \
28 g_autofree char *__msg = \
29 g_strdup_printf ("End channel %d != %d of element %d ", e.end, t.end, i); \
30 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
31 } \
32 } G_STMT_END
33
34 #define cbd_assert_cmp_channels(c, e) G_STMT_START { \
35 if (c->len != e->len) { \
36 g_autofree char *__msg = \
37 g_strdup_printf ("Arrays don't have same size: %d != %d", c->len, e->len); \
38 g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
39 } \
40 for (int i = 0; i < e->len; i++) { \
41 CbdChannelsRange __range = g_array_index (c, CbdChannelsRange, i); \
42 CbdChannelsRange __expected = g_array_index (e, CbdChannelsRange, i); \
43 cbd_assert_cmp_channel_range (__range, __expected); \
44 } \
45 } G_STMT_END
46
47
48 GArray *cbd_test_channels_get_expected (const char *country);
49
50 G_END_DECLS