Browse Source

Add test that `last` and `element` will throw exception when the tree is blank.

metaverse
Sean Bowe 8 years ago
parent
commit
3e2e8b5b42
  1. 4
      src/gtest/test_merkletree.cpp

4
src/gtest/test_merkletree.cpp

@ -76,6 +76,9 @@ void test_tree(
// empty tree.
ASSERT_TRUE(tree.root() == Tree::empty_root());
// The tree doesn't have a 'last' element added since it's blank.
ASSERT_THROW(tree.last(), std::runtime_error);
// We need to witness at every single point in the tree, so
// that the consistency of the tree and the merkle paths can
// be checked.
@ -107,6 +110,7 @@ void test_tree(
if (first) {
ASSERT_THROW(wit.path(), std::runtime_error);
ASSERT_THROW(wit.element(), std::runtime_error);
} else {
auto path = wit.path();

Loading…
Cancel
Save