diff options
author | Simon THOBY <git@nightmared.fr> | 2021-11-15 22:08:56 +0100 |
---|---|---|
committer | lafleur <lafleur@boum.org> | 2021-11-26 12:07:37 +0100 |
commit | b1a772c3ceae16001743d1df9b47161e9bc461b6 (patch) | |
tree | 845bc86735dfd4a1a3af81e4a73acb1df726b5aa /tests/lib.rs | |
parent | 5b13a4d8ac88a46b877598351ef10f35aebb9999 (diff) |
tests: add tests for `Chain`s
Diffstat (limited to 'tests/lib.rs')
-rw-r--r-- | tests/lib.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/lib.rs b/tests/lib.rs index a5a3b45..af599a5 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -92,16 +92,22 @@ pub struct Nfgenmsg { res_id: u16, /* resource id */ } -pub fn get_test_rule() -> Rule { - let table = Rc::new(Table::new( +pub fn get_test_table() -> Table { + Table::new( &CStr::from_bytes_with_nul(TABLE_NAME).unwrap(), ProtoFamily::Inet, - )); - let chain = Rc::new(Chain::new( + ) +} + +pub fn get_test_chain() -> Chain { + Chain::new( &CStr::from_bytes_with_nul(CHAIN_NAME).unwrap(), - Rc::clone(&table), - )); - let rule = Rule::new(Rc::clone(&chain)); + Rc::new(get_test_table()), + ) +} + +pub fn get_test_rule() -> Rule { + let rule = Rule::new(Rc::new(get_test_chain())); rule } |