diff options
Diffstat (limited to 'auto_tests/tox_test.c')
-rw-r--r-- | auto_tests/tox_test.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 501c93dc..72bc27ee 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -286,6 +286,16 @@ void tox_connection_status(Tox *tox, TOX_CONNECTION connection_status, void *use | |||
286 | 286 | ||
287 | START_TEST(test_one) | 287 | START_TEST(test_one) |
288 | { | 288 | { |
289 | { | ||
290 | TOX_ERR_OPTIONS_NEW o_err; | ||
291 | struct Tox_Options *o1 = tox_options_new(&o_err); | ||
292 | struct Tox_Options o2; | ||
293 | tox_options_default(&o2); | ||
294 | ck_assert_msg(o_err == TOX_ERR_OPTIONS_NEW_OK, "tox_options_new wrong error"); | ||
295 | ck_assert_msg(memcmp(o1, &o2, sizeof(struct Tox_Options)) == 0, "tox_options_new error"); | ||
296 | tox_options_free(o1); | ||
297 | } | ||
298 | |||
289 | Tox *tox1 = tox_new(0, 0); | 299 | Tox *tox1 = tox_new(0, 0); |
290 | Tox *tox2 = tox_new(0, 0); | 300 | Tox *tox2 = tox_new(0, 0); |
291 | 301 | ||
@@ -468,6 +478,12 @@ START_TEST(test_few_clients) | |||
468 | 478 | ||
469 | printf("tox clients messaging succeeded\n"); | 479 | printf("tox clients messaging succeeded\n"); |
470 | 480 | ||
481 | unsigned int save_size1 = tox_get_savedata_size(tox2); | ||
482 | ck_assert_msg(save_size1 != 0 && save_size1 < 4096, "save is invalid size %u", save_size1); | ||
483 | printf("%u\n", save_size1); | ||
484 | uint8_t save1[save_size1]; | ||
485 | tox_get_savedata(tox2, save1); | ||
486 | |||
471 | tox_callback_friend_name(tox3, print_nickchange, &to_compare); | 487 | tox_callback_friend_name(tox3, print_nickchange, &to_compare); |
472 | TOX_ERR_SET_INFO err_n; | 488 | TOX_ERR_SET_INFO err_n; |
473 | bool succ = tox_self_set_name(tox2, (uint8_t *)"Gentoo", sizeof("Gentoo"), &err_n); | 489 | bool succ = tox_self_set_name(tox2, (uint8_t *)"Gentoo", sizeof("Gentoo"), &err_n); |
@@ -785,6 +801,14 @@ START_TEST(test_many_clients) | |||
785 | 801 | ||
786 | uint8_t address[TOX_ADDRESS_SIZE]; | 802 | uint8_t address[TOX_ADDRESS_SIZE]; |
787 | 803 | ||
804 | unsigned int num_f = 0; | ||
805 | |||
806 | for (i = 0; i < NUM_TOXES; ++i) { | ||
807 | num_f += tox_self_get_friend_list_size(toxes[i]); | ||
808 | } | ||
809 | |||
810 | ck_assert_msg(num_f == 0, "bad num friends: %u", num_f); | ||
811 | |||
788 | for (i = 0; i < NUM_FRIENDS; ++i) { | 812 | for (i = 0; i < NUM_FRIENDS; ++i) { |
789 | loop_top: | 813 | loop_top: |
790 | pairs[i].tox1 = rand() % NUM_TOXES; | 814 | pairs[i].tox1 = rand() % NUM_TOXES; |
@@ -807,6 +831,12 @@ loop_top: | |||
807 | ck_assert_msg(num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); | 831 | ck_assert_msg(num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); |
808 | } | 832 | } |
809 | 833 | ||
834 | for (i = 0; i < NUM_TOXES; ++i) { | ||
835 | num_f += tox_self_get_friend_list_size(toxes[i]); | ||
836 | } | ||
837 | |||
838 | ck_assert_msg(num_f == NUM_FRIENDS, "bad num friends: %u", num_f); | ||
839 | |||
810 | while (1) { | 840 | while (1) { |
811 | uint16_t counter = 0; | 841 | uint16_t counter = 0; |
812 | 842 | ||