From bef26b3df5317fcf7192635bfc10af3c5a3f5f9b Mon Sep 17 00:00:00 2001 From: yoshidan Date: Tue, 27 Feb 2024 23:13:52 +0900 Subject: [PATCH] add test Signed-off-by: yoshidan --- crates/ibc/src/client_state.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/ibc/src/client_state.rs b/crates/ibc/src/client_state.rs index 370f8d9..9af104b 100644 --- a/crates/ibc/src/client_state.rs +++ b/crates/ibc/src/client_state.rs @@ -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()); + } }