Skip to content

Commit 38a3ea0

Browse files
committed
Ensure comparisons of integers are of the same sign.
A lot of the comparisons we did previously seemed unsound - they compared integers of different signs. Catch didn't like this much, forcing us to change sign comparisons to be explicit.
1 parent f381498 commit 38a3ea0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

unit/util/dense_integer_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TEST_CASE("iterators", "[core][util][dense_integer_map]")
124124
REQUIRE(map.begin() != std::next(map.begin()));
125125
REQUIRE(map.begin() == map.begin());
126126
REQUIRE(map.size() == 2);
127-
REQUIRE(std::distance(map.begin(), map.end()) == map.size());
127+
REQUIRE(std::distance(map.begin(), map.end()) == (ptrdiff_t)map.size());
128128

129129
{
130130
const auto &const_map = map;

unit/util/sharing_map.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ void sharing_map_internals_test()
257257
delta_view.clear();
258258
sm2.get_delta_view(sm1, delta_view, false);
259259
REQUIRE(delta_view.size() == 1);
260-
REQUIRE(delta_view[0].k == (1 << (2 * chunk)));
260+
REQUIRE(delta_view[0].k == (unsigned)(1 << (2 * chunk)));
261261
}
262262
}
263263
}
@@ -675,12 +675,12 @@ TEST_CASE("Sharing map views and iteration", "[core][util]")
675675
REQUIRE(delta_view[0].m == "a");
676676
REQUIRE(delta_view[0].get_other_map_value() == "c");
677677

678-
REQUIRE(delta_view[1].k == 1 << (2 * chunk));
678+
REQUIRE(delta_view[1].k == (unsigned)1 << (2 * chunk));
679679
REQUIRE(delta_view[1].m == "b");
680680
}
681681
else
682682
{
683-
REQUIRE(delta_view[0].k == 1 << (2 * chunk));
683+
REQUIRE(delta_view[0].k == (unsigned)1 << (2 * chunk));
684684
REQUIRE(delta_view[0].m == "b");
685685

686686
REQUIRE(delta_view[1].k == 0);

unit/util/small_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void small_map_test()
4646

4747
SECTION("Iterator")
4848
{
49-
small_mapt<int> m;
49+
small_mapt<unsigned int> m;
5050

5151
m[0] = 0;
5252
m[3] = 3;

0 commit comments

Comments
 (0)