mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-12-23 12:09:57 +00:00
4b93dbec4c
Some checks failed
Audit / audit (push) Has been cancelled
Deny / audit (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / typo (push) Has been cancelled
CI / ci (macos-latest, stable, bash) (push) Has been cancelled
CI / ci (ubuntu-latest, stable, bash) (push) Has been cancelled
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (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`
39 lines
668 B
Rust
39 lines
668 B
Rust
use cuprate_epee_encoding::{epee_object, from_bytes};
|
|
|
|
struct T {
|
|
a: u8,
|
|
}
|
|
|
|
epee_object!(
|
|
T,
|
|
a: u8,
|
|
);
|
|
|
|
struct TT {
|
|
a: u8,
|
|
}
|
|
|
|
epee_object!(
|
|
TT,
|
|
a: u8 = 0,
|
|
);
|
|
|
|
#[test]
|
|
fn duplicate_key() {
|
|
let data = [
|
|
0x01, 0x11, 0x01, 0x1, 0x01, 0x01, 0x02, 0x1, 0x1, 0x08, 0x01, b'a', 0x0B, 0x00, 0x01,
|
|
b'a', 0x0B, 0x00,
|
|
];
|
|
|
|
assert!(from_bytes::<T, _>(&mut &data[..]).is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn duplicate_key_with_default() {
|
|
let data = [
|
|
0x01, 0x11, 0x01, 0x1, 0x01, 0x01, 0x02, 0x1, 0x1, 0x08, 0x01, b'a', 0x0B, 0x00, 0x01,
|
|
b'a', 0x0B, 0x00,
|
|
];
|
|
|
|
assert!(from_bytes::<TT, _>(&mut &data[..]).is_err());
|
|
}
|