add reset option for test, to simulate serializing and deserializing
@@ -295,6 +295,7 @@ where
#[cfg(test)]
mod tests {
use arbitrary::{Arbitrary, Unstructured};
+ use borsh::{BorshDeserialize, BorshSerialize};
use rand::{Rng, RngCore, SeedableRng};
use super::Vector;
@@ -495,6 +496,7 @@ mod tests {
Set(u32, u8),
Remove(u32),
Flush,
+ Reset,
Get(u32),
Swap(u32, u32),
}
@@ -550,6 +552,10 @@ mod tests {
Op::Flush => {
sv.flush();
}
+ Op::Reset => {
+ let serialized = sv.try_to_vec().unwrap();
+ sv = Vector::deserialize(&mut serialized.as_slice()).unwrap();
+ }
Op::Get(k) => {
let r1 = sv.get(k);
let r2 = mv.get(k as usize);
