diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-11-09 09:17:53 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-11-09 09:17:53 -0500 |
commit | 06260315645945ca9e08b5a19b67c8adad65a698 (patch) | |
tree | 52d4a7cd26645cceb9f4204eb72bca29eea27766 /src/test | |
parent | 59c1016aba63c62e658065475add3cf77f665afa (diff) | |
parent | 3124c921e7af15548b8b16d5f239bfdcd178b2ca (diff) | |
download | tor-06260315645945ca9e08b5a19b67c8adad65a698.tar.gz tor-06260315645945ca9e08b5a19b67c8adad65a698.zip |
Merge branch 'ticket20895'
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_protover.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/test_protover.c b/src/test/test_protover.c index 9ae907183b..6865362115 100644 --- a/src/test/test_protover.c +++ b/src/test/test_protover.c @@ -221,6 +221,35 @@ test_protover_list_supports_protocol_for_unsupported_returns_false(void *arg) ; } +static void +test_protover_supports_version(void *arg) +{ + (void)arg; + + tt_assert(protocol_list_supports_protocol("Link=3-6", PRT_LINK, 3)); + tt_assert(protocol_list_supports_protocol("Link=3-6", PRT_LINK, 6)); + tt_assert(!protocol_list_supports_protocol("Link=3-6", PRT_LINK, 7)); + tt_assert(!protocol_list_supports_protocol("Link=3-6", PRT_LINKAUTH, 3)); + + tt_assert(!protocol_list_supports_protocol("Link=4-6 LinkAuth=3", + PRT_LINKAUTH, 2)); + tt_assert(protocol_list_supports_protocol("Link=4-6 LinkAuth=3", + PRT_LINKAUTH, 3)); + tt_assert(!protocol_list_supports_protocol("Link=4-6 LinkAuth=3", + PRT_LINKAUTH, 4)); + tt_assert(!protocol_list_supports_protocol_or_later("Link=4-6 LinkAuth=3", + PRT_LINKAUTH, 4)); + tt_assert(protocol_list_supports_protocol_or_later("Link=4-6 LinkAuth=3", + PRT_LINKAUTH, 3)); + tt_assert(protocol_list_supports_protocol_or_later("Link=4-6 LinkAuth=3", + PRT_LINKAUTH, 2)); + + tt_assert(!protocol_list_supports_protocol_or_later("Link=4-6 LinkAuth=3", + PRT_DESC, 2)); + done: + ; +} + #define PV_TEST(name, flags) \ { #name, test_protover_ ##name, (flags), NULL, NULL } @@ -231,6 +260,7 @@ struct testcase_t protover_tests[] = { PV_TEST(all_supported, 0), PV_TEST(list_supports_protocol_for_unsupported_returns_false, 0), PV_TEST(list_supports_protocol_returns_true, 0), + PV_TEST(supports_version, 0), END_OF_TESTCASES }; |