diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-08-20 14:52:24 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-08-20 14:52:24 -0400 |
commit | 01a0ab02a3d8ef9e7664945224ce5e22f18ac4b9 (patch) | |
tree | d20337ec9be297b82497bcbac1cd928c64ddd3ff /src/test | |
parent | 7c61d10c6c09b32a4b8acd2553aa05c4fbc06611 (diff) | |
parent | 7f5a440421b122c2d594a89e21799078b3d7284a (diff) | |
download | tor-01a0ab02a3d8ef9e7664945224ce5e22f18ac4b9.tar.gz tor-01a0ab02a3d8ef9e7664945224ce5e22f18ac4b9.zip |
Merge branch 'bug10116_squashed'
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_status.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/test/test_status.c b/src/test/test_status.c index 46dd473132..8bc0152ffb 100644 --- a/src/test/test_status.c +++ b/src/test/test_status.c @@ -30,27 +30,24 @@ * global circuits. */ -struct global_circuitlist_s mock_global_circuitlist = - TOR_LIST_HEAD_INITIALIZER(global_circuitlist); +static smartlist_t * mock_global_circuitlist = NULL; -NS_DECL(struct global_circuitlist_s *, circuit_get_global_list, (void)); +NS_DECL(smartlist_t *, circuit_get_global_list, (void)); static void NS(test_main)(void *arg) { /* Choose origin_circuit_t wlog. */ origin_circuit_t *mock_circuit1, *mock_circuit2; - circuit_t *circ, *tmp; int expected_circuits = 2, actual_circuits; (void)arg; mock_circuit1 = tor_malloc_zero(sizeof(origin_circuit_t)); mock_circuit2 = tor_malloc_zero(sizeof(origin_circuit_t)); - TOR_LIST_INSERT_HEAD( - &mock_global_circuitlist, TO_CIRCUIT(mock_circuit1), head); - TOR_LIST_INSERT_HEAD( - &mock_global_circuitlist, TO_CIRCUIT(mock_circuit2), head); + mock_global_circuitlist = smartlist_new(); + smartlist_add(mock_global_circuitlist, TO_CIRCUIT(mock_circuit1)); + smartlist_add(mock_global_circuitlist, TO_CIRCUIT(mock_circuit2)); NS_MOCK(circuit_get_global_list); @@ -58,17 +55,18 @@ NS(test_main)(void *arg) tt_assert(expected_circuits == actual_circuits); - done: - TOR_LIST_FOREACH_SAFE( - circ, NS(circuit_get_global_list)(), head, tmp); - tor_free(circ); - NS_UNMOCK(circuit_get_global_list); + done: + tor_free(mock_circuit1); + tor_free(mock_circuit2); + smartlist_free(mock_global_circuitlist); + mock_global_circuitlist = NULL; + NS_UNMOCK(circuit_get_global_list); } -static struct global_circuitlist_s * +static smartlist_t * NS(circuit_get_global_list)(void) { - return &mock_global_circuitlist; + return mock_global_circuitlist; } #undef NS_SUBMODULE |