1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include <uhub.h>
static struct hub_config g_config;
static struct acl_handle g_acl;
static struct hub_info* g_hub;
/*
static void create_test_user()
{
if (g_user)
return;
g_user = (struct hub_user*) malloc(sizeof(struct hub_user));
memset(g_user, 0, sizeof(struct hub_user));
memcpy(g_user->id.nick, "exotic-tester", 13);
g_user->sid = 1;
}
*/
EXO_TEST(hub_net_startup, {
return (net_initialize() != -1);
});
EXO_TEST(hub_config_initialize, {
config_defaults(&g_config);
g_config.server_port = 65111;
return 1;
});
EXO_TEST(hub_acl_initialize, {
return (acl_initialize(&g_config, &g_acl) != -1);
});
EXO_TEST(hub_service_initialize, {
g_hub = hub_start_service(&g_config);
return g_hub ? 1 : 0;
});
EXO_TEST(hub_variables_startup, {
hub_set_variables(g_hub, &g_acl);
return 1;
});
/*** HUB IS OPERATIONAL HERE! ***/
EXO_TEST(hub_variables_shutdown, {
hub_free_variables(g_hub);
return 1;
});
EXO_TEST(hub_acl_shutdown, {
acl_shutdown(&g_acl);
return 1;
});
EXO_TEST(hub_config_shutdown, {
free_config(&g_config);
return 1;
});
EXO_TEST(hub_service_shutdown, {
if (g_hub)
{
hub_shutdown_service(g_hub);
return 1;
}
return 0;
});
EXO_TEST(hub_net_shutdown, {
return (net_destroy() != -1);
});
|