Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: yoshidan <[email protected]>
  • Loading branch information
yoshidan committed Feb 27, 2024
1 parent 69dd94b commit bef26b3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/ibc/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,4 +989,15 @@ mod tests {
panic!("expected error");
}
}

#[test]
fn test_trim_left_zero() {
assert_eq!(trim_left_zero(&[1, 2, 3, 4]), [1, 2, 3, 4]);
assert_eq!(trim_left_zero(&[1, 2, 3, 0]), [1, 2, 3, 0]);
assert_eq!(trim_left_zero(&[0, 2, 3, 0]), [2, 3, 0]);
assert_eq!(trim_left_zero(&[0, 0, 3, 0]), [3, 0]);
assert_eq!(trim_left_zero(&[0, 0, 0, 4]), [4]);
assert!(trim_left_zero(&[0, 0, 0, 0]).is_empty());
assert!(trim_left_zero(&[]).is_empty());
}
}

0 comments on commit bef26b3

Please sign in to comment.