Merge rust-bitcoin/rust-bitcoin#2351: Remove `Cursor` usage in `PublicKey` unit test
3ea44a166b
Remove usage of Cursor in pubkey sanity checks (Tobin C. Harding)35b5350088
Remove usage of Cursor in multi key read (Tobin C. Harding) Pull request description: We do not need to use `Cursor` in these tests, remove the usage. PR touches test code only. ACKs for top commit: Kixunil: ACK3ea44a166b
apoelstra: ACK3ea44a166b
Tree-SHA512: 9fefdc4a8d7fcf3dd09fa60b993f5a61e55865b830c9519efd2de99c4e871cf665facc68fd6c06829d166e76e181fe2026ab5475e7fc6241a5d627212a2cff2f
This commit is contained in:
commit
0d0eee5597
|
@ -1096,21 +1096,21 @@ mod tests {
|
|||
k.write_into(&mut v).expect("writing into vec");
|
||||
}
|
||||
|
||||
let mut reader = v.as_slice();
|
||||
let mut dec_keys = vec![];
|
||||
let mut cursor = io::Cursor::new(&v);
|
||||
for _ in 0..N_KEYS {
|
||||
dec_keys.push(PublicKey::read_from(&mut cursor).expect("reading from vec"));
|
||||
dec_keys.push(PublicKey::read_from(&mut reader).expect("reading from vec"));
|
||||
}
|
||||
|
||||
assert_eq!(keys, dec_keys);
|
||||
assert!(PublicKey::read_from(&mut reader).is_err());
|
||||
|
||||
// sanity checks
|
||||
assert!(PublicKey::read_from(&mut cursor).is_err());
|
||||
assert!(PublicKey::read_from(&mut io::Cursor::new(&[])).is_err());
|
||||
assert!(PublicKey::read_from(&mut io::Cursor::new(&[0; 33][..])).is_err());
|
||||
assert!(PublicKey::read_from(&mut io::Cursor::new(&[2; 32][..])).is_err());
|
||||
assert!(PublicKey::read_from(&mut io::Cursor::new(&[0; 65][..])).is_err());
|
||||
assert!(PublicKey::read_from(&mut io::Cursor::new(&[4; 64][..])).is_err());
|
||||
let mut empty: &[u8] = &[];
|
||||
assert!(PublicKey::read_from(&mut empty).is_err());
|
||||
assert!(PublicKey::read_from(&mut &[0; 33][..]).is_err());
|
||||
assert!(PublicKey::read_from(&mut &[2; 32][..]).is_err());
|
||||
assert!(PublicKey::read_from(&mut &[0; 65][..]).is_err());
|
||||
assert!(PublicKey::read_from(&mut &[4; 64][..]).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in New Issue