Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/util/symbol_table_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ class symbol_table_baset
typedef symbolst::const_iterator::reference reference; // NOLINT
typedef symbolst::iterator::iterator_category iterator_category; // NOLINT

bool operator!=(const iteratort &other) const
{
return it != other.it;
}

bool operator==(const iteratort &other) const
{
return it == other.it;
Expand Down
19 changes: 19 additions & 0 deletions unit/util/symbol_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@
#include <testing-utils/catch.hpp>
#include <util/journalling_symbol_table.h>

TEST_CASE("Iterating through a symbol table", "[core][utils][symbol_tablet]")
{
symbol_tablet symbol_table;

symbolt symbol;
irep_idt symbol_name = "Test";
symbol.name = symbol_name;

symbol_table.insert(symbol);

int counter = 0;
for(auto &entry : symbol_table)
{
++counter;
}

REQUIRE(counter == 1);
}

SCENARIO("journalling_symbol_table_writer",
"[core][utils][journalling_symbol_table_writer]")
{
Expand Down