Skip to content

Commit d2ba9d1

Browse files
author
Thomas Kiley
committed
Add tests for equality and inequality
1 parent d41f59d commit d2ba9d1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

unit/util/interval/comparisons.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,32 @@ SCENARIO("comparison interval domain", "[core][analyses][interval][comparison]")
237237
}
238238
}
239239
}
240+
241+
TEST_CASE("interval::equality", "[core][analyses][interval]")
242+
{
243+
SECTION("Single element intervals")
244+
{
245+
constant_interval_exprt two(CEV(2));
246+
constant_interval_exprt four(CEV(4));
247+
248+
REQUIRE_FALSE(two.equal(four).is_true());
249+
REQUIRE(two.equal(two).is_true());
250+
251+
REQUIRE(two.not_equal(four).is_true());
252+
REQUIRE_FALSE(two.not_equal(two).is_true());
253+
}
254+
SECTION("Proper intervals")
255+
{
256+
constant_interval_exprt two_to_four(CEV(2), CEV(4));
257+
constant_interval_exprt six_to_eight(CEV(6), CEV(8));
258+
constant_interval_exprt five_to_ten(CEV(5), CEV(10));
259+
260+
// TODO: wrongly concludes that these are unequal
261+
// ADA-537
262+
// REQUIRE(two_to_four.equal(six_to_eight).is_unknown());
263+
REQUIRE_FALSE(two_to_four.equal(five_to_ten).is_true());
264+
265+
REQUIRE_FALSE(two_to_four.not_equal(six_to_eight).is_unknown());
266+
REQUIRE(two_to_four.not_equal(five_to_ten).is_true());
267+
}
268+
}

0 commit comments

Comments
 (0)