-macro_rules! decode_msg {
- ($MsgType: path, $data: expr) => {
- match <($MsgType)>::decode($data) {
- Ok(msg) => msg,
- Err(e) => match e {
- msgs::DecodeError::UnknownRealmByte => return,
- msgs::DecodeError::BadPublicKey => return,
- msgs::DecodeError::BadSignature => return,
- msgs::DecodeError::ExtraAddressesPerType => return,
- msgs::DecodeError::WrongLength => return,
+macro_rules! test_msg_exact {
+ ($MsgType: path, $data: ident) => {
+ {
+ if let Ok(msg) = <$MsgType as MsgDecodable>::decode($data){
+ let enc = msg.encode();
+ assert_eq!(&$data[..], &enc[..]);