Commit bff33bd5 authored by Miloš Stojanović's avatar Miloš Stojanović
Browse files

[unittests] Fix "comparison of integers of different signs" warnings

A warning is sent because `std::distance()` returns a signed type so
`CmpHelperEQ()` gets instantiated into a function that compares
differently signed arguments.

Differential Revision: https://reviews.llvm.org/D72632
parent 71d5454b
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -56,17 +56,17 @@ TEST(LinkGraphTest, BlockAndSymbolIteration) {
                                false, false);

  // Check that iteration of blocks within a section behaves as expected.
  EXPECT_EQ(std::distance(Sec1.blocks().begin(), Sec1.blocks().end()), 2U);
  EXPECT_EQ(std::distance(Sec1.blocks().begin(), Sec1.blocks().end()), 2);
  EXPECT_TRUE(llvm::count(Sec1.blocks(), &B1));
  EXPECT_TRUE(llvm::count(Sec1.blocks(), &B2));

  // Check that iteration of symbols within a section behaves as expected.
  EXPECT_EQ(std::distance(Sec1.symbols().begin(), Sec1.symbols().end()), 2U);
  EXPECT_EQ(std::distance(Sec1.symbols().begin(), Sec1.symbols().end()), 2);
  EXPECT_TRUE(llvm::count(Sec1.symbols(), &S1));
  EXPECT_TRUE(llvm::count(Sec1.symbols(), &S2));

  // Check that iteration of blocks across sections behaves as expected.
  EXPECT_EQ(std::distance(G.blocks().begin(), G.blocks().end()), 4U);
  EXPECT_EQ(std::distance(G.blocks().begin(), G.blocks().end()), 4);
  EXPECT_TRUE(llvm::count(G.blocks(), &B1));
  EXPECT_TRUE(llvm::count(G.blocks(), &B2));
  EXPECT_TRUE(llvm::count(G.blocks(), &B3));
@@ -75,8 +75,7 @@ TEST(LinkGraphTest, BlockAndSymbolIteration) {
  // Check that iteration of defined symbols across sections behaves as
  // expected.
  EXPECT_EQ(
      std::distance(G.defined_symbols().begin(), G.defined_symbols().end()),
      4U);
      std::distance(G.defined_symbols().begin(), G.defined_symbols().end()), 4);
  EXPECT_TRUE(llvm::count(G.defined_symbols(), &S1));
  EXPECT_TRUE(llvm::count(G.defined_symbols(), &S2));
  EXPECT_TRUE(llvm::count(G.defined_symbols(), &S3));
+1 −1
Original line number Diff line number Diff line
@@ -589,7 +589,7 @@ TEST(MinidumpFile, getMemoryInfoList) {
    const MinidumpFile &File = **ExpectedFile;
    auto ExpectedInfo = File.getMemoryInfoList();
    ASSERT_THAT_EXPECTED(ExpectedInfo, Succeeded());
    ASSERT_EQ(1u, std::distance(ExpectedInfo->begin(), ExpectedInfo->end()));
    ASSERT_EQ(1, std::distance(ExpectedInfo->begin(), ExpectedInfo->end()));
    const MemoryInfo &Info = *ExpectedInfo.get().begin();
    EXPECT_EQ(0x0706050403020100u, Info.BaseAddress);
    EXPECT_EQ(0x0504030201000908u, Info.AllocationBase);