in src/tests.rs [83:113]
fn test_building_smt(list: &[(TreeIndex, P)]) -> SMT<P> {
let secret = &ALL_ZEROS_SECRET;
// Build the SMT from a list.
let mut build_tree = SMT::new(TREE_HEIGHT);
build_tree.build(&list, secret);
// Build the SMT by updating elements in the list one by one.
let mut update_tree = SMT::new(TREE_HEIGHT);
for item in list.iter() {
update_tree.update(&item.0, item.1.clone(), secret);
}
// The roots of two SMT should be the same.
assert_eq!(build_tree.get_root(), update_tree.get_root());
// Compare the types of nodes in the two differently constructed SMTs.
assert_eq!(
build_tree.get_leaves().len(),
update_tree.get_leaves().len()
);
assert_eq!(
build_tree.get_paddings().len(),
update_tree.get_paddings().len()
);
assert_eq!(
build_tree.get_internals().len(),
update_tree.get_internals().len()
);
build_tree
}