diff options
Diffstat (limited to 'auto_tests/run_auto_test.h')
-rw-r--r-- | auto_tests/run_auto_test.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/auto_tests/run_auto_test.h b/auto_tests/run_auto_test.h index 47d9dc4a..8554a9be 100644 --- a/auto_tests/run_auto_test.h +++ b/auto_tests/run_auto_test.h | |||
@@ -39,7 +39,7 @@ static void iterate_all_wait(uint32_t tox_count, Tox **toxes, State *state, uint | |||
39 | } | 39 | } |
40 | 40 | ||
41 | /* Also actually sleep a little, to allow for local network processing */ | 41 | /* Also actually sleep a little, to allow for local network processing */ |
42 | c_sleep(20); | 42 | c_sleep(5); |
43 | } | 43 | } |
44 | 44 | ||
45 | static uint64_t get_state_clock_callback(Mono_Time *mono_time, void *user_data) | 45 | static uint64_t get_state_clock_callback(Mono_Time *mono_time, void *user_data) |
@@ -63,6 +63,9 @@ static void run_auto_test(uint32_t tox_count, void test(Tox **toxes, State *stat | |||
63 | Tox **toxes = (Tox **)calloc(tox_count, sizeof(Tox *)); | 63 | Tox **toxes = (Tox **)calloc(tox_count, sizeof(Tox *)); |
64 | State *state = (State *)calloc(tox_count, sizeof(State)); | 64 | State *state = (State *)calloc(tox_count, sizeof(State)); |
65 | 65 | ||
66 | ck_assert(toxes != nullptr); | ||
67 | ck_assert(state != nullptr); | ||
68 | |||
66 | for (uint32_t i = 0; i < tox_count; i++) { | 69 | for (uint32_t i = 0; i < tox_count; i++) { |
67 | state[i].index = i; | 70 | state[i].index = i; |
68 | toxes[i] = tox_new_log(nullptr, nullptr, &state[i].index); | 71 | toxes[i] = tox_new_log(nullptr, nullptr, &state[i].index); |
@@ -82,7 +85,9 @@ static void run_auto_test(uint32_t tox_count, void test(Tox **toxes, State *stat | |||
82 | 85 | ||
83 | uint8_t public_key[TOX_PUBLIC_KEY_SIZE]; | 86 | uint8_t public_key[TOX_PUBLIC_KEY_SIZE]; |
84 | tox_self_get_public_key(toxes[j], public_key); | 87 | tox_self_get_public_key(toxes[j], public_key); |
85 | tox_friend_add_norequest(toxes[i], public_key, nullptr); | 88 | Tox_Err_Friend_Add err; |
89 | tox_friend_add_norequest(toxes[i], public_key, &err); | ||
90 | ck_assert(err == TOX_ERR_FRIEND_ADD_OK); | ||
86 | } | 91 | } |
87 | } | 92 | } |
88 | } else { | 93 | } else { |
@@ -93,7 +98,9 @@ static void run_auto_test(uint32_t tox_count, void test(Tox **toxes, State *stat | |||
93 | if (i != j) { | 98 | if (i != j) { |
94 | uint8_t public_key[TOX_PUBLIC_KEY_SIZE]; | 99 | uint8_t public_key[TOX_PUBLIC_KEY_SIZE]; |
95 | tox_self_get_public_key(toxes[j], public_key); | 100 | tox_self_get_public_key(toxes[j], public_key); |
96 | tox_friend_add_norequest(toxes[i], public_key, nullptr); | 101 | Tox_Err_Friend_Add err; |
102 | tox_friend_add_norequest(toxes[i], public_key, &err); | ||
103 | ck_assert(err == TOX_ERR_FRIEND_ADD_OK); | ||
97 | } | 104 | } |
98 | } | 105 | } |
99 | } | 106 | } |
@@ -105,7 +112,9 @@ static void run_auto_test(uint32_t tox_count, void test(Tox **toxes, State *stat | |||
105 | const uint16_t dht_port = tox_self_get_udp_port(toxes[0], nullptr); | 112 | const uint16_t dht_port = tox_self_get_udp_port(toxes[0], nullptr); |
106 | 113 | ||
107 | for (uint32_t i = 1; i < tox_count; i++) { | 114 | for (uint32_t i = 1; i < tox_count; i++) { |
108 | tox_bootstrap(toxes[i], "localhost", dht_port, dht_key, nullptr); | 115 | Tox_Err_Bootstrap err; |
116 | tox_bootstrap(toxes[i], "localhost", dht_port, dht_key, &err); | ||
117 | ck_assert(err == TOX_ERR_BOOTSTRAP_OK); | ||
109 | } | 118 | } |
110 | 119 | ||
111 | do { | 120 | do { |