forked from Green-Sky/tomato
Squashed 'external/toxcore/c-toxcore/' content from commit 67badf69
git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 67badf69416a74e74f6d7eb51dd96f37282b8455
This commit is contained in:
34
auto_tests/bootstrap_test.c
Normal file
34
auto_tests/bootstrap_test.c
Normal file
@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../testing/misc_tools.h"
|
||||
#include "check_compat.h"
|
||||
|
||||
#include "auto_test_support.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||
|
||||
Tox *tox_udp = tox_new_log(nullptr, nullptr, nullptr);
|
||||
|
||||
bootstrap_tox_live_network(tox_udp, false);
|
||||
|
||||
printf("Waiting for connection");
|
||||
|
||||
do {
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
|
||||
tox_iterate(tox_udp, nullptr);
|
||||
c_sleep(ITERATION_INTERVAL);
|
||||
} while (tox_self_get_connection_status(tox_udp) == TOX_CONNECTION_NONE);
|
||||
|
||||
const Tox_Connection status = tox_self_get_connection_status(tox_udp);
|
||||
ck_assert_msg(status == TOX_CONNECTION_UDP,
|
||||
"expected connection status to be UDP, but got %d", status);
|
||||
printf("Connection (UDP): %d\n", tox_self_get_connection_status(tox_udp));
|
||||
|
||||
tox_kill(tox_udp);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user