Added save/load live test.

This commit is contained in:
irungentoo 2015-06-12 23:05:37 -04:00
parent bc5d5905d7
commit 836daa9e95
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98

View File

@ -483,7 +483,39 @@ START_TEST(test_few_clients)
printf("%u\n", save_size1);
uint8_t save1[save_size1];
tox_get_savedata(tox2, save1);
tox_kill(tox2);
struct Tox_Options options;
tox_options_default(&options);
options.savedata_type = TOX_SAVEDATA_TYPE_TOX_SAVE;
options.savedata_data = save1;
options.savedata_length = save_size1;
tox2 = tox_new(&options, NULL);
cur_time = time(NULL);
off = 1;
while (1) {
tox_iterate(tox1);
tox_iterate(tox2);
tox_iterate(tox3);
if (tox_self_get_connection_status(tox1) && tox_self_get_connection_status(tox2)
&& tox_self_get_connection_status(tox3)) {
if (off) {
printf("Toxes are online again after reloading, took %llu seconds\n", time(NULL) - cur_time);
con_time = time(NULL);
off = 0;
}
if (tox_friend_get_connection_status(tox2, 0, 0) == TOX_CONNECTION_UDP
&& tox_friend_get_connection_status(tox3, 0, 0) == TOX_CONNECTION_UDP)
break;
}
c_sleep(50);
}
printf("tox clients connected took %llu seconds\n", time(NULL) - con_time);
tox_callback_friend_name(tox3, print_nickchange, &to_compare);
TOX_ERR_SET_INFO err_n;
bool succ = tox_self_set_name(tox2, (uint8_t *)"Gentoo", sizeof("Gentoo"), &err_n);
@ -1240,7 +1272,7 @@ Suite *tox_suite(void)
Suite *s = suite_create("Tox");
DEFTESTCASE(one);
DEFTESTCASE_SLOW(few_clients, 50);
DEFTESTCASE_SLOW(few_clients, 80);
DEFTESTCASE_SLOW(many_clients, 80);
DEFTESTCASE_SLOW(many_clients_tcp, 20);
DEFTESTCASE_SLOW(many_clients_tcp_b, 20);