diff options
Diffstat (limited to 'auto_tests/set_name_test.c')
-rw-r--r-- | auto_tests/set_name_test.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/auto_tests/set_name_test.c b/auto_tests/set_name_test.c index f8f94047..1e35aa30 100644 --- a/auto_tests/set_name_test.c +++ b/auto_tests/set_name_test.c | |||
@@ -49,22 +49,22 @@ static void test_set_name(void) | |||
49 | 49 | ||
50 | tox_bootstrap(tox2, "localhost", dht_port, dht_key, nullptr); | 50 | tox_bootstrap(tox2, "localhost", dht_port, dht_key, nullptr); |
51 | 51 | ||
52 | while (tox_self_get_connection_status(tox1) == TOX_CONNECTION_NONE || | 52 | do { |
53 | tox_self_get_connection_status(tox2) == TOX_CONNECTION_NONE) { | ||
54 | tox_iterate(tox1, nullptr); | 53 | tox_iterate(tox1, nullptr); |
55 | tox_iterate(tox2, nullptr); | 54 | tox_iterate(tox2, nullptr); |
56 | c_sleep(ITERATION_INTERVAL); | 55 | c_sleep(ITERATION_INTERVAL); |
57 | } | 56 | } while (tox_self_get_connection_status(tox1) == TOX_CONNECTION_NONE || |
57 | tox_self_get_connection_status(tox2) == TOX_CONNECTION_NONE); | ||
58 | 58 | ||
59 | printf("toxes are online, took %lu seconds\n", (unsigned long)(time(nullptr) - cur_time)); | 59 | printf("toxes are online, took %lu seconds\n", (unsigned long)(time(nullptr) - cur_time)); |
60 | const time_t con_time = time(nullptr); | 60 | const time_t con_time = time(nullptr); |
61 | 61 | ||
62 | while (tox_friend_get_connection_status(tox1, 0, nullptr) != TOX_CONNECTION_UDP || | 62 | do { |
63 | tox_friend_get_connection_status(tox2, 0, nullptr) != TOX_CONNECTION_UDP) { | ||
64 | tox_iterate(tox1, nullptr); | 63 | tox_iterate(tox1, nullptr); |
65 | tox_iterate(tox2, nullptr); | 64 | tox_iterate(tox2, nullptr); |
66 | c_sleep(ITERATION_INTERVAL); | 65 | c_sleep(ITERATION_INTERVAL); |
67 | } | 66 | } while (tox_friend_get_connection_status(tox1, 0, nullptr) != TOX_CONNECTION_UDP || |
67 | tox_friend_get_connection_status(tox2, 0, nullptr) != TOX_CONNECTION_UDP); | ||
68 | 68 | ||
69 | printf("tox clients connected took %lu seconds\n", (unsigned long)(time(nullptr) - con_time)); | 69 | printf("tox clients connected took %lu seconds\n", (unsigned long)(time(nullptr) - con_time)); |
70 | 70 | ||
@@ -75,11 +75,11 @@ static void test_set_name(void) | |||
75 | 75 | ||
76 | bool nickname_updated = false; | 76 | bool nickname_updated = false; |
77 | 77 | ||
78 | while (!nickname_updated) { | 78 | do { |
79 | tox_iterate(tox1, nullptr); | 79 | tox_iterate(tox1, nullptr); |
80 | tox_iterate(tox2, &nickname_updated); | 80 | tox_iterate(tox2, &nickname_updated); |
81 | c_sleep(ITERATION_INTERVAL); | 81 | c_sleep(ITERATION_INTERVAL); |
82 | } | 82 | } while (!nickname_updated); |
83 | 83 | ||
84 | ck_assert_msg(tox_friend_get_name_size(tox2, 0, nullptr) == sizeof(NICKNAME), "Name length not correct"); | 84 | ck_assert_msg(tox_friend_get_name_size(tox2, 0, nullptr) == sizeof(NICKNAME), "Name length not correct"); |
85 | uint8_t temp_name[sizeof(NICKNAME)]; | 85 | uint8_t temp_name[sizeof(NICKNAME)]; |