test: Add conditional check for debug_assertions

Adding debug_assertions where the test case panics allows the test suite
to run in release mode successfully.
This commit is contained in:
yancy 2024-02-10 12:30:47 +01:00
parent 53461f71c9
commit 1d13020129
4 changed files with 8 additions and 0 deletions

View File

@ -489,6 +489,7 @@ mod test {
}
#[test]
#[cfg(debug_assertions)]
#[should_panic] // 'attempt to add with overflow' in consensus_encode()
fn test_getblocktx_panic_when_encoding_u64_max() {
serialize(&BlockTransactionsRequest {

View File

@ -190,6 +190,7 @@ mod tests {
}
#[test]
#[cfg(debug_assertions)]
#[should_panic]
fn from_sat_per_vb_unchecked_panic_test() { FeeRate::from_sat_per_vb_unchecked(u64::MAX); }

View File

@ -182,6 +182,7 @@ mod tests {
}
#[test]
#[cfg(debug_assertions)]
#[should_panic]
fn from_vb_unchecked_panic() { Weight::from_vb_unchecked(u64::MAX); }

View File

@ -1692,22 +1692,27 @@ mod tests {
}
#[test]
#[cfg(debug_assertions)]
#[should_panic]
fn u256_overflowing_addition_panics() { let _ = U256::MAX + U256::ONE; }
#[test]
#[cfg(debug_assertions)]
#[should_panic]
fn u256_overflowing_subtraction_panics() { let _ = U256::ZERO - U256::ONE; }
#[test]
#[cfg(debug_assertions)]
#[should_panic]
fn u256_multiplication_by_max_panics() { let _ = U256::MAX * U256::MAX; }
#[test]
#[cfg(debug_assertions)]
#[should_panic]
fn work_overflowing_addition_panics() { let _ = Work(U256::MAX) + Work(U256::ONE); }
#[test]
#[cfg(debug_assertions)]
#[should_panic]
fn work_overflowing_subtraction_panics() { let _ = Work(U256::ZERO) - Work(U256::ONE); }