summaryrefslogtreecommitdiff
path: root/auto_tests/run_auto_test.h
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2019-02-10 00:00:00 +0000
committerzugz (tox) <mbays+tox@sdf.org>2019-02-10 00:00:00 +0000
commit49e2406ffabe2bbf04dc9416f6240ea63df4590d (patch)
treee81f432758d1f8a2aba7c037cc1c81a9550aef6f /auto_tests/run_auto_test.h
parent0aad180d1e1d7dae7cbf2868e139af0a4dc34fe7 (diff)
Expose api functions for enabling and disabling AV in AV groups
A group loaded from a savefile starts with AV disabled.
Diffstat (limited to 'auto_tests/run_auto_test.h')
-rw-r--r--auto_tests/run_auto_test.h15
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
51static 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
51static void run_auto_test(uint32_t tox_count, void test(Tox **toxes, State *state), bool chain) 60static 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) {