1 #ifndef MESHLINK_TEST_UTILS_H
2 #define MESHLINK_TEST_UTILS_H
4 #include "../src/meshlink.h"
6 // Simple synchronisation between threads
13 extern void set_sync_flag(struct sync_flag *s, bool value);
14 extern bool wait_sync_flag(struct sync_flag *s, int seconds);
16 /// Create a pair of meshlink instances that are already joined together.
17 extern void open_meshlink_pair(meshlink_handle_t **a, meshlink_handle_t **b, const char *prefix);
19 /// Start a pair of meshlink instances and wait for them to connect together.
20 extern void start_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b);
22 /// Stop a pair of meshlink instances.
23 extern void stop_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b);
25 /// Stop and cleanup a pair of meshlink instances.
26 extern void close_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b, const char *prefix);
28 #define assert_after(cond, timeout)\
30 for(int i = 0; i++ <= timeout;) {\