mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore(db): Add tests and fuzz target to BlockNumHash (#130)
* add tests and fuzz target for BlockNumHash * use block 1 for test_block_num_hash * new clippy stds * fmt
This commit is contained in:
@ -18,7 +18,7 @@ fn bench_encode(c: &mut Criterion) {
|
||||
c.bench_function("encode_u64", |b| {
|
||||
b.iter(|| {
|
||||
let mut out = BytesMut::new();
|
||||
let _ = 0x1023_4567_89ab_cdefu64.encode(&mut out);
|
||||
0x1023_4567_89ab_cdefu64.encode(&mut out);
|
||||
})
|
||||
});
|
||||
c.bench_function("encode_u256", |b| {
|
||||
|
||||
@ -392,9 +392,9 @@ mod tests {
|
||||
#[test]
|
||||
fn rlp_strings() {
|
||||
check_decode::<Bytes, _>(vec![
|
||||
(Ok((&hex!("00")[..]).to_vec().into()), &hex!("00")[..]),
|
||||
(Ok(hex!("00")[..].to_vec().into()), &hex!("00")[..]),
|
||||
(
|
||||
Ok((&hex!("6f62636465666768696a6b6c6d")[..]).to_vec().into()),
|
||||
Ok(hex!("6f62636465666768696a6b6c6d")[..].to_vec().into()),
|
||||
&hex!("8D6F62636465666768696A6B6C6D")[..],
|
||||
),
|
||||
(Err(DecodeError::UnexpectedList), &hex!("C0")[..]),
|
||||
|
||||
@ -65,7 +65,7 @@ fn test_encode_item() {
|
||||
let decoded = Decodable::decode(&mut &*expected).unwrap();
|
||||
assert_eq!(item, decoded);
|
||||
|
||||
let mut rlp_view = Rlp::new(&*expected).unwrap();
|
||||
let mut rlp_view = Rlp::new(&expected).unwrap();
|
||||
assert_eq!(rlp_view.get_next().unwrap(), Some(item.a));
|
||||
assert_eq!(rlp_view.get_next().unwrap(), Some(item.b));
|
||||
assert_eq!(rlp_view.get_next().unwrap(), Some(item.c));
|
||||
|
||||
Reference in New Issue
Block a user