summaryrefslogtreecommitdiff
path: root/auto_tests/save_friend_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/save_friend_test.c')
-rw-r--r--auto_tests/save_friend_test.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/auto_tests/save_friend_test.c b/auto_tests/save_friend_test.c
index a7a62c87..ad4bd338 100644
--- a/auto_tests/save_friend_test.c
+++ b/auto_tests/save_friend_test.c
@@ -49,10 +49,19 @@ void statuschange_callback(Tox *tox, uint32_t friend_number, const uint8_t *mess
49 49
50int main(int argc, char *argv[]) 50int main(int argc, char *argv[])
51{ 51{
52 Tox *tox1 = tox_new_log(nullptr, nullptr, nullptr); 52 setvbuf(stdout, nullptr, _IONBF, 0);
53 Tox *tox2 = tox_new_log(nullptr, nullptr, nullptr);
54 53
55 struct test_data to_compare = { { 0 } }; 54 Tox *const tox1 = tox_new_log(nullptr, nullptr, nullptr);
55 Tox *const tox2 = tox_new_log(nullptr, nullptr, nullptr);
56
57 printf("bootstrapping tox2 off tox1\n");
58 uint8_t dht_key[TOX_PUBLIC_KEY_SIZE];
59 tox_self_get_dht_id(tox1, dht_key);
60 const uint16_t dht_port = tox_self_get_udp_port(tox1, nullptr);
61
62 tox_bootstrap(tox2, "localhost", dht_port, dht_key, nullptr);
63
64 struct test_data to_compare = {{0}};
56 65
57 uint8_t public_key[TOX_PUBLIC_KEY_SIZE]; 66 uint8_t public_key[TOX_PUBLIC_KEY_SIZE];
58 tox_self_get_public_key(tox1, public_key); 67 tox_self_get_public_key(tox1, public_key);
@@ -104,11 +113,11 @@ int main(int argc, char *argv[])
104 VLA(uint8_t, savedata, save_size); 113 VLA(uint8_t, savedata, save_size);
105 tox_get_savedata(tox1, savedata); 114 tox_get_savedata(tox1, savedata);
106 115
107 struct Tox_Options *options = tox_options_new(nullptr); 116 struct Tox_Options *const options = tox_options_new(nullptr);
108 tox_options_set_savedata_type(options, TOX_SAVEDATA_TYPE_TOX_SAVE); 117 tox_options_set_savedata_type(options, TOX_SAVEDATA_TYPE_TOX_SAVE);
109 tox_options_set_savedata_data(options, savedata, save_size); 118 tox_options_set_savedata_data(options, savedata, save_size);
110 119
111 Tox *tox_to_compare = tox_new(options, nullptr); 120 Tox *const tox_to_compare = tox_new_log(options, nullptr, nullptr);
112 121
113 tox_friend_get_name(tox_to_compare, 0, to_compare.name, nullptr); 122 tox_friend_get_name(tox_to_compare, 0, to_compare.name, nullptr);
114 tox_friend_get_status_message(tox_to_compare, 0, to_compare.status_message, nullptr); 123 tox_friend_get_status_message(tox_to_compare, 0, to_compare.status_message, nullptr);