make caching system more robust

This commit is contained in:
Simon Gardling
2022-05-11 18:33:06 -04:00
parent cd930966b9
commit 8d4a315a96
7 changed files with 60 additions and 16 deletions

View File

@@ -1,3 +1,5 @@
use ytbn_graphing_software::{storage_create, storage_read};
/// Tests [`SteppedVector`] to ensure everything works properly (helped me find a bunch of issues)
#[test]
fn stepped_vector() {
@@ -93,3 +95,17 @@ fn option_vec_printer() {
assert_eq!(option_vec_printer(&key), value);
}
}
#[test]
fn storage() {
let commit = "abcdefeg".chars().map(|c| c as u8).collect::<Vec<u8>>();
let data = "really cool data"
.chars()
.map(|c| c as u8)
.collect::<Vec<u8>>();
let storage = storage_create(commit.as_slice(), data.as_slice());
let read = storage_read(storage);
assert_eq!(read.0.chars().map(|c| c as u8).collect::<Vec<u8>>(), commit);
assert_eq!(read.1, data);
}