summaryrefslogtreecommitdiff
path: root/auto_tests/encryptsave_test.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-11-05 16:52:41 +0000
committeriphydf <iphydf@users.noreply.github.com>2016-11-06 20:35:09 +0000
commit82515f92eecde2dffc0659519317d00459a09239 (patch)
treef17b9afe68fdd475be368623d58c7f51e8cc0ba2 /auto_tests/encryptsave_test.c
parentfcc8ad943e93308b7048c4e0071ae00b54804934 (diff)
Move log callback to options.
Previously, all log messages generated by tox_new (which is quite a lot) were dropped, because client code had no chance to register a logging callback, yet. This change allows setting the log callback from the beginning and removes the ability to unset it. Since the log callback is forever special, since it can't be stateless, we don't necessarily need to treat it uniformly (with `event`).
Diffstat (limited to 'auto_tests/encryptsave_test.c')
-rw-r--r--auto_tests/encryptsave_test.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/auto_tests/encryptsave_test.c b/auto_tests/encryptsave_test.c
index 2a2827da..fcdef3e6 100644
--- a/auto_tests/encryptsave_test.c
+++ b/auto_tests/encryptsave_test.c
@@ -56,8 +56,8 @@ END_TEST
56 56
57START_TEST(test_save_friend) 57START_TEST(test_save_friend)
58{ 58{
59 Tox *tox1 = tox_new(0, 0); 59 Tox *tox1 = tox_new_log(0, 0, 0);
60 Tox *tox2 = tox_new(0, 0); 60 Tox *tox2 = tox_new_log(0, 0, 0);
61 ck_assert_msg(tox1 || tox2, "Failed to create 2 tox instances"); 61 ck_assert_msg(tox1 || tox2, "Failed to create 2 tox instances");
62 tox_callback_friend_request(tox2, accept_friend_request); 62 tox_callback_friend_request(tox2, accept_friend_request);
63 uint8_t address[TOX_ADDRESS_SIZE]; 63 uint8_t address[TOX_ADDRESS_SIZE];
@@ -82,7 +82,7 @@ START_TEST(test_save_friend)
82 options.savedata_length = size2; 82 options.savedata_length = size2;
83 83
84 TOX_ERR_NEW err2; 84 TOX_ERR_NEW err2;
85 Tox *tox3 = tox_new(&options, &err2); 85 Tox *tox3 = tox_new_log(&options, &err2, 0);
86 ck_assert_msg(err2 == TOX_ERR_NEW_LOAD_ENCRYPTED, "wrong error! %u. should fail with %u", err2, 86 ck_assert_msg(err2 == TOX_ERR_NEW_LOAD_ENCRYPTED, "wrong error! %u. should fail with %u", err2,
87 TOX_ERR_NEW_LOAD_ENCRYPTED); 87 TOX_ERR_NEW_LOAD_ENCRYPTED);
88 ck_assert_msg(tox3 == NULL, "tox_new with error should return NULL"); 88 ck_assert_msg(tox3 == NULL, "tox_new with error should return NULL");
@@ -92,7 +92,7 @@ START_TEST(test_save_friend)
92 ck_assert_msg(ret, "failed to decrypt save: %u", err3); 92 ck_assert_msg(ret, "failed to decrypt save: %u", err3);
93 options.savedata_data = dec_data; 93 options.savedata_data = dec_data;
94 options.savedata_length = size; 94 options.savedata_length = size;
95 tox3 = tox_new(&options, &err2); 95 tox3 = tox_new_log(&options, &err2, 0);
96 ck_assert_msg(err2 == TOX_ERR_NEW_OK, "failed to load from decrypted data: %u", err2); 96 ck_assert_msg(err2 == TOX_ERR_NEW_OK, "failed to load from decrypted data: %u", err2);
97 uint8_t address2[TOX_PUBLIC_KEY_SIZE]; 97 uint8_t address2[TOX_PUBLIC_KEY_SIZE];
98 ret = tox_friend_get_public_key(tox3, 0, address2, 0); 98 ret = tox_friend_get_public_key(tox3, 0, address2, 0);
@@ -122,7 +122,7 @@ START_TEST(test_save_friend)
122 // to remove the manual check now that it's there) 122 // to remove the manual check now that it's there)
123 options.savedata_data = out1; 123 options.savedata_data = out1;
124 options.savedata_length = size; 124 options.savedata_length = size;
125 Tox *tox4 = tox_new(&options, &err2); 125 Tox *tox4 = tox_new_log(&options, &err2, 0);
126 ck_assert_msg(err2 == TOX_ERR_NEW_OK, "failed to new the third"); 126 ck_assert_msg(err2 == TOX_ERR_NEW_OK, "failed to new the third");
127 uint8_t address5[TOX_PUBLIC_KEY_SIZE]; 127 uint8_t address5[TOX_PUBLIC_KEY_SIZE];
128 ret = tox_friend_get_public_key(tox4, 0, address5, 0); 128 ret = tox_friend_get_public_key(tox4, 0, address5, 0);