Add a parse_vout test

Add a test to kill the mutants in parse_vout().
This commit is contained in:
Jamil Lambert, PhD 2025-02-10 14:17:51 +00:00
parent 957be3c978
commit 435750f292
No known key found for this signature in database
GPG Key ID: 54DC29234AB5D2C0
1 changed files with 8 additions and 0 deletions

View File

@ -669,4 +669,12 @@ mod tests {
let outpoint: Result<OutPoint, ParseOutPointError> = outpoint_str.parse();
assert_eq!(outpoint, Err(ParseOutPointError::TooLong));
}
#[test]
fn canonical_vout() {
assert_eq!(parse_vout("0").unwrap(), 0);
assert_eq!(parse_vout("1").unwrap(), 1);
assert!(parse_vout("01").is_err()); // Leading zero not allowed
assert!(parse_vout("+1").is_err()); // Non digits not allowed
}
}