diff options
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/friends_test.c | 2 | ||||
-rw-r--r-- | auto_tests/messenger_test.c | 2 | ||||
-rw-r--r-- | auto_tests/tox_test.c | 15 |
3 files changed, 11 insertions, 8 deletions
diff --git a/auto_tests/friends_test.c b/auto_tests/friends_test.c index 5071319e..2448f97c 100644 --- a/auto_tests/friends_test.c +++ b/auto_tests/friends_test.c | |||
@@ -116,7 +116,7 @@ int parent_friend_request(DHT *dht) | |||
116 | return 0; | 116 | return 0; |
117 | } | 117 | } |
118 | 118 | ||
119 | void child_got_request(uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata) | 119 | void child_got_request(Messenger *m, uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata) |
120 | { | 120 | { |
121 | fputs("OK\nsending status to parent", stdout); | 121 | fputs("OK\nsending status to parent", stdout); |
122 | fflush(stdout); | 122 | fflush(stdout); |
diff --git a/auto_tests/messenger_test.c b/auto_tests/messenger_test.c index 0393e6d9..5e5f7b06 100644 --- a/auto_tests/messenger_test.c +++ b/auto_tests/messenger_test.c | |||
@@ -174,7 +174,7 @@ START_TEST(test_getself_name) | |||
174 | char nick_check[len]; | 174 | char nick_check[len]; |
175 | 175 | ||
176 | setname(m, (uint8_t *)nickname, len); | 176 | setname(m, (uint8_t *)nickname, len); |
177 | getself_name(m, (uint8_t *)nick_check, len); | 177 | getself_name(m, (uint8_t *)nick_check); |
178 | 178 | ||
179 | ck_assert_msg((memcmp(nickname, nick_check, len) == 0), | 179 | ck_assert_msg((memcmp(nickname, nick_check, len) == 0), |
180 | "getself_name failed to return the known name!\n" | 180 | "getself_name failed to return the known name!\n" |
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 5b033544..1b93a0d2 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -19,12 +19,13 @@ | |||
19 | #define c_sleep(x) usleep(1000*x) | 19 | #define c_sleep(x) usleep(1000*x) |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | void accept_friend_request(uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata) | 22 | void accept_friend_request(Tox *m, uint8_t *public_key, uint8_t *data, uint16_t length, void *userdata) |
23 | { | 23 | { |
24 | Tox *t = userdata; | 24 | if (*((uint32_t *)userdata) != 974536) |
25 | return; | ||
25 | 26 | ||
26 | if (length == 7 && memcmp("Gentoo", data, 7) == 0) { | 27 | if (length == 7 && memcmp("Gentoo", data, 7) == 0) { |
27 | tox_add_friend_norequest(t, public_key); | 28 | tox_add_friend_norequest(m, public_key); |
28 | } | 29 | } |
29 | } | 30 | } |
30 | uint32_t messages_received; | 31 | uint32_t messages_received; |
@@ -114,7 +115,8 @@ START_TEST(test_few_clients) | |||
114 | Tox *tox2 = tox_new(TOX_ENABLE_IPV6_DEFAULT); | 115 | Tox *tox2 = tox_new(TOX_ENABLE_IPV6_DEFAULT); |
115 | Tox *tox3 = tox_new(TOX_ENABLE_IPV6_DEFAULT); | 116 | Tox *tox3 = tox_new(TOX_ENABLE_IPV6_DEFAULT); |
116 | ck_assert_msg(tox1 || tox2 || tox3, "Failed to create 3 tox instances"); | 117 | ck_assert_msg(tox1 || tox2 || tox3, "Failed to create 3 tox instances"); |
117 | tox_callback_friend_request(tox2, accept_friend_request, tox2); | 118 | uint32_t to_compare = 974536; |
119 | tox_callback_friend_request(tox2, accept_friend_request, &to_compare); | ||
118 | uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; | 120 | uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; |
119 | tox_get_address(tox2, address); | 121 | tox_get_address(tox2, address); |
120 | int test = tox_add_friend(tox3, address, (uint8_t *)"Gentoo", 7); | 122 | int test = tox_add_friend(tox3, address, (uint8_t *)"Gentoo", 7); |
@@ -140,7 +142,7 @@ START_TEST(test_few_clients) | |||
140 | } | 142 | } |
141 | 143 | ||
142 | printf("tox clients connected\n"); | 144 | printf("tox clients connected\n"); |
143 | uint32_t to_compare = 974536; | 145 | to_compare = 974536; |
144 | tox_callback_friend_message(tox3, print_message, &to_compare); | 146 | tox_callback_friend_message(tox3, print_message, &to_compare); |
145 | tox_send_message(tox2, 0, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo")); | 147 | tox_send_message(tox2, 0, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo")); |
146 | 148 | ||
@@ -267,7 +269,8 @@ START_TEST(test_many_clients) | |||
267 | for (i = 0; i < NUM_TOXES; ++i) { | 269 | for (i = 0; i < NUM_TOXES; ++i) { |
268 | toxes[i] = tox_new(TOX_ENABLE_IPV6_DEFAULT); | 270 | toxes[i] = tox_new(TOX_ENABLE_IPV6_DEFAULT); |
269 | ck_assert_msg(toxes[i] != 0, "Failed to create tox instances %u", i); | 271 | ck_assert_msg(toxes[i] != 0, "Failed to create tox instances %u", i); |
270 | tox_callback_friend_request(toxes[i], accept_friend_request, toxes[i]); | 272 | uint32_t to_comp = 974536; |
273 | tox_callback_friend_request(toxes[i], accept_friend_request, &to_comp); | ||
271 | } | 274 | } |
272 | 275 | ||
273 | struct { | 276 | struct { |