mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-05 23:03:06 +00:00
add test_insert_item
This commit is contained in:
parent
fef23fb3b5
commit
887a8d9600
@ -97,4 +97,22 @@ mod tests {
|
||||
assert_eq!(smt.store.len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_insert_item() {
|
||||
let mut smt = UTXOSparseMerkleTree::new();
|
||||
let utxo = sample_utxo();
|
||||
|
||||
let result = smt.insert_item(utxo.clone());
|
||||
|
||||
// Test insertion is successful
|
||||
assert!(result.is_ok());
|
||||
|
||||
// Test UTXO is now stored in the tree
|
||||
assert_eq!(smt.store.get(&utxo.hash).unwrap().hash, utxo.hash);
|
||||
|
||||
// Test curr_root is updated
|
||||
assert!(smt.curr_root.is_some());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user