test: ensure push_int check i32::MIN of overflow error

This commit is contained in:
Chris Hyunhum Cho 2024-09-26 10:05:44 +09:00 committed by GitHub
parent c9988ba8cb
commit a33bcd3654
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -916,3 +916,9 @@ fn instruction_script_num_parse() {
Some(Ok(Instruction::PushBytes(PushBytes::empty()))),
);
}
#[test]
fn script_push_int_overflow() {
// Only errors if `data == i32::MIN` (CScriptNum cannot have value -2^31).
assert_eq!(Builder::new().push_int(i32::MIN), Err(Error::NumericOverflow));
}