use ssz::{Decodable, Encodable}; fn round_trip(item: T) { let encoded = &item.as_ssz_bytes(); dbg!(encoded); assert_eq!(T::from_ssz_bytes(&encoded), Ok(item)); } #[test] fn vec_u16_round_trip() { round_trip::>(vec![]); round_trip::>(vec![255]); round_trip::>(vec![0, 1, 2]); round_trip::>(vec![100; 64]); } #[test] fn vec_of_vec_u16_round_trip() { round_trip::>>(vec![]); round_trip::>>(vec![vec![]]); round_trip::>>(vec![vec![1, 2, 3]]); round_trip::>>(vec![vec![], vec![]]); round_trip::>>(vec![vec![], vec![1, 2, 3]]); round_trip::>>(vec![vec![1, 2, 3], vec![1, 2, 3]]); round_trip::>>(vec![vec![1, 2, 3], vec![], vec![1, 2, 3]]); round_trip::>>(vec![vec![], vec![], vec![1, 2, 3]]); round_trip::>>(vec![vec![], vec![1], vec![1, 2, 3]]); round_trip::>>(vec![vec![], vec![1], vec![1, 2, 3]]); }