Implement fuzzy test for diff/verify and DataWithRoot
Opened this issue · 0 comments
vldm commented
Fully random test for diff/verify.
KeyLen - variable (in some short range [4..8] limited by nibbles values]
dataLen - variable (random with len [0..32])
Implement following algorithm:
- Generate Abstract::Map<Key, DataWithRoot>, DataWithRoot = Struct + storage:Map<Key, Data>
- Create trie from Map.
- Generate Abstract::Diff based on Map from 1 (Vector of random Inserts and removes from original Map) Vec<Key, DataWithRootChange> DataWithRootChange = Insert(Struct, Key, Data) | Remove(Key);
- Use Diff to create second trie
for verify:
- Clone first trie (from step 2)
- create diff and apply to create new trie.
assert:
- That diff can be created from first and second trie (step 2, step 5)
- Check that verify method return ok for diff creation method.
- Check that after apply internall storage from original db, and one that apply diffs is the same.