Skip to content

Commit

Permalink
Merge pull request diffblue#1811 from cesaro/iterator-fix
Browse files Browse the repository at this point in the history
Fixes the symbol_base_tablet iterator
  • Loading branch information
cesaro authored Feb 8, 2018
2 parents 0df054c + 807268e commit 2c69364
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
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

0 comments on commit 2c69364

Please sign in to comment.