diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-01-23 09:36:00 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-01-23 09:36:00 -0500 |
commit | 5d4bb6f61f360ddcbee83476ff2f93a13f3a19c0 (patch) | |
tree | b863aa88f8810c86e56f711fe1e032585f80e579 /src/test/test_dir.c | |
parent | bd22ad12bd84019d00bcd92e2e2390cd910908ce (diff) | |
parent | ac9b0a3110ea4eea63133c6d2e3572b2cfd22bd6 (diff) | |
download | tor-5d4bb6f61f360ddcbee83476ff2f93a13f3a19c0.tar.gz tor-5d4bb6f61f360ddcbee83476ff2f93a13f3a19c0.zip |
Merge remote-tracking branch 'public/ticket9969'
Conflicts:
src/or/directory.c
src/or/routerlist.c
src/or/routerlist.h
src/test/include.am
src/test/test.c
Diffstat (limited to 'src/test/test_dir.c')
-rw-r--r-- | src/test/test_dir.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/test_dir.c b/src/test/test_dir.c index a8c6c6fad4..991e613cb6 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -2930,6 +2930,30 @@ test_dir_http_handling(void *args) tor_free(url); } +static void +test_dir_purpose_needs_anonymity(void *arg) +{ + (void)arg; + tt_int_op(1, ==, purpose_needs_anonymity(0, ROUTER_PURPOSE_BRIDGE)); + tt_int_op(1, ==, purpose_needs_anonymity(0, ROUTER_PURPOSE_GENERAL)); + tt_int_op(0, ==, purpose_needs_anonymity(DIR_PURPOSE_FETCH_MICRODESC, + ROUTER_PURPOSE_GENERAL)); + done: ; +} + +static void +test_dir_fetch_type(void *arg) +{ + (void)arg; + tt_assert(dir_fetch_type(DIR_PURPOSE_FETCH_MICRODESC, ROUTER_PURPOSE_GENERAL, + NULL) == MICRODESC_DIRINFO); + tt_assert(dir_fetch_type(DIR_PURPOSE_FETCH_SERVERDESC, ROUTER_PURPOSE_BRIDGE, + NULL) == BRIDGE_DIRINFO); + tt_assert(dir_fetch_type(DIR_PURPOSE_FETCH_CONSENSUS, ROUTER_PURPOSE_GENERAL, + "microdesc") == (V3_DIRINFO | MICRODESC_DIRINFO)); + done: ; +} + #define DIR_LEGACY(name) \ { #name, test_dir_ ## name , TT_FORK, NULL, NULL } @@ -2957,6 +2981,8 @@ struct testcase_t dir_tests[] = { DIR_LEGACY(clip_unmeasured_bw_kb_alt), DIR(fmt_control_ns, 0), DIR(http_handling, 0), + DIR(purpose_needs_anonymity, 0), + DIR(fetch_type, 0), END_OF_TESTCASES }; |