diff options
Diffstat (limited to 'auto_tests/run_auto_test.h')
-rw-r--r-- | auto_tests/run_auto_test.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/auto_tests/run_auto_test.h b/auto_tests/run_auto_test.h index 4f2dc278..47d9dc4a 100644 --- a/auto_tests/run_auto_test.h +++ b/auto_tests/run_auto_test.h | |||
@@ -48,6 +48,15 @@ static uint64_t get_state_clock_callback(Mono_Time *mono_time, void *user_data) | |||
48 | return state->clock; | 48 | return state->clock; |
49 | } | 49 | } |
50 | 50 | ||
51 | static void set_mono_time_callback(Tox *tox, State *state) | ||
52 | { | ||
53 | // TODO(iphydf): Don't rely on toxcore internals. | ||
54 | Mono_Time *mono_time = ((Messenger *)tox)->mono_time; | ||
55 | |||
56 | state->clock = current_time_monotonic(mono_time); | ||
57 | mono_time_set_current_time_callback(mono_time, get_state_clock_callback, state); | ||
58 | } | ||
59 | |||
51 | static void run_auto_test(uint32_t tox_count, void test(Tox **toxes, State *state), bool chain) | 60 | static void run_auto_test(uint32_t tox_count, void test(Tox **toxes, State *state), bool chain) |
52 | { | 61 | { |
53 | printf("initialising %u toxes\n", tox_count); | 62 | printf("initialising %u toxes\n", tox_count); |
@@ -59,11 +68,7 @@ static void run_auto_test(uint32_t tox_count, void test(Tox **toxes, State *stat | |||
59 | toxes[i] = tox_new_log(nullptr, nullptr, &state[i].index); | 68 | toxes[i] = tox_new_log(nullptr, nullptr, &state[i].index); |
60 | ck_assert_msg(toxes[i], "failed to create %u tox instances", i + 1); | 69 | ck_assert_msg(toxes[i], "failed to create %u tox instances", i + 1); |
61 | 70 | ||
62 | // TODO(iphydf): Don't rely on toxcore internals. | 71 | set_mono_time_callback(toxes[i], &state[i]); |
63 | Mono_Time *mono_time = (*(Messenger **)toxes[i])->mono_time; | ||
64 | |||
65 | state[i].clock = current_time_monotonic(mono_time); | ||
66 | mono_time_set_current_time_callback(mono_time, get_state_clock_callback, &state[i]); | ||
67 | } | 72 | } |
68 | 73 | ||
69 | if (chain) { | 74 | if (chain) { |