Skip to content

Commit

Permalink
test new ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Aug 20, 2024
1 parent ceb7813 commit 509802a
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ mod tests {
}

#[test]
fn test_messages_to_user_ctor() {
fn test_messages_to_user_ctor_owned() {
let msg_to_user = MsgToUserTlv::new(&[1, 2, 3]).expect("creating message to user failed");
let put_request = PutRequestOwned::new_msgs_to_user_only(DEST_ID.into(), &[msg_to_user])
.expect("creating msgs to user only put request failed");
Expand All @@ -707,4 +707,20 @@ mod tests {
assert_eq!(msg_to_user_tlv.tlv_type().unwrap(), TlvType::MsgToUser);
}
}

#[test]
fn test_messages_to_user_ctor() {
let msg_to_user = MsgToUserTlv::new(&[1, 2, 3]).expect("creating message to user failed");
let binding = &[msg_to_user.to_tlv()];
let put_request = PutRequest::new_msgs_to_user_only(DEST_ID.into(), binding)
.expect("creating msgs to user only put request failed");
let msg_to_user_iter = put_request.msgs_to_user();
assert!(msg_to_user_iter.is_some());
let msg_to_user_iter = msg_to_user_iter.unwrap();
for msg_to_user_tlv in msg_to_user_iter {
assert_eq!(msg_to_user_tlv.value(), msg_to_user.value());
assert_eq!(msg_to_user_tlv.tlv_type().unwrap(), TlvType::MsgToUser);
}

}
}

0 comments on commit 509802a

Please sign in to comment.