This commit is contained in:
Simon Gardling
2023-03-24 09:49:54 -04:00
parent cce932400a
commit 592a67a304
6 changed files with 26 additions and 17 deletions

View File

@@ -62,20 +62,18 @@ fn option_vec_printer() {
#[test]
fn hashed_storage() {
use ytbn_graphing_software::{hashed_storage_create, hashed_storage_read};
use ytbn_graphing_software::{hashed_storage_read, HashBytesHelper};
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 = hashed_storage_create(
commit
.as_slice()
.try_into()
.expect("cannot turn into [u8; 8]"),
data.as_slice(),
);
let storage_tmp: [u8; 8] = commit
.as_slice()
.try_into()
.expect("cannot turn into [u8; 8]");
let storage = storage_tmp.hashed_storage_create(data.as_slice());
let read = hashed_storage_read(&storage);
assert_eq!(