Fix rent debits test (#21177)

This commit is contained in:
Justin Starry 2021-11-04 20:03:19 +00:00 committed by GitHub
parent 4e527b84b0
commit 0597594943
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 9 deletions

View File

@ -14893,19 +14893,13 @@ pub(crate) mod tests {
let mut rent_debits = RentDebits::default();
// No entry for 0 rewards
rent_debits.insert(&Pubkey::default(), 0, 0);
rent_debits.insert(&Pubkey::new_unique(), 0, 0);
assert_eq!(rent_debits.0.len(), 0);
// Doesn't fit an `i64`, no entry. (we'll die elsewhere)
rent_debits.insert(&Pubkey::default(), u64::MAX, 0);
assert_eq!(rent_debits.0.len(), 0);
// Since we're casting from `u64` the `i64::checked_neg()` is infallible
// Some that actually work
rent_debits.insert(&Pubkey::default(), 1, 0);
rent_debits.insert(&Pubkey::new_unique(), 1, 0);
assert_eq!(rent_debits.0.len(), 1);
rent_debits.insert(&Pubkey::default(), i64::MAX as u64, 0);
rent_debits.insert(&Pubkey::new_unique(), i64::MAX as u64, 0);
assert_eq!(rent_debits.0.len(), 2);
}