summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/av_test.c18
-rw-r--r--testing/misc_tools.c8
-rw-r--r--testing/misc_tools.h6
-rw-r--r--testing/random_testing.cc28
4 files changed, 30 insertions, 30 deletions
diff --git a/testing/av_test.c b/testing/av_test.c
index a058e869..7dba399b 100644
--- a/testing/av_test.c
+++ b/testing/av_test.c
@@ -245,7 +245,7 @@ static void initialize_tox(Tox **bootstrap, ToxAV **AliceAV, CallControl *AliceC
245 tox_options_set_ipv6_enabled(opts, false); 245 tox_options_set_ipv6_enabled(opts, false);
246 246
247 { 247 {
248 TOX_ERR_NEW error; 248 Tox_Err_New error;
249 249
250 tox_options_set_start_port(opts, 33445); 250 tox_options_set_start_port(opts, 33445);
251 *bootstrap = tox_new(opts, &error); 251 *bootstrap = tox_new(opts, &error);
@@ -298,7 +298,7 @@ static void initialize_tox(Tox **bootstrap, ToxAV **AliceAV, CallControl *AliceC
298 } 298 }
299 299
300 300
301 TOXAV_ERR_NEW rc; 301 Toxav_Err_New rc;
302 *AliceAV = toxav_new(Alice, &rc); 302 *AliceAV = toxav_new(Alice, &rc);
303 assert(rc == TOXAV_ERR_NEW_OK); 303 assert(rc == TOXAV_ERR_NEW_OK);
304 304
@@ -590,7 +590,7 @@ CHECK_ARG:
590 BobCC.arb = rb_new(16); 590 BobCC.arb = rb_new(16);
591 591
592 { /* Call */ 592 { /* Call */
593 TOXAV_ERR_CALL rc; 593 Toxav_Err_Call rc;
594 toxav_call(AliceAV, 0, 48, 0, &rc); 594 toxav_call(AliceAV, 0, 48, 0, &rc);
595 595
596 if (rc != TOXAV_ERR_CALL_OK) { 596 if (rc != TOXAV_ERR_CALL_OK) {
@@ -604,7 +604,7 @@ CHECK_ARG:
604 } 604 }
605 605
606 { /* Answer */ 606 { /* Answer */
607 TOXAV_ERR_ANSWER rc; 607 Toxav_Err_Answer rc;
608 toxav_answer(BobAV, 0, 48, 0, &rc); 608 toxav_answer(BobAV, 0, 48, 0, &rc);
609 609
610 if (rc != TOXAV_ERR_ANSWER_OK) { 610 if (rc != TOXAV_ERR_ANSWER_OK) {
@@ -677,7 +677,7 @@ CHECK_ARG:
677 int64_t count = sf_read_short(af_handle, PCM, frame_size); 677 int64_t count = sf_read_short(af_handle, PCM, frame_size);
678 678
679 if (count > 0) { 679 if (count > 0) {
680 TOXAV_ERR_SEND_FRAME rc; 680 Toxav_Err_Send_Frame rc;
681 681
682 if (toxav_audio_send_frame(AliceAV, 0, PCM, count / af_info.channels, af_info.channels, af_info.samplerate, 682 if (toxav_audio_send_frame(AliceAV, 0, PCM, count / af_info.channels, af_info.channels, af_info.samplerate,
683 &rc) == false) { 683 &rc) == false) {
@@ -695,7 +695,7 @@ CHECK_ARG:
695 sf_close(af_handle); 695 sf_close(af_handle);
696 696
697 { /* Hangup */ 697 { /* Hangup */
698 TOXAV_ERR_CALL_CONTROL rc; 698 Toxav_Err_Call_Control rc;
699 toxav_call_control(AliceAV, 0, TOXAV_CALL_CONTROL_CANCEL, &rc); 699 toxav_call_control(AliceAV, 0, TOXAV_CALL_CONTROL_CANCEL, &rc);
700 700
701 if (rc != TOXAV_ERR_CALL_CONTROL_OK) { 701 if (rc != TOXAV_ERR_CALL_CONTROL_OK) {
@@ -737,7 +737,7 @@ CHECK_ARG:
737 memset(&BobCC, 0, sizeof(CallControl)); 737 memset(&BobCC, 0, sizeof(CallControl));
738 738
739 { /* Call */ 739 { /* Call */
740 TOXAV_ERR_CALL rc; 740 Toxav_Err_Call rc;
741 toxav_call(AliceAV, 0, 0, 2000, &rc); 741 toxav_call(AliceAV, 0, 0, 2000, &rc);
742 742
743 if (rc != TOXAV_ERR_CALL_OK) { 743 if (rc != TOXAV_ERR_CALL_OK) {
@@ -751,7 +751,7 @@ CHECK_ARG:
751 } 751 }
752 752
753 { /* Answer */ 753 { /* Answer */
754 TOXAV_ERR_ANSWER rc; 754 Toxav_Err_Answer rc;
755 toxav_answer(BobAV, 0, 0, 5000, &rc); 755 toxav_answer(BobAV, 0, 0, 5000, &rc);
756 756
757 if (rc != TOXAV_ERR_ANSWER_OK) { 757 if (rc != TOXAV_ERR_ANSWER_OK) {
@@ -801,7 +801,7 @@ CHECK_ARG:
801 cvReleaseCapture(&capture); 801 cvReleaseCapture(&capture);
802 802
803 { /* Hangup */ 803 { /* Hangup */
804 TOXAV_ERR_CALL_CONTROL rc; 804 Toxav_Err_Call_Control rc;
805 toxav_call_control(AliceAV, 0, TOXAV_CALL_CONTROL_CANCEL, &rc); 805 toxav_call_control(AliceAV, 0, TOXAV_CALL_CONTROL_CANCEL, &rc);
806 806
807 if (rc != TOXAV_ERR_CALL_CONTROL_OK) { 807 if (rc != TOXAV_ERR_CALL_CONTROL_OK) {
diff --git a/testing/misc_tools.c b/testing/misc_tools.c
index 360d7a35..8991a222 100644
--- a/testing/misc_tools.c
+++ b/testing/misc_tools.c
@@ -155,7 +155,7 @@ int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled)
155 return argvoffset; 155 return argvoffset;
156} 156}
157 157
158static const char *tox_log_level_name(TOX_LOG_LEVEL level) 158static const char *tox_log_level_name(Tox_Log_Level level)
159{ 159{
160 switch (level) { 160 switch (level) {
161 case TOX_LOG_LEVEL_TRACE: 161 case TOX_LOG_LEVEL_TRACE:
@@ -177,7 +177,7 @@ static const char *tox_log_level_name(TOX_LOG_LEVEL level)
177 return "<unknown>"; 177 return "<unknown>";
178} 178}
179 179
180void print_debug_log(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t line, const char *func, 180void print_debug_log(Tox *m, Tox_Log_Level level, const char *file, uint32_t line, const char *func,
181 const char *message, void *user_data) 181 const char *message, void *user_data)
182{ 182{
183 if (level == TOX_LOG_LEVEL_TRACE) { 183 if (level == TOX_LOG_LEVEL_TRACE) {
@@ -188,7 +188,7 @@ void print_debug_log(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t lin
188 fprintf(stderr, "[#%u] %s %s:%u\t%s:\t%s\n", index, tox_log_level_name(level), file, line, func, message); 188 fprintf(stderr, "[#%u] %s %s:%u\t%s:\t%s\n", index, tox_log_level_name(level), file, line, func, message);
189} 189}
190 190
191Tox *tox_new_log_lan(struct Tox_Options *options, TOX_ERR_NEW *err, void *log_user_data, bool lan_discovery) 191Tox *tox_new_log_lan(struct Tox_Options *options, Tox_Err_New *err, void *log_user_data, bool lan_discovery)
192{ 192{
193 struct Tox_Options *log_options = options; 193 struct Tox_Options *log_options = options;
194 194
@@ -212,7 +212,7 @@ Tox *tox_new_log_lan(struct Tox_Options *options, TOX_ERR_NEW *err, void *log_us
212 return tox; 212 return tox;
213} 213}
214 214
215Tox *tox_new_log(struct Tox_Options *options, TOX_ERR_NEW *err, void *log_user_data) 215Tox *tox_new_log(struct Tox_Options *options, Tox_Err_New *err, void *log_user_data)
216{ 216{
217 return tox_new_log_lan(options, err, log_user_data, false); 217 return tox_new_log_lan(options, err, log_user_data, false);
218} 218}
diff --git a/testing/misc_tools.h b/testing/misc_tools.h
index 259525a5..e7060551 100644
--- a/testing/misc_tools.h
+++ b/testing/misc_tools.h
@@ -17,11 +17,11 @@ void to_hex(char *out, uint8_t *in, int size);
17int tox_strncasecmp(const char *s1, const char *s2, size_t n); 17int tox_strncasecmp(const char *s1, const char *s2, size_t n);
18int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled); 18int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled);
19 19
20void print_debug_log(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t line, const char *func, 20void print_debug_log(Tox *m, Tox_Log_Level level, const char *file, uint32_t line, const char *func,
21 const char *message, void *user_data); 21 const char *message, void *user_data);
22 22
23Tox *tox_new_log(struct Tox_Options *options, TOX_ERR_NEW *err, void *log_user_data); 23Tox *tox_new_log(struct Tox_Options *options, Tox_Err_New *err, void *log_user_data);
24Tox *tox_new_log_lan(struct Tox_Options *options, TOX_ERR_NEW *err, void *log_user_data, bool lan_discovery); 24Tox *tox_new_log_lan(struct Tox_Options *options, Tox_Err_New *err, void *log_user_data, bool lan_discovery);
25 25
26int use_test_rng(uint32_t seed); 26int use_test_rng(uint32_t seed);
27 27
diff --git a/testing/random_testing.cc b/testing/random_testing.cc
index 6211630e..463a4fb3 100644
--- a/testing/random_testing.cc
+++ b/testing/random_testing.cc
@@ -119,7 +119,7 @@ struct Global_State : std::vector<Local_State> {
119Global_State::~Global_State() {} 119Global_State::~Global_State() {}
120 120
121void handle_friend_connection_status(Tox *tox, uint32_t friend_number, 121void handle_friend_connection_status(Tox *tox, uint32_t friend_number,
122 TOX_CONNECTION connection_status, void *user_data) { 122 Tox_Connection connection_status, void *user_data) {
123 Local_State *state = static_cast<Local_State *>(user_data); 123 Local_State *state = static_cast<Local_State *>(user_data);
124 124
125 if (connection_status == TOX_CONNECTION_NONE) { 125 if (connection_status == TOX_CONNECTION_NONE) {
@@ -130,7 +130,7 @@ void handle_friend_connection_status(Tox *tox, uint32_t friend_number,
130 } 130 }
131} 131}
132 132
133void handle_conference_invite(Tox *tox, uint32_t friend_number, TOX_CONFERENCE_TYPE type, 133void handle_conference_invite(Tox *tox, uint32_t friend_number, Tox_Conference_Type type,
134 const uint8_t *cookie, size_t length, void *user_data) { 134 const uint8_t *cookie, size_t length, void *user_data) {
135 Local_State *state = static_cast<Local_State *>(user_data); 135 Local_State *state = static_cast<Local_State *>(user_data);
136 136
@@ -138,13 +138,13 @@ void handle_conference_invite(Tox *tox, uint32_t friend_number, TOX_CONFERENCE_T
138 std::printf("Tox #%u joins the conference it was invited to\n", state->id()); 138 std::printf("Tox #%u joins the conference it was invited to\n", state->id());
139 } 139 }
140 140
141 TOX_ERR_CONFERENCE_JOIN err; 141 Tox_Err_Conference_Join err;
142 tox_conference_join(tox, friend_number, cookie, length, &err); 142 tox_conference_join(tox, friend_number, cookie, length, &err);
143 assert(err == TOX_ERR_CONFERENCE_JOIN_OK); 143 assert(err == TOX_ERR_CONFERENCE_JOIN_OK);
144} 144}
145 145
146void handle_conference_message(Tox *tox, uint32_t conference_number, uint32_t peer_number, 146void handle_conference_message(Tox *tox, uint32_t conference_number, uint32_t peer_number,
147 TOX_MESSAGE_TYPE type, const uint8_t *message, size_t length, 147 Tox_Message_Type type, const uint8_t *message, size_t length,
148 void *user_data) { 148 void *user_data) {
149 Local_State *state = static_cast<Local_State *>(user_data); 149 Local_State *state = static_cast<Local_State *>(user_data);
150 150
@@ -161,7 +161,7 @@ void handle_conference_peer_list_changed(Tox *tox, uint32_t conference_number, v
161 std::printf("Tox #%u rebuilds peer list for conference %u\n", state->id(), conference_number); 161 std::printf("Tox #%u rebuilds peer list for conference %u\n", state->id(), conference_number);
162 } 162 }
163 163
164 TOX_ERR_CONFERENCE_PEER_QUERY err; 164 Tox_Err_Conference_Peer_Query err;
165 uint32_t const count = tox_conference_peer_count(tox, conference_number, &err); 165 uint32_t const count = tox_conference_peer_count(tox, conference_number, &err);
166 assert(err == TOX_ERR_CONFERENCE_PEER_QUERY_OK); 166 assert(err == TOX_ERR_CONFERENCE_PEER_QUERY_OK);
167 167
@@ -182,7 +182,7 @@ Global_State make_toxes(std::vector<Action> const &actions) {
182 tox_options_set_local_discovery_enabled(options.get(), false); 182 tox_options_set_local_discovery_enabled(options.get(), false);
183 183
184 for (uint32_t i = 0; i < NUM_TOXES; i++) { 184 for (uint32_t i = 0; i < NUM_TOXES; i++) {
185 TOX_ERR_NEW err; 185 Tox_Err_New err;
186 toxes.emplace_back(Tox_Ptr(tox_new(options.get(), &err)), i); 186 toxes.emplace_back(Tox_Ptr(tox_new(options.get(), &err)), i);
187 assert(err == TOX_ERR_NEW_OK); 187 assert(err == TOX_ERR_NEW_OK);
188 assert(toxes.back().tox() != nullptr); 188 assert(toxes.back().tox() != nullptr);
@@ -201,7 +201,7 @@ Global_State make_toxes(std::vector<Action> const &actions) {
201 const uint16_t dht_port = tox_self_get_udp_port(toxes.front().tox(), nullptr); 201 const uint16_t dht_port = tox_self_get_udp_port(toxes.front().tox(), nullptr);
202 202
203 for (Local_State const &state : toxes) { 203 for (Local_State const &state : toxes) {
204 TOX_ERR_BOOTSTRAP err; 204 Tox_Err_Bootstrap err;
205 tox_bootstrap(state.tox(), "localhost", dht_port, dht_key, &err); 205 tox_bootstrap(state.tox(), "localhost", dht_port, dht_key, &err);
206 assert(err == TOX_ERR_BOOTSTRAP_OK); 206 assert(err == TOX_ERR_BOOTSTRAP_OK);
207 } 207 }
@@ -211,7 +211,7 @@ Global_State make_toxes(std::vector<Action> const &actions) {
211 for (Local_State const &state1 : toxes) { 211 for (Local_State const &state1 : toxes) {
212 for (Local_State const &state2 : toxes) { 212 for (Local_State const &state2 : toxes) {
213 if (state1.tox() != state2.tox()) { 213 if (state1.tox() != state2.tox()) {
214 TOX_ERR_FRIEND_ADD err; 214 Tox_Err_Friend_Add err;
215 uint8_t key[TOX_PUBLIC_KEY_SIZE]; 215 uint8_t key[TOX_PUBLIC_KEY_SIZE];
216 216
217 tox_self_get_public_key(state1.tox(), key); 217 tox_self_get_public_key(state1.tox(), key);
@@ -289,7 +289,7 @@ int main() {
289 return tox_conference_get_chatlist_size(state.tox()) < MAX_CONFERENCES_PER_USER; 289 return tox_conference_get_chatlist_size(state.tox()) < MAX_CONFERENCES_PER_USER;
290 }, 290 },
291 [](Local_State *state, Random *rnd, std::mt19937 *rng) { 291 [](Local_State *state, Random *rnd, std::mt19937 *rng) {
292 TOX_ERR_CONFERENCE_NEW err; 292 Tox_Err_Conference_New err;
293 tox_conference_new(state->tox(), &err); 293 tox_conference_new(state->tox(), &err);
294 assert(err == TOX_ERR_CONFERENCE_NEW_OK); 294 assert(err == TOX_ERR_CONFERENCE_NEW_OK);
295 }, 295 },
@@ -303,7 +303,7 @@ int main() {
303 [](Local_State *state, Random *rnd, std::mt19937 *rng) { 303 [](Local_State *state, Random *rnd, std::mt19937 *rng) {
304 size_t chat_count = tox_conference_get_chatlist_size(state->tox()); 304 size_t chat_count = tox_conference_get_chatlist_size(state->tox());
305 assert(chat_count != 0); // Condition above. 305 assert(chat_count != 0); // Condition above.
306 TOX_ERR_CONFERENCE_INVITE err; 306 Tox_Err_Conference_Invite err;
307 tox_conference_invite(state->tox(), rnd->friend_selector(*rng), 307 tox_conference_invite(state->tox(), rnd->friend_selector(*rng),
308 state->next_invite % chat_count, &err); 308 state->next_invite % chat_count, &err);
309 state->next_invite++; 309 state->next_invite++;
@@ -317,7 +317,7 @@ int main() {
317 return tox_conference_get_chatlist_size(state.tox()) != 0; 317 return tox_conference_get_chatlist_size(state.tox()) != 0;
318 }, 318 },
319 [](Local_State *state, Random *rnd, std::mt19937 *rng) { 319 [](Local_State *state, Random *rnd, std::mt19937 *rng) {
320 TOX_ERR_CONFERENCE_DELETE err; 320 Tox_Err_Conference_Delete err;
321 tox_conference_delete(state->tox(), tox_conference_get_chatlist_size(state->tox()) - 1, 321 tox_conference_delete(state->tox(), tox_conference_get_chatlist_size(state->tox()) - 1,
322 &err); 322 &err);
323 assert(err == TOX_ERR_CONFERENCE_DELETE_OK); 323 assert(err == TOX_ERR_CONFERENCE_DELETE_OK);
@@ -335,7 +335,7 @@ int main() {
335 byte = rnd->byte_selector(*rng); 335 byte = rnd->byte_selector(*rng);
336 } 336 }
337 337
338 TOX_ERR_CONFERENCE_SEND_MESSAGE err; 338 Tox_Err_Conference_Send_Message err;
339 tox_conference_send_message( 339 tox_conference_send_message(
340 state->tox(), tox_conference_get_chatlist_size(state->tox()) - 1, 340 state->tox(), tox_conference_get_chatlist_size(state->tox()) - 1,
341 TOX_MESSAGE_TYPE_NORMAL, message.data(), message.size(), &err); 341 TOX_MESSAGE_TYPE_NORMAL, message.data(), message.size(), &err);
@@ -356,7 +356,7 @@ int main() {
356 byte = rnd->byte_selector(*rng); 356 byte = rnd->byte_selector(*rng);
357 } 357 }
358 358
359 TOX_ERR_SET_INFO err; 359 Tox_Err_Set_Info err;
360 tox_self_set_name(state->tox(), name.data(), name.size(), &err); 360 tox_self_set_name(state->tox(), name.data(), name.size(), &err);
361 assert(err == TOX_ERR_SET_INFO_OK); 361 assert(err == TOX_ERR_SET_INFO_OK);
362 362
@@ -368,7 +368,7 @@ int main() {
368 "sets their name to empty", 368 "sets their name to empty",
369 [](Local_State const &state) { return true; }, 369 [](Local_State const &state) { return true; },
370 [](Local_State *state, Random *rnd, std::mt19937 *rng) { 370 [](Local_State *state, Random *rnd, std::mt19937 *rng) {
371 TOX_ERR_SET_INFO err; 371 Tox_Err_Set_Info err;
372 tox_self_set_name(state->tox(), nullptr, 0, &err); 372 tox_self_set_name(state->tox(), nullptr, 0, &err);
373 assert(err == TOX_ERR_SET_INFO_OK); 373 assert(err == TOX_ERR_SET_INFO_OK);
374 }, 374 },