51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
/* Modify this to change the logging level of Meshlink */
#define TEST_MESHLINK_LOG_LEVEL MESHLINK_DEBUG
static bool received;
static void receive(meshlink_handle_t *mesh, meshlink_node_t *src, const void *data, size_t len) {
+ (void)mesh;
+
const char *msg = data;
assert(len);
static bool bar_reachable;
static void status_cb(meshlink_handle_t *mesh, meshlink_node_t *node, bool reachable) {
+ (void)mesh;
+
if(!strcmp(node->name, "bar") && reachable) {
bar_reachable = true;
}
but when enabled foo node should not receive data
*/
bool test_steps_mesh_blacklist_01(void) {
- meshlink_destroy("blacklist_conf.1");
- meshlink_destroy("blacklist_conf.2");
+ assert(meshlink_destroy("blacklist_conf.1"));
+ assert(meshlink_destroy("blacklist_conf.2"));
// Open two new meshlink instance.
meshlink_handle_t *mesh1 = meshlink_open("blacklist_conf.1", "foo", "blacklist", DEV_CLASS_BACKBONE);
sleep(1);
assert(received);
- meshlink_blacklist(mesh1, bar);
+ assert(meshlink_blacklist(mesh1, bar));
received = false;
assert(meshlink_send(mesh2, foo, "test", 5));
// Clean up.
meshlink_close(mesh2);
meshlink_close(mesh1);
- meshlink_destroy("blacklist_conf.1");
- meshlink_destroy("blacklist_conf.2");
+ assert(meshlink_destroy("blacklist_conf.1"));
+ assert(meshlink_destroy("blacklist_conf.2"));
return true;
}
meshlink_blacklist API handles the invalid parameter when called by giving proper error number.
*/
bool test_steps_mesh_blacklist_02(void) {
- meshlink_destroy("blacklist_conf.3");
+ assert(meshlink_destroy("blacklist_conf.3"));
// Open two new meshlink instance.
meshlink_handle_t *mesh = meshlink_open("blacklist_conf.3", "foo", "blacklist", DEV_CLASS_BACKBONE);
assert(node);
// Passing NULL as mesh handle and node handle being some valid node handle
- meshlink_blacklist(NULL, node);
+ assert(!meshlink_blacklist(NULL, node));
assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
// Clean up.
meshlink_close(mesh);
- meshlink_destroy("blacklist_conf.3");
+ assert(meshlink_destroy("blacklist_conf.3"));
return true;
}
meshlink_blacklist API handles the invalid parameter when called by giving proper error number.
*/
bool test_steps_mesh_blacklist_03(void) {
- meshlink_destroy("blacklist_conf.4");
+ assert(meshlink_destroy("blacklist_conf.4"));
// Open two new meshlink instance.
meshlink_handle_t *mesh = meshlink_open("blacklist_conf.4", "foo", "blacklist", DEV_CLASS_BACKBONE);
assert(mesh != NULL);
// Passing NULL as node handle and mesh handle being some valid mesh handle value
- meshlink_blacklist(mesh, NULL);
+ assert(!meshlink_blacklist(mesh, NULL));
assert_int_equal(meshlink_errno, MESHLINK_EINVAL);
// Clean up.
meshlink_close(mesh);
- meshlink_destroy("blacklist_conf.4");
+ assert(meshlink_destroy("blacklist_conf.4"));
return true;
}