|
|
|
@ -14,6 +14,7 @@ mod error;
|
|
|
|
|
mod tests { |
|
|
|
|
use crate::ironforce::IronForce; |
|
|
|
|
use crate::message::{MsgType, Message}; |
|
|
|
|
use crate::crypto::KeyPack; |
|
|
|
|
use alloc::vec::Vec; |
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
@ -23,8 +24,20 @@ mod tests {
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
fn serialization() { |
|
|
|
|
let msg = crate::message::Message::new(MsgType::MultiCast, Vec::<u8>::new(), crate::crypto::KeyPack::gen()); |
|
|
|
|
let serialized = msg.ser(); |
|
|
|
|
let msg2 = Message::deserialize(serialized); |
|
|
|
|
let key_pack = KeyPack::gen(); |
|
|
|
|
let msg = Message::new( |
|
|
|
|
MsgType::MultiCast, Vec::<u8>::new(), key_pack |
|
|
|
|
); |
|
|
|
|
let serialized = &msg.ser(); |
|
|
|
|
let msg2 = Message::deserialize(serialized.to_vec()); |
|
|
|
|
assert_eq!(msg2.msg_type, MsgType::MultiCast); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
fn test_hash() { |
|
|
|
|
let msg = Message::new( |
|
|
|
|
MsgType::MultiCast, Vec::<u8>::new(), crate::crypto::KeyPack::gen() |
|
|
|
|
); |
|
|
|
|
msg.get_hash(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|