Correct tests which should've failed to expect failures now that they fail

This commit is contained in:
Luke Parker 2024-07-12 03:09:48 -04:00
parent 4ba961b2cb
commit 32c24917c4
No known key found for this signature in database

View file

@ -105,15 +105,13 @@ fn padding_only_max_size() {
#[test]
fn padding_only_exceed_max_size() {
let buf: Vec<u8> = vec![0; MAX_TX_EXTRA_PADDING_COUNT + 1];
let extra = Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap();
assert!(extra.0.is_empty());
Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap_err();
}
#[test]
fn invalid_padding_only() {
let buf: Vec<u8> = vec![0, 42];
let extra = Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap();
assert!(extra.0.is_empty());
Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap_err();
}
#[test]
@ -137,8 +135,7 @@ fn extra_nonce_only_wrong_size() {
let mut buf: Vec<u8> = vec![0; 20];
buf[0] = 2;
buf[1] = 255;
let extra = Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap();
assert!(extra.0.is_empty());
Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap_err();
}
#[test]
@ -158,8 +155,7 @@ fn pub_key_and_padding() {
fn pub_key_and_invalid_padding() {
let mut buf: Vec<u8> = PUB_KEY_BYTES.to_vec();
buf.extend([0, 1]);
let extra = Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap();
assert_eq!(extra.0, vec![ExtraField::PublicKey(pub_key())]);
Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap_err();
}
#[test]
@ -185,8 +181,7 @@ fn extra_mysterious_minergate_only_wrong_size() {
let mut buf: Vec<u8> = vec![0; 20];
buf[0] = 222;
buf[1] = 255;
let extra = Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap();
assert!(extra.0.is_empty());
Extra::read::<&[u8]>(&mut buf.as_ref()).unwrap_err();
}
#[test]