cuprate/net/epee-encoding/tests/alt_name.rs
hinto-janai 57af45e01d
Some checks are pending
Audit / audit (push) Waiting to run
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
Deny / audit (push) Waiting to run
Doc / build (push) Waiting to run
Doc / deploy (push) Blocked by required conditions
epee-encoding: enable workspace lints (#294)
* epee-encoding: enable workspace lints

* fmt

* fixes

* fixes

* fmt
2024-09-20 15:13:55 +01:00

37 lines
604 B
Rust

#![expect(unused_crate_dependencies, reason = "outer test module")]
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);
}