diff --git a/tests/headers.rs b/tests/headers.rs index ea3168a..ae8a075 100644 --- a/tests/headers.rs +++ b/tests/headers.rs @@ -2,7 +2,9 @@ mod tests { use tenjin::{ openflow::{ - controller_frame::ControllerFrame, ofp_manager::OfpMsgEvent, ofp_v1_0::Openflow10, + controller_frame::ControllerFrame, + ofp_manager::{OfpMsg, OfpMsgEvent}, + ofp_v1_0::Openflow10, }, Controller, }; @@ -13,7 +15,6 @@ mod tests { let controller = Controller::new(Openflow10::new()); let ofp = controller.get_ofp(); - let header = ofp.header_parse(&ofp_header_bytes); assert_eq!(header.version(), 1); @@ -21,4 +22,16 @@ mod tests { assert_eq!(header.length(), 8); assert_eq!(header.xid(), 1); } + #[test] + fn test_header_v1_0_marshal() { + let ofp_header_bytes: Vec = vec![1, 0, 0, 8, 0, 0, 0, 0]; + + let controller = Controller::new(Openflow10::new()); + let ofp = controller.get_ofp(); + let ofp_header = ofp.header(ofp.msg_usize(OfpMsg::Hello) as u8, 0, 0); + let mut bytes: Vec = Vec::new(); + ofp_header.marshal(&mut bytes); + + assert_eq!(ofp_header_bytes, bytes); + } }