mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 12:28:24 +00:00
Add partial progress on sos
This commit is contained in:
22
eth2/utils/ssz2/tests/tests.rs
Normal file
22
eth2/utils/ssz2/tests/tests.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use ssz2::{Decodable, Encodable};
|
||||
|
||||
fn round_trip<T: Encodable + Decodable + std::fmt::Debug + PartialEq>(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<u16>>(vec![]);
|
||||
round_trip::<Vec<u16>>(vec![255]);
|
||||
round_trip::<Vec<u16>>(vec![0, 1, 2]);
|
||||
round_trip::<Vec<u16>>(vec![100; 64]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vec_of_vec_u16_round_trip() {
|
||||
// round_trip::<Vec<Vec<u16>>>(vec![]);
|
||||
round_trip::<Vec<Vec<u16>>>(vec![vec![]]);
|
||||
// round_trip::<Vec<Vec<u16>>>(vec![vec![], vec![]]);
|
||||
}
|
||||
Reference in New Issue
Block a user