mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
Replace ssz with ssz2, adapt ssz_derive
This commit is contained in:
22
eth2/utils/ssz_derive/tests/tests.rs
Normal file
22
eth2/utils/ssz_derive/tests/tests.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use ssz_derive::Encode;
|
||||
use ssz::Encodable;
|
||||
|
||||
#[derive(Debug, PartialEq, Encode)]
|
||||
pub struct Foo {
|
||||
a: u16,
|
||||
b: Vec<u8>,
|
||||
c: u16,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn encode() {
|
||||
let foo = Foo {
|
||||
a: 42,
|
||||
b: vec![0, 1, 2, 3],
|
||||
c: 11,
|
||||
};
|
||||
|
||||
let bytes = vec![42, 0, 8, 0, 0, 0, 11, 0, 0, 1, 2, 3];
|
||||
|
||||
assert_eq!(foo.as_ssz_bytes(), bytes);
|
||||
}
|
||||
Reference in New Issue
Block a user