diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/expr.rs | 2 | ||||
-rw-r--r-- | tests/lib.rs | 4 | ||||
-rw-r--r-- | tests/set.rs | 6 |
3 files changed, 5 insertions, 7 deletions
diff --git a/tests/expr.rs b/tests/expr.rs index 9f1644c..4af18f2 100644 --- a/tests/expr.rs +++ b/tests/expr.rs @@ -281,7 +281,7 @@ fn lookup_expr_is_valid() { let set_name = &CStr::from_bytes_with_nul(b"mockset\0").unwrap(); let mut rule = get_test_rule(); let table = rule.get_chain().get_table(); - let mut set = Set::new(set_name, 0, &table, ProtoFamily::Inet); + let mut set = Set::new(set_name, 0, table, ProtoFamily::Inet); let address: Ipv4Addr = [8, 8, 8, 8].into(); set.add(&address); let lookup = Lookup::new(&set).unwrap(); diff --git a/tests/lib.rs b/tests/lib.rs index c30f881..0d7132c 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -115,11 +115,11 @@ pub fn get_test_rule() -> Rule { Rule::new(Rc::new(get_test_chain())) } -pub fn get_test_set<'a, T: SetKey>(table: &'a Table) -> Set<'a, T> { +pub fn get_test_set<T: SetKey>() -> Set<T> { Set::new( CStr::from_bytes_with_nul(SET_NAME).unwrap(), SET_ID, - table, + Rc::new(get_test_table()), ProtoFamily::Ipv4, ) } diff --git a/tests/set.rs b/tests/set.rs index a357a13..d5b2ad7 100644 --- a/tests/set.rs +++ b/tests/set.rs @@ -9,8 +9,7 @@ use lib::*; #[test] fn new_empty_set() { - let table = get_test_table(); - let mut set = get_test_set::<Ipv4Addr>(&table); + let mut set = get_test_set::<Ipv4Addr>(); let (nlmsghdr, _nfgenmsg, raw_expr) = get_test_nlmsg(&mut set); assert_eq!( get_operation_from_nlmsghdr_type(nlmsghdr.nlmsg_type), @@ -39,8 +38,7 @@ fn new_empty_set() { #[test] fn delete_empty_set() { - let table = get_test_table(); - let mut set = get_test_set::<Ipv6Addr>(&table); + let mut set = get_test_set::<Ipv6Addr>(); let (nlmsghdr, _nfgenmsg, raw_expr) = get_test_nlmsg_with_msg_type(&mut set, MsgType::Del); assert_eq!( get_operation_from_nlmsghdr_type(nlmsghdr.nlmsg_type), |