[tor-commits] [tor/master] Using the new API in unit-test.

nickm at torproject.org nickm at torproject.org
Mon Sep 22 18:35:21 UTC 2014


commit 0eaf82947d862852e59b17a1763e49d57de03873
Author: rl1987 <rl1987 at sdf.lonestar.org>
Date:   Sat Sep 13 19:32:35 2014 +0300

    Using the new API in unit-test.
---
 src/test/test_policy.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 4cdcd03..5f044d0 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -47,7 +47,9 @@ test_policy_summary_helper(const char *policy_str,
   line.value = (char *)policy_str;
   line.next = NULL;
 
-  r = policies_parse_exit_policy(&line, &policy, 1, 0, 0, 1);
+  r = policies_parse_exit_policy(&line, &policy, 
+                                 EXIT_POLICY_IPV6_ENABLED | 
+                                 EXIT_POLICY_ADD_DEFAULT ,0);
   test_eq(r, 0);
   summary = policy_summarize(policy, AF_INET);
 
@@ -106,7 +108,11 @@ test_policies_general(void *arg)
   test_assert(ADDR_POLICY_REJECTED ==
           compare_tor_addr_to_addr_policy(&tar, 2, policy));
 
-  test_assert(0 == policies_parse_exit_policy(NULL, &policy2, 1, 1, 0, 1));
+  test_assert(0 == policies_parse_exit_policy(NULL, &policy2,
+                                              EXIT_POLICY_IPV6_ENABLED |
+                                              EXIT_POLICY_REJECT_PRIVATE |
+                                              EXIT_POLICY_ADD_DEFAULT, 0));
+
   test_assert(policy2);
 
   policy3 = smartlist_new();
@@ -193,7 +199,10 @@ test_policies_general(void *arg)
   line.key = (char*)"foo";
   line.value = (char*)"accept *:80,reject private:*,reject *:*";
   line.next = NULL;
-  test_assert(0 == policies_parse_exit_policy(&line, &policy, 1, 0, 0, 1));
+  
+  test_assert(0 == policies_parse_exit_policy(&line,&policy,
+                                              EXIT_POLICY_IPV6_ENABLED |
+                                              EXIT_POLICY_ADD_DEFAULT,0)); 
   test_assert(policy);
   //test_streq(policy->string, "accept *:80");
   //test_streq(policy->next->string, "reject *:*");





More information about the tor-commits mailing list