mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Another unit test for exit_policy_is_general_exit()
This commit is contained in:
parent
20422cde2b
commit
01030a4db2
@ -648,7 +648,8 @@ test_policies(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
smartlist_t *policy = NULL, *policy2 = NULL, *policy3 = NULL,
|
smartlist_t *policy = NULL, *policy2 = NULL, *policy3 = NULL,
|
||||||
*policy4 = NULL, *policy5 = NULL, *policy6 = NULL;
|
*policy4 = NULL, *policy5 = NULL, *policy6 = NULL,
|
||||||
|
*policy7 = NULL;
|
||||||
addr_policy_t *p;
|
addr_policy_t *p;
|
||||||
tor_addr_t tar;
|
tor_addr_t tar;
|
||||||
config_line_t line;
|
config_line_t line;
|
||||||
@ -731,6 +732,11 @@ test_policies(void)
|
|||||||
test_assert(p != NULL);
|
test_assert(p != NULL);
|
||||||
smartlist_add(policy6, p);
|
smartlist_add(policy6, p);
|
||||||
|
|
||||||
|
policy7 = smartlist_create();
|
||||||
|
p = router_parse_addr_policy_item_from_string("accept 0.0.0.0/8:*",-1);
|
||||||
|
test_assert(p != NULL);
|
||||||
|
smartlist_add(policy7, p);
|
||||||
|
|
||||||
test_assert(!exit_policy_is_general_exit(policy));
|
test_assert(!exit_policy_is_general_exit(policy));
|
||||||
test_assert(exit_policy_is_general_exit(policy2));
|
test_assert(exit_policy_is_general_exit(policy2));
|
||||||
test_assert(!exit_policy_is_general_exit(NULL));
|
test_assert(!exit_policy_is_general_exit(NULL));
|
||||||
@ -738,6 +744,7 @@ test_policies(void)
|
|||||||
test_assert(!exit_policy_is_general_exit(policy4));
|
test_assert(!exit_policy_is_general_exit(policy4));
|
||||||
test_assert(!exit_policy_is_general_exit(policy5));
|
test_assert(!exit_policy_is_general_exit(policy5));
|
||||||
test_assert(!exit_policy_is_general_exit(policy6));
|
test_assert(!exit_policy_is_general_exit(policy6));
|
||||||
|
test_assert(!exit_policy_is_general_exit(policy7));
|
||||||
|
|
||||||
test_assert(cmp_addr_policies(policy, policy2));
|
test_assert(cmp_addr_policies(policy, policy2));
|
||||||
test_assert(cmp_addr_policies(policy, NULL));
|
test_assert(cmp_addr_policies(policy, NULL));
|
||||||
@ -853,6 +860,7 @@ test_policies(void)
|
|||||||
addr_policy_list_free(policy4);
|
addr_policy_list_free(policy4);
|
||||||
addr_policy_list_free(policy5);
|
addr_policy_list_free(policy5);
|
||||||
addr_policy_list_free(policy6);
|
addr_policy_list_free(policy6);
|
||||||
|
addr_policy_list_free(policy7);
|
||||||
tor_free(policy_str);
|
tor_free(policy_str);
|
||||||
if (sm) {
|
if (sm) {
|
||||||
SMARTLIST_FOREACH(sm, char *, s, tor_free(s));
|
SMARTLIST_FOREACH(sm, char *, s, tor_free(s));
|
||||||
|
Loading…
Reference in New Issue
Block a user