diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-11-05 16:52:41 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-11-06 20:35:09 +0000 |
commit | 82515f92eecde2dffc0659519317d00459a09239 (patch) | |
tree | f17b9afe68fdd475be368623d58c7f51e8cc0ba2 /auto_tests/toxav_many_test.c | |
parent | fcc8ad943e93308b7048c4e0071ae00b54804934 (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/toxav_many_test.c')
-rw-r--r-- | auto_tests/toxav_many_test.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index 6f864f07..a351129a 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -2,15 +2,7 @@ | |||
2 | #include "config.h" | 2 | #include "config.h" |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #ifndef HAVE_LIBCHECK | 5 | #include "helpers.h" |
6 | # include <assert.h> | ||
7 | |||
8 | # define ck_assert(X) assert(X); | ||
9 | # define START_TEST(NAME) static void NAME (void) | ||
10 | # define END_TEST | ||
11 | #else | ||
12 | # include "helpers.h" | ||
13 | #endif | ||
14 | 6 | ||
15 | #include <stdint.h> | 7 | #include <stdint.h> |
16 | #include <stdio.h> | 8 | #include <stdio.h> |
@@ -207,6 +199,7 @@ static void *call_thread(void *pd) | |||
207 | 199 | ||
208 | START_TEST(test_AV_three_calls) | 200 | START_TEST(test_AV_three_calls) |
209 | { | 201 | { |
202 | uint32_t index[] = { 1, 2, 3, 4, 5 }; | ||
210 | Tox *Alice, *bootstrap, *Bobs[3]; | 203 | Tox *Alice, *bootstrap, *Bobs[3]; |
211 | ToxAV *AliceAV, *BobsAV[3]; | 204 | ToxAV *AliceAV, *BobsAV[3]; |
212 | 205 | ||
@@ -215,19 +208,19 @@ START_TEST(test_AV_three_calls) | |||
215 | { | 208 | { |
216 | TOX_ERR_NEW error; | 209 | TOX_ERR_NEW error; |
217 | 210 | ||
218 | bootstrap = tox_new(NULL, &error); | 211 | bootstrap = tox_new_log(NULL, &error, &index[0]); |
219 | ck_assert(error == TOX_ERR_NEW_OK); | 212 | ck_assert(error == TOX_ERR_NEW_OK); |
220 | 213 | ||
221 | Alice = tox_new(NULL, &error); | 214 | Alice = tox_new_log(NULL, &error, &index[1]); |
222 | ck_assert(error == TOX_ERR_NEW_OK); | 215 | ck_assert(error == TOX_ERR_NEW_OK); |
223 | 216 | ||
224 | Bobs[0] = tox_new(NULL, &error); | 217 | Bobs[0] = tox_new_log(NULL, &error, &index[2]); |
225 | ck_assert(error == TOX_ERR_NEW_OK); | 218 | ck_assert(error == TOX_ERR_NEW_OK); |
226 | 219 | ||
227 | Bobs[1] = tox_new(NULL, &error); | 220 | Bobs[1] = tox_new_log(NULL, &error, &index[3]); |
228 | ck_assert(error == TOX_ERR_NEW_OK); | 221 | ck_assert(error == TOX_ERR_NEW_OK); |
229 | 222 | ||
230 | Bobs[2] = tox_new(NULL, &error); | 223 | Bobs[2] = tox_new_log(NULL, &error, &index[4]); |
231 | ck_assert(error == TOX_ERR_NEW_OK); | 224 | ck_assert(error == TOX_ERR_NEW_OK); |
232 | } | 225 | } |
233 | 226 | ||
@@ -341,16 +334,6 @@ START_TEST(test_AV_three_calls) | |||
341 | END_TEST | 334 | END_TEST |
342 | 335 | ||
343 | 336 | ||
344 | #ifndef HAVE_LIBCHECK | ||
345 | int main(int argc, char *argv[]) | ||
346 | { | ||
347 | (void) argc; | ||
348 | (void) argv; | ||
349 | |||
350 | test_AV_three_calls(); | ||
351 | return 0; | ||
352 | } | ||
353 | #else | ||
354 | static Suite *tox_suite(void) | 337 | static Suite *tox_suite(void) |
355 | { | 338 | { |
356 | Suite *s = suite_create("ToxAV"); | 339 | Suite *s = suite_create("ToxAV"); |
@@ -380,4 +363,3 @@ int main(int argc, char *argv[]) | |||
380 | 363 | ||
381 | return number_failed; | 364 | return number_failed; |
382 | } | 365 | } |
383 | #endif | ||