diff --git a/src/tests/util/trie.cpp b/src/tests/util/trie.cpp index 6ee1b4c24..a8562024e 100644 --- a/src/tests/util/trie.cpp +++ b/src/tests/util/trie.cpp @@ -29,8 +29,11 @@ static void tst1() { lean_assert(!find(t, "abd")); t2.display(std::cout); ctrie t3 = *t2.find('a'); + lean_assert(!t3.value()); lean_assert(*find(t3, "bc") == 10); lean_assert(*find(t3, "bd") == 11); + ctrie t4 = *(t3.find('b')->find('c')); + lean_assert(*t4.value() == 10); } static void tst2() { diff --git a/src/util/trie.h b/src/util/trie.h index 9f843d6e7..16fce2814 100644 --- a/src/util/trie.h +++ b/src/util/trie.h @@ -130,6 +130,10 @@ public: return optional(); } + optional value() const { + return m_root->m_value; + } + void merge(trie const & t) { m_root = merge(m_root.steal(), t.m_root); }