tests: lamports += to checked_add (#16842)
This commit is contained in:
committed by
GitHub
parent
d533f77301
commit
8f56c116d7
@ -241,7 +241,7 @@ impl ReadOnlyAccountsCache {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use solana_sdk::account::{accounts_equal, Account};
|
use solana_sdk::account::{accounts_equal, Account, WritableAccount};
|
||||||
#[test]
|
#[test]
|
||||||
fn test_accountsdb_sizeof() {
|
fn test_accountsdb_sizeof() {
|
||||||
// size_of(arc(x)) does not return the size of x
|
// size_of(arc(x)) does not return the size of x
|
||||||
@ -278,9 +278,9 @@ pub mod tests {
|
|||||||
..Account::default()
|
..Account::default()
|
||||||
});
|
});
|
||||||
let mut account2 = account1.clone();
|
let mut account2 = account1.clone();
|
||||||
account2.lamports += 1; // so they compare differently
|
account2.checked_add_lamports(1).unwrap(); // so they compare differently
|
||||||
let mut account3 = account1.clone();
|
let mut account3 = account1.clone();
|
||||||
account3.lamports += 4; // so they compare differently
|
account3.checked_add_lamports(4).unwrap(); // so they compare differently
|
||||||
cache.store(&key1, slot, &account1);
|
cache.store(&key1, slot, &account1);
|
||||||
assert_eq!(100 + per_account_size, cache.data_size());
|
assert_eq!(100 + per_account_size, cache.data_size());
|
||||||
assert!(accounts_equal(&cache.load(&key1, slot).unwrap(), &account1));
|
assert!(accounts_equal(&cache.load(&key1, slot).unwrap(), &account1));
|
||||||
|
Reference in New Issue
Block a user