Skip to content

Commit

Permalink
add ChainId::validate_length in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed Nov 3, 2023
1 parent 02fb312 commit a19ac45
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/ibc/src/core/ics24_host/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,10 @@ mod tests {
#[case] chain_name: &str,
#[case] revision_number: u64,
) {
let chain_id = ChainId::new(raw_chain_id).unwrap();
assert!(chain_id.validate_length(1, 64).is_ok());
assert_eq!(
ChainId::new(raw_chain_id).unwrap(),
chain_id,
ChainId {
id: format!("{chain_name}-{revision_number}"),
revision_number
Expand All @@ -567,12 +569,14 @@ mod tests {
#[case(&"A".repeat(64))]
#[case::special_case("chainA-0")]
fn test_valid_chain_id_without_rev(#[case] chain_name: &str) {
let chain_id = ChainId::new(chain_name).unwrap();
assert!(chain_id.validate_length(1, 64).is_ok());
assert_eq!(
chain_id,
ChainId {
id: chain_name.into(),
revision_number: 0
},
ChainId::new(chain_name).unwrap()
}
);
}

Expand Down

0 comments on commit a19ac45

Please sign in to comment.