Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
Improved unit tests for message peyload deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jan 27, 2019
1 parent 83acf9a commit e6ee7e5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/network/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,13 @@ mod test {
let msg = msg.unwrap();
assert_eq!(msg.magic, 0xd9b4bef9);
if let NetworkMessage::Version(version_msg) = msg.payload {
// TODO: do other checks
assert_eq!(version_msg.version, 70015);
assert_eq!(version_msg.services, 1037);
assert_eq!(version_msg.timestamp, 1548554224);
assert_eq!(version_msg.nonce, 13952548347456104954);
assert_eq!(version_msg.user_agent, "/Satoshi:0.17.1/");
assert_eq!(version_msg.start_height, 560275);
assert_eq!(version_msg.relay, true);
} else {
panic!("Wrong message type");
}
Expand Down Expand Up @@ -331,7 +337,13 @@ mod test {
let msg = msg.unwrap();
assert_eq!(msg.magic, 0xd9b4bef9);
if let NetworkMessage::Version(version_msg) = msg.payload {
// TODO: do other checks
assert_eq!(version_msg.version, 70015);
assert_eq!(version_msg.services, 1037);
assert_eq!(version_msg.timestamp, 1548554224);
assert_eq!(version_msg.nonce, 13952548347456104954);
assert_eq!(version_msg.user_agent, "/Satoshi:0.17.1/");
assert_eq!(version_msg.start_height, 560275);
assert_eq!(version_msg.relay, true);
} else {
panic!("Wrong message type");
}
Expand Down

0 comments on commit e6ee7e5

Please sign in to comment.