diff --git a/common/strings/range_test.cc b/common/strings/range_test.cc index 6489c85db..1c19eea49 100644 --- a/common/strings/range_test.cc +++ b/common/strings/range_test.cc @@ -48,8 +48,8 @@ TEST(ByteOffsetRangeTest, EmptyInEmpty) { TEST(ByteOffsetRangeTest, RangeInvariant) { const absl::string_view superstring("xxxxxxxx"); - for (int i = 0; i < superstring.length(); ++i) { - for (int j = i; j < superstring.length(); ++j) { + for (size_t i = 0; i < superstring.length(); ++i) { + for (size_t j = i; j < superstring.length(); ++j) { const auto substring = superstring.substr(i, j - i); EXPECT_EQ(SubstringOffsets(substring, superstring), IntPair(i, j)) << i << ", " << j; @@ -60,8 +60,8 @@ TEST(ByteOffsetRangeTest, RangeInvariant) { // Tests that swapping substring with superstring fails. TEST(ByteOffsetRangeTest, InsideOut) { const absl::string_view superstring("yyyyyyy"); - for (int i = 0; i < superstring.length(); ++i) { - for (int j = i; j < superstring.length(); ++j) { + for (size_t i = 0; i < superstring.length(); ++i) { + for (size_t j = i; j < superstring.length(); ++j) { const auto substring = superstring.substr(i, j - i); EXPECT_DEATH(SubstringOffsets(superstring, substring), "") << i << ", " << j; @@ -71,8 +71,8 @@ TEST(ByteOffsetRangeTest, InsideOut) { TEST(ByteOffsetRangeTest, PartialOverlap) { const absl::string_view superstring("zzzz"); - for (int i = 0; i < superstring.length(); ++i) { - for (int j = 1; j < superstring.length(); ++j) { + for (size_t i = 0; i < superstring.length(); ++i) { + for (size_t j = 1; j < superstring.length(); ++j) { const auto left = superstring.substr(0, i); const auto right = superstring.substr(j); EXPECT_DEATH(SubstringOffsets(left, right), "") << i << ", " << j; diff --git a/common/util/range_test.cc b/common/util/range_test.cc index f442b1506..51a7a83fa 100644 --- a/common/util/range_test.cc +++ b/common/util/range_test.cc @@ -178,8 +178,8 @@ TEST(SubRangeIndicesTest, Empty) { TEST(SubRangeIndicesTest, RangeInvariant) { const std::vector supersequence(5); - for (int i = 0; i < supersequence.size(); ++i) { - for (int j = i; j < supersequence.size(); ++j) { + for (size_t i = 0; i < supersequence.size(); ++i) { + for (size_t j = i; j < supersequence.size(); ++j) { const auto subsequence = make_range(supersequence.begin() + i, supersequence.begin() + j); EXPECT_EQ(SubRangeIndices(subsequence, supersequence), IntPair(i, j)) @@ -191,8 +191,8 @@ TEST(SubRangeIndicesTest, RangeInvariant) { // Tests that swapping subsequence with supersequence fails. TEST(SubRangeIndicesTest, InsideOut) { const std::vector supersequence(5); - for (int i = 0; i < supersequence.size(); ++i) { - for (int j = i; j < supersequence.size(); ++j) { + for (size_t i = 0; i < supersequence.size(); ++i) { + for (size_t j = i; j < supersequence.size(); ++j) { const auto subsequence = make_range(supersequence.begin() + i, supersequence.begin() + j); EXPECT_DEATH(SubRangeIndices(supersequence, subsequence), "") @@ -203,8 +203,8 @@ TEST(SubRangeIndicesTest, InsideOut) { TEST(SubRangeIndicesTest, PartialOverlap) { const std::vector v(4); - for (int i = 0; i < v.size(); ++i) { - for (int j = 1; j < v.size(); ++j) { + for (size_t i = 0; i < v.size(); ++i) { + for (size_t j = 1; j < v.size(); ++j) { const auto left = make_range(v.begin(), v.begin() + i); const auto right = make_range(v.begin() + j, v.end()); EXPECT_DEATH(SubRangeIndices(left, right), "") << i << ", " << j;