Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add tests
  • Loading branch information
ryoqun committed Mar 12, 2020
commit 8979cff726367b57381b3ed9be1004cd5181591c
18 changes: 18 additions & 0 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2951,6 +2951,24 @@ pub mod tests {
assert_eq!(1, db.get_snapshot_storages(after_slot).len());
}

#[test]
fn test_get_snapshot_storages_exclude_empty() {
let db = AccountsDB::new(Vec::new());

let key = Pubkey::default();
let account = Account::new(1, 0, &key);
let base_slot = 0;
let after_slot = base_slot + 1;

db.store(base_slot, &[(&key, &account)]);
db.add_root(base_slot);
assert_eq!(1, db.get_snapshot_storages(after_slot).len());

let storage = db.storage.read().unwrap();
storage.0[&0].values().next().unwrap().remove_account();
assert!(db.get_snapshot_storages(after_slot).is_empty());
}

#[test]
#[should_panic(expected = "double remove of account in slot: 0/store: 0!!")]
fn test_storage_remove_account_double_remove() {
Expand Down