Files
c-toxcore/auto_tests/auto_test_support.h
2026-01-05 21:45:47 +00:00

61 lines
1.5 KiB
C

#ifndef RUN_AUTO_TEST_H
#define RUN_AUTO_TEST_H
#include <stdlib.h> // calloc, free
#include "check_compat.h"
#include "../testing/misc_tools.h"
#include "../toxcore/Messenger.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/tox_dispatch.h"
#include "../toxcore/net_crypto.h"
typedef struct AutoTox {
Tox *tox;
Tox_Dispatch *dispatch;
uint32_t index;
uint64_t clock;
size_t save_size;
uint8_t *save_state;
bool alive;
bool events;
void *state;
} AutoTox;
typedef enum Graph_Type {
GRAPH_COMPLETE = 0,
GRAPH_LINEAR,
} Graph_Type;
typedef struct Run_Auto_Options {
Graph_Type graph;
void (*init_autotox)(AutoTox *autotox, uint32_t n);
uint16_t tcp_port;
bool events;
} Run_Auto_Options;
void bootstrap_tox_live_network(Tox *tox, bool enable_tcp);
// Use this function when setting the log callback on a Tox* object
void print_debug_log(Tox *m, Tox_Log_Level level, const char *file, uint32_t line, const char *func,
const char *message, void *user_data);
// Use this function when setting the log callback on a Logger object
void print_debug_logger(void *context, Logger_Level level, const char *file, uint32_t line,
const char *func, const char *message, void *userdata);
Tox *tox_new_log(struct Tox_Options *options, Tox_Err_New *err, void *log_user_data);
Tox *tox_new_log_lan(struct Tox_Options *options, Tox_Err_New *err, void *log_user_data, bool lan_discovery);
extern const Net_Crypto_DHT_Funcs auto_test_dht_funcs;
#endif