-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use sov_modules_api::default_context::DefaultContext; | ||
use sov_modules_core::{StateReaderAndWriter, StorageKey, StorageValue, WorkingSet}; | ||
use sov_state::codec::BcsCodec; | ||
use sov_state::ProverStorage; | ||
|
||
#[test] | ||
fn test_workingset_get() { | ||
let tempdir = tempfile::tempdir().unwrap(); | ||
let path = tempdir.path(); | ||
let codec = BcsCodec {}; | ||
let storage = ProverStorage::<sov_state::DefaultStorageSpec>::with_path(path).unwrap(); | ||
|
||
let prefix = sov_modules_core::Prefix::new(vec![1, 2, 3]); | ||
let storage_key = StorageKey::new(&prefix, &vec![4, 5, 6], &codec); | ||
let storage_value = StorageValue::new(&vec![7, 8, 9], &codec); | ||
|
||
let mut working_set = WorkingSet::<DefaultContext>::new(storage.clone()); | ||
working_set.set(&storage_key, storage_value.clone()); | ||
|
||
assert_eq!(Some(storage_value), working_set.get(&storage_key)); | ||
} |