51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
#include "execute_tests.h"
#include "test_cases_invite.h"
#include "../common/containers.h"
Generates an invitation
*/
static bool test_invite_01(void) {
- meshlink_destroy("inviteconf");
+ assert(meshlink_destroy("inviteconf"));
meshlink_set_log_cb(NULL, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
// Create meshlink instance
assert(mesh_handle);
meshlink_set_log_cb(mesh_handle, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
- char *invitation = meshlink_invite(mesh_handle, "new");
+ char *invitation = meshlink_invite(mesh_handle, NULL, "new");
assert_int_equal(invitation, NULL);
free(invitation);
meshlink_close(mesh_handle);
- meshlink_destroy("inviteconf");
+ assert(meshlink_destroy("inviteconf"));
return true;
}
*/
static bool test_invite_02(void) {
// Trying to generate INVITATION by passing NULL as mesh link handle
- char *invitation = meshlink_invite(NULL, "nut");
+ char *invitation = meshlink_invite(NULL, NULL, "nut");
assert_int_equal(invitation, NULL);
return true;
Reports appropriate error by returning NULL
*/
static bool test_invite_03(void) {
- meshlink_destroy("inviteconf");
+ assert(meshlink_destroy("inviteconf"));
meshlink_set_log_cb(NULL, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
// Create meshlink instance
meshlink_set_log_cb(mesh_handle, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
// Trying to generate INVITATION by passing NULL as mesh link handle
- char *invitation = meshlink_invite(mesh_handle, NULL);
+ char *invitation = meshlink_invite(mesh_handle, NULL, NULL);
assert_int_equal(invitation, NULL);
meshlink_close(mesh_handle);
- meshlink_destroy("inviteconf");
+ assert(meshlink_destroy("inviteconf"));
return true;
}
Newly added address should be there in the invitation.
*/
static bool test_invite_04(void) {
- meshlink_destroy("inviteconf");
+ assert(meshlink_destroy("inviteconf"));
meshlink_set_log_cb(NULL, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
// Create meshlink instance
meshlink_set_log_cb(mesh_handle, TEST_MESHLINK_LOG_LEVEL, meshlink_callback_logger);
char *hostname1 = "127.1.1.1";
- bool ret = meshlink_add_address(mesh_handle, hostname1);
- char *invitation = meshlink_invite(mesh_handle, "foo");
+ assert(meshlink_add_address(mesh_handle, hostname1));
+ char *invitation = meshlink_invite(mesh_handle, NULL, "foo");
assert_int_not_equal(strstr(invitation, hostname1), NULL);
char *hostname2 = "127.1.2.3";
- ret = meshlink_add_address(mesh_handle, hostname2);
- invitation = meshlink_invite(mesh_handle, "bar");
+ assert(meshlink_add_address(mesh_handle, hostname2));
+ invitation = meshlink_invite(mesh_handle, NULL, "bar");
// Verify we have both the added addresses
assert_int_not_equal(strstr(invitation, hostname1), NULL);
assert_int_not_equal(strstr(invitation, hostname2), NULL);
meshlink_close(mesh_handle);
- meshlink_destroy("inviteconf");
+ assert(meshlink_destroy("inviteconf"));
return true;
}