Skip to content

Commit 45ef48e

Browse files
committed
Add operator== to smt_sortt
1 parent 73216ab commit 45ef48e

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/solvers/smt2_incremental/smt_sorts.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
#include <solvers/smt2_incremental/smt_sorts.def>
1111
#undef SORT_ID
1212

13+
bool smt_sortt::operator==(const smt_sortt &other) const
14+
{
15+
return irept::operator==(other);
16+
}
17+
18+
bool smt_sortt::operator!=(const smt_sortt &other) const
19+
{
20+
return !(*this == other);
21+
}
22+
1323
smt_bool_sortt::smt_bool_sortt() : smt_sortt{ID_smt_bool_sort}
1424
{
1525
}

src/solvers/smt2_incremental/smt_sorts.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class smt_sortt : protected irept
2020

2121
using irept::pretty;
2222

23+
bool operator==(const smt_sortt &) const;
24+
bool operator!=(const smt_sortt &) const;
25+
2326
void accept(smt_sort_const_downcast_visitort &) const;
2427
void accept(smt_sort_const_downcast_visitort &&) const;
2528

unit/solvers/smt2_incremental/smt_sorts.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,16 @@ TEST_CASE("Visiting smt_bit_vec_sortt.", "[core][smt2_incremental]")
7777
REQUIRE_FALSE(visitor.bool_visited);
7878
REQUIRE(visitor.bit_vec_visited);
7979
}
80+
81+
TEST_CASE("smt_sortt equality", "[core][smt2_incremental]")
82+
{
83+
const smt_bool_sortt bool_sort1;
84+
CHECK(bool_sort1 == bool_sort1);
85+
const smt_bool_sortt bool_sort2;
86+
CHECK(bool_sort1 == bool_sort2);
87+
const smt_bit_vector_sortt bit_vector8{8};
88+
CHECK(bit_vector8 == bit_vector8);
89+
CHECK(bit_vector8 != bool_sort1);
90+
const smt_bit_vector_sortt bit_vector16{16};
91+
CHECK(bit_vector8 != bit_vector16);
92+
}

0 commit comments

Comments
 (0)