aboutsummaryrefslogtreecommitdiff
path: root/src/test/test.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-02-05 11:59:15 +0100
committerSebastian Hahn <sebastian@torproject.org>2010-02-09 09:10:03 +0100
commit01030a4db2c9aae4479ee9df431a75f41e75025c (patch)
treeeb482e5f9a68c87dbb7979b608506a0309956ce5 /src/test/test.c
parent20422cde2b71c079e88dcf3bfc2b1f1b4bc23c1c (diff)
downloadtor-01030a4db2c9aae4479ee9df431a75f41e75025c.tar
tor-01030a4db2c9aae4479ee9df431a75f41e75025c.tar.gz
Another unit test for exit_policy_is_general_exit()
Diffstat (limited to 'src/test/test.c')
-rw-r--r--src/test/test.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/test/test.c b/src/test/test.c
index d7575ac61..8b8429044 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -648,7 +648,8 @@ test_policies(void)
{
int i;
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;
tor_addr_t tar;
config_line_t line;
@@ -725,12 +726,17 @@ test_policies(void)
p = router_parse_addr_policy_item_from_string("accept *:1-65535",-1);
test_assert(p != NULL);
smartlist_add(policy5, p);
-
+
policy6 = smartlist_create();
p = router_parse_addr_policy_item_from_string("accept 43.3.0.0/9:*",-1);
test_assert(p != NULL);
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(policy2));
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(policy5));
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, NULL));
@@ -853,6 +860,7 @@ test_policies(void)
addr_policy_list_free(policy4);
addr_policy_list_free(policy5);
addr_policy_list_free(policy6);
+ addr_policy_list_free(policy7);
tor_free(policy_str);
if (sm) {
SMARTLIST_FOREACH(sm, char *, s, tor_free(s));