summaryrefslogtreecommitdiff
path: root/auto_tests/conference_test.c
diff options
context:
space:
mode:
authorhugbubby <hugbubby@protonmail.com>2018-07-15 18:12:16 -0700
committerhugbubby <hugbubby@protonmail.com>2018-07-18 13:55:30 -0700
commita592f0fa87c96f1c2dea1406e4dcbfa5cde4f8f1 (patch)
treec81dafd7a0cc359e66e0ba2b1aa09f9b123c0b0d /auto_tests/conference_test.c
parent864d1c15e4a3b8df236af320312e8115c6bcd791 (diff)
Wrong use of unsigned integer.
Diffstat (limited to 'auto_tests/conference_test.c')
-rw-r--r--auto_tests/conference_test.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/auto_tests/conference_test.c b/auto_tests/conference_test.c
index 374274b8..706dad38 100644
--- a/auto_tests/conference_test.c
+++ b/auto_tests/conference_test.c
@@ -68,7 +68,7 @@ static void handle_conference_invite(
68 68
69 if (tox_self_get_friend_list_size(tox) > 1) { 69 if (tox_self_get_friend_list_size(tox) > 1) {
70 printf("tox #%d: inviting next friend\n", id); 70 printf("tox #%d: inviting next friend\n", id);
71 ck_assert_msg(tox_conference_invite(tox, 1, g_num, nullptr) != 0, "Failed to invite friend"); 71 ck_assert_msg(tox_conference_invite(tox, 1, g_num, nullptr) != 0, "failed to invite friend");
72 } else { 72 } else {
73 printf("tox #%d was the last tox, no further invites happening\n", id); 73 printf("tox #%d was the last tox, no further invites happening\n", id);
74 } 74 }
@@ -95,9 +95,9 @@ static void run_conference_tests(Tox **toxes, uint32_t *tox_index)
95 ck_assert_msg( 95 ck_assert_msg(
96 tox_conference_send_message( 96 tox_conference_send_message(
97 toxes[random_u32() % NUM_GROUP_TOX], 0, TOX_MESSAGE_TYPE_NORMAL, (const uint8_t *)GROUP_MESSAGE, 97 toxes[random_u32() % NUM_GROUP_TOX], 0, TOX_MESSAGE_TYPE_NORMAL, (const uint8_t *)GROUP_MESSAGE,
98 sizeof(GROUP_MESSAGE) - 1, &err) != 0, "Failed to send group message."); 98 sizeof(GROUP_MESSAGE) - 1, &err) != 0, "failed to send group message");
99 ck_assert_msg( 99 ck_assert_msg(
100 err == TOX_ERR_CONFERENCE_SEND_MESSAGE_OK, "Failed to send group message."); 100 err == TOX_ERR_CONFERENCE_SEND_MESSAGE_OK, "failed to send group message");
101 num_recv = 0; 101 num_recv = 0;
102 102
103 for (uint8_t j = 0; j < 20; ++j) { 103 for (uint8_t j = 0; j < 20; ++j) {
@@ -109,7 +109,7 @@ static void run_conference_tests(Tox **toxes, uint32_t *tox_index)
109 } 109 }
110 110
111 c_sleep(25); 111 c_sleep(25);
112 ck_assert_msg(num_recv == NUM_GROUP_TOX, "Failed to recv group messages."); 112 ck_assert_msg(num_recv == NUM_GROUP_TOX, "failed to recv group messages");
113 113
114 for (uint16_t k = NUM_GROUP_TOX; k != 0 ; --k) { 114 for (uint16_t k = NUM_GROUP_TOX; k != 0 ; --k) {
115 tox_conference_delete(toxes[k - 1], 0, nullptr); 115 tox_conference_delete(toxes[k - 1], 0, nullptr);
@@ -149,7 +149,7 @@ static void test_many_group(void)
149 tox_index[i] = i + 1; 149 tox_index[i] = i + 1;
150 toxes[i] = tox_new_log(opts, &err, &tox_index[i]); 150 toxes[i] = tox_new_log(opts, &err, &tox_index[i]);
151 151
152 ck_assert_msg(toxes[i] != nullptr, "Failed to create tox instance %u: error %d", i, err); 152 ck_assert_msg(toxes[i] != nullptr, "failed to create tox instance %u: error %d", i, err);
153 tox_callback_self_connection_status(toxes[i], &handle_self_connection_status); 153 tox_callback_self_connection_status(toxes[i], &handle_self_connection_status);
154 tox_callback_friend_connection_status(toxes[i], &handle_friend_connection_status); 154 tox_callback_friend_connection_status(toxes[i], &handle_friend_connection_status);
155 tox_callback_conference_invite(toxes[i], &handle_conference_invite); 155 tox_callback_conference_invite(toxes[i], &handle_conference_invite);
@@ -173,11 +173,11 @@ static void test_many_group(void)
173 173
174 tox_self_get_public_key(toxes[i - 1], key); 174 tox_self_get_public_key(toxes[i - 1], key);
175 tox_friend_add_norequest(toxes[i], key, &err); 175 tox_friend_add_norequest(toxes[i], key, &err);
176 ck_assert_msg(err == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend: error %d", err); 176 ck_assert_msg(err == TOX_ERR_FRIEND_ADD_OK, "failed to add friend: error %d", err);
177 177
178 tox_self_get_public_key(toxes[i], key); 178 tox_self_get_public_key(toxes[i], key);
179 tox_friend_add_norequest(toxes[i - 1], key, &err); 179 tox_friend_add_norequest(toxes[i - 1], key, &err);
180 ck_assert_msg(err == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend: error %d", err); 180 ck_assert_msg(err == TOX_ERR_FRIEND_ADD_OK, "failed to add friend: error %d", err);
181 } 181 }
182 182
183 printf("waiting for everyone to come online\n"); 183 printf("waiting for everyone to come online\n");
@@ -197,13 +197,13 @@ static void test_many_group(void)
197 c_sleep(1000); 197 c_sleep(1000);
198 } 198 }
199 199
200 printf("friends connected, took %d seconds\n", (uint16_t)(time(nullptr) - cur_time)); 200 printf("friends connected, took %d seconds\n", (int)(time(nullptr) - cur_time));
201 201
202 ck_assert_msg(tox_conference_new(toxes[0], nullptr) != UINT32_MAX, "Failed to create group"); 202 ck_assert_msg(tox_conference_new(toxes[0], nullptr) != UINT32_MAX, "failed to create group");
203 printf("tox #%d: inviting its first friend\n", tox_index[0]); 203 printf("tox #%d: inviting its first friend\n", tox_index[0]);
204 ck_assert_msg(tox_conference_invite(toxes[0], 0, 0, nullptr) != 0, "Failed to invite friend"); 204 ck_assert_msg(tox_conference_invite(toxes[0], 0, 0, nullptr) != 0, "failed to invite friend");
205 ck_assert_msg(tox_conference_set_title(toxes[0], 0, (const uint8_t *)"Gentoo", sizeof("Gentoo") - 1, nullptr) != 0, 205 ck_assert_msg(tox_conference_set_title(toxes[0], 0, (const uint8_t *)"Gentoo", sizeof("Gentoo") - 1, nullptr) != 0,
206 "Failed to set group title"); 206 "failed to set group title");
207 207
208 // One iteration for all the invitations to happen. 208 // One iteration for all the invitations to happen.
209 for (uint16_t i = 0; i < NUM_GROUP_TOX; ++i) { 209 for (uint16_t i = 0; i < NUM_GROUP_TOX; ++i) {
@@ -250,7 +250,7 @@ static void test_many_group(void)
250 ck_assert_msg(memcmp("Gentoo", title, ret) == 0, "Wrong title"); 250 ck_assert_msg(memcmp("Gentoo", title, ret) == 0, "Wrong title");
251 } 251 }
252 252
253 printf("group connected, took %d seconds\n", (uint16_t)(time(nullptr) - cur_time)); 253 printf("group connected, took %d seconds\n", (int)(time(nullptr) - cur_time));
254 254
255 run_conference_tests(toxes, tox_index); 255 run_conference_tests(toxes, tox_index);
256 256
@@ -260,7 +260,7 @@ static void test_many_group(void)
260 tox_kill(toxes[i]); 260 tox_kill(toxes[i]);
261 } 261 }
262 262
263 printf("test_many_group succeeded, took %d seconds\n", (uint16_t)(time(nullptr) - test_start_time)); 263 printf("test_many_group succeeded, took %d seconds\n", (int)(time(nullptr) - test_start_time));
264} 264}
265 265
266int main(void) 266int main(void)