mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-26 21:50:09 +00:00
4b93dbec4c
Some checks failed
CI / fmt (push) Waiting to run
CI / typo (push) Waiting to run
CI / ci (macos-latest, stable, bash) (push) Waiting to run
CI / ci (ubuntu-latest, stable, bash) (push) Waiting to run
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Waiting to run
Audit / audit (push) Has been cancelled
Deny / audit (push) Has been cancelled
* rename all directories and crates * fix all `use` * fix doc link * `dandelion/` -> `dandelion-tower/` * fix epee-encoding test * fix `json-rpc` * fix pruning * crate import fixes * fix leftover merge conflicts * fix `epee-encoding`
35 lines
535 B
Rust
35 lines
535 B
Rust
use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes};
|
|
|
|
struct AltName {
|
|
val: u8,
|
|
d: u64,
|
|
}
|
|
|
|
epee_object!(
|
|
AltName,
|
|
val("val2"): u8,
|
|
d: u64,
|
|
);
|
|
|
|
struct AltName2 {
|
|
val2: u8,
|
|
d: u64,
|
|
}
|
|
|
|
epee_object!(
|
|
AltName2,
|
|
val2: u8,
|
|
d: u64,
|
|
);
|
|
|
|
#[test]
|
|
fn epee_alt_name() {
|
|
let val2 = AltName2 { val2: 40, d: 30 };
|
|
let bytes = to_bytes(val2).unwrap();
|
|
|
|
let val: AltName = from_bytes(&mut bytes.clone()).unwrap();
|
|
|
|
let bytes2 = to_bytes(val).unwrap();
|
|
|
|
assert_eq!(bytes, bytes2);
|
|
}
|