]> git.meshlink.io Git - meshlink/blobdiff - test/utils.h
Add a test for a constellation of three nodes.
[meshlink] / test / utils.h
index e1073df8f7e8468c1ee0936dc7d0c0c6323c912f..488721dd37af86748e9642879cad1da8588725d9 100644 (file)
@@ -25,5 +25,14 @@ extern void stop_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b);
 /// Stop and cleanup a pair of meshlink instances.
 extern void close_meshlink_pair(meshlink_handle_t *a, meshlink_handle_t *b, const char *prefix);
 
-#endif
+#define assert_after(cond, timeout) do {\
+       for(int i = 0; i++ <= timeout;) {\
+               if(cond)\
+                       break;\
+               if(i == timeout)\
+                       assert(cond);\
+               sleep(1);\
+       }\
+} while(0);
 
+#endif