/** * @file test/main.c Selftest for Baresip core * * Copyright (C) 2010 Creytiv.com */ #include #include #include "test.h" typedef int (test_exec_h)(void); struct test { test_exec_h *exec; const char *name; }; #define TEST(a) {a, #a} static const struct test tests[] = { TEST(test_cmd), TEST(test_ua_alloc), TEST(test_uag_find_param), TEST(test_ua_register), TEST(test_cplusplus), }; static int run_tests(bool verbose) { size_t i; int err; for (i=0; isip.local, "127.0.0.1:0", sizeof(config->sip.local)); /* XXX: needed for ua tests */ err = ua_init("test", true, true, true, false); if (err) goto out; err = run_tests(false); if (err) goto out; #if 1 ua_stop_all(true); #endif re_printf("\x1b[32mOK. %zu tests passed successfully\x1b[;m\n", ARRAY_SIZE(tests)); out: if (err) { warning("test failed (%m)\n", err); re_printf("%H\n", re_debug, 0); } ua_stop_all(true); ua_close(); libre_close(); tmr_debug(); mem_debug(); return err; }