Files
WoW-Hybrid-gateway/tests/local_priority_gate_test.c
2026-11-23 03:28:32 +02:00

66 lines
2.6 KiB
C

/* Standalone local Wire test. Compile with MinGW and run directly on Windows
* or under Wine. No Octo route-slot functions are linked into this fixture. */
#include <assert.h>
#define GW_SOURCE_ONLY_PROFILE 5
#include "../native/wine_priority_gate.c"
struct gw_session_retirement_control gw_wire_session_retirement_data = {
.abi = 1, .size = sizeof(struct gw_session_retirement_control),
.next_credentials_generation = 1
};
struct gw_wire_auth_control gw_wire_auth_data = {
.abi = 1, .size = sizeof(struct gw_wire_auth_control)
};
struct gw_wire_auth_credentials gw_wire_auth_credentials_data = {
.abi = 1, .size = sizeof(struct gw_wire_auth_credentials)
};
static LONG profile = 5;
static LONG active;
LONG WINAPI gw_source_profile_kind(void) { return profile; }
LONG WINAPI gw_wire_account_active(void) { return active; }
int main(void) {
struct gw_session_retirement_control *r = &gw_wire_session_retirement_data;
assert(gw_wire_priority_status(0) == GW_PRIORITY_SLOT_NONE);
assert(gw_wire_priority_begin(0) == -1);
assert(gw_wire_priority_begin(2) == -1);
assert(gw_wire_priority_begin(GW_SESSION_EPOCH_LIMIT + 1) == -1);
active = 1;
assert(gw_wire_priority_begin(1) == -1);
active = 0;
gw_wire_auth_credentials_data.state = 1;
assert(gw_wire_priority_begin(1) == -1);
gw_wire_auth_credentials_data.state = 0;
gw_wire_auth_data.cancel = 1;
assert(gw_wire_priority_begin(1) == -1);
gw_wire_auth_data.cancel = 0;
profile = 2;
assert(gw_wire_priority_begin(1) == -1);
profile = 5;
assert(gw_wire_priority_status(0) == GW_PRIORITY_SLOT_NONE);
assert(gw_wire_priority_use_public(0) == -1);
assert(gw_wire_priority_begin(1) == 0);
assert(gw_wire_priority_begin(1) == 0);
assert(gw_wire_priority_status(1) == 3);
assert(gw_wire_priority_status(2) == GW_PRIORITY_SLOT_NONE);
assert(gw_wire_priority_status(0) == 3);
assert(gw_wire_priority_use_public(1) == -1);
r->next_credentials_generation = 2;
assert(gw_wire_priority_status(1) == GW_PRIORITY_SLOT_NONE);
assert(gw_wire_priority_status(0) == GW_PRIORITY_SLOT_NONE);
assert(gw_wire_priority_begin(2) == -1);
r->state = 2;
r->expected_credentials_generation = 1;
assert(gw_wire_priority_begin(2) == -1);
r->completed_credentials_generation = 1;
assert(gw_wire_priority_begin(2) == 0);
assert(gw_wire_priority_begin(1) == -1);
assert(gw_wire_priority_status(0) == 3);
assert(gw_wire_priority_status(1) == GW_PRIORITY_SLOT_NONE);
assert(gw_wire_priority_use_public(0) == -1);
return 0;
}