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_basic_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_basic_test.c')
-rw-r--r-- | auto_tests/toxav_basic_test.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 860ad402..b5028da4 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_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> |
@@ -149,19 +141,20 @@ START_TEST(test_AV_flows) | |||
149 | { | 141 | { |
150 | Tox *Alice, *Bob, *bootstrap; | 142 | Tox *Alice, *Bob, *bootstrap; |
151 | ToxAV *AliceAV, *BobAV; | 143 | ToxAV *AliceAV, *BobAV; |
144 | uint32_t index[] = { 1, 2, 3 }; | ||
152 | 145 | ||
153 | CallControl AliceCC, BobCC; | 146 | CallControl AliceCC, BobCC; |
154 | 147 | ||
155 | { | 148 | { |
156 | TOX_ERR_NEW error; | 149 | TOX_ERR_NEW error; |
157 | 150 | ||
158 | bootstrap = tox_new(NULL, &error); | 151 | bootstrap = tox_new_log(NULL, &error, &index[0]); |
159 | ck_assert(error == TOX_ERR_NEW_OK); | 152 | ck_assert(error == TOX_ERR_NEW_OK); |
160 | 153 | ||
161 | Alice = tox_new(NULL, &error); | 154 | Alice = tox_new_log(NULL, &error, &index[1]); |
162 | ck_assert(error == TOX_ERR_NEW_OK); | 155 | ck_assert(error == TOX_ERR_NEW_OK); |
163 | 156 | ||
164 | Bob = tox_new(NULL, &error); | 157 | Bob = tox_new_log(NULL, &error, &index[2]); |
165 | ck_assert(error == TOX_ERR_NEW_OK); | 158 | ck_assert(error == TOX_ERR_NEW_OK); |
166 | } | 159 | } |
167 | 160 | ||
@@ -591,16 +584,6 @@ START_TEST(test_AV_flows) | |||
591 | } | 584 | } |
592 | END_TEST | 585 | END_TEST |
593 | 586 | ||
594 | #ifndef HAVE_LIBCHECK | ||
595 | int main(int argc, char *argv[]) | ||
596 | { | ||
597 | (void) argc; | ||
598 | (void) argv; | ||
599 | |||
600 | test_AV_flows(); | ||
601 | return 0; | ||
602 | } | ||
603 | #else | ||
604 | static Suite *tox_suite(void) | 587 | static Suite *tox_suite(void) |
605 | { | 588 | { |
606 | Suite *s = suite_create("ToxAV"); | 589 | Suite *s = suite_create("ToxAV"); |
@@ -625,4 +608,3 @@ int main(int argc, char *argv[]) | |||
625 | 608 | ||
626 | return number_failed; | 609 | return number_failed; |
627 | } | 610 | } |
628 | #endif | ||