aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ProfileData/InstrProfTest.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-12-06 22:46:54 -0800
committerGitHub <noreply@github.com>2024-12-06 22:46:54 -0800
commit32f7f0010bca99ee4bd917f57272733fb2bf3bd9 (patch)
treee16acafb4fe3b153d2bc8f0489b326233ed1a027 /llvm/unittests/ProfileData/InstrProfTest.cpp
parent00090ac0b9d391acb07c0099311987671c2cac1c (diff)
downloadllvm-32f7f0010bca99ee4bd917f57272733fb2bf3bd9.zip
llvm-32f7f0010bca99ee4bd917f57272733fb2bf3bd9.tar.gz
llvm-32f7f0010bca99ee4bd917f57272733fb2bf3bd9.tar.bz2
[memprof] Use gtest matchers at more places (#119050)
These gtest matchers reduce the number of times we mention the variables under examined.
Diffstat (limited to 'llvm/unittests/ProfileData/InstrProfTest.cpp')
-rw-r--r--llvm/unittests/ProfileData/InstrProfTest.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp
index f366b22..273b89c 100644
--- a/llvm/unittests/ProfileData/InstrProfTest.cpp
+++ b/llvm/unittests/ProfileData/InstrProfTest.cpp
@@ -26,6 +26,7 @@
using namespace llvm;
using ::llvm::memprof::LineLocation;
+using ::testing::ElementsAre;
using ::testing::EndsWith;
using ::testing::IsSubsetOf;
using ::testing::Pair;
@@ -564,19 +565,16 @@ TEST_F(InstrProfTest, test_caller_callee_pairs) {
auto It = Pairs.find(0x123);
ASSERT_NE(It, Pairs.end());
- ASSERT_THAT(It->second, SizeIs(2));
- EXPECT_THAT(It->second[0], Pair(LineLocation(1, 2), 0x234U));
- EXPECT_THAT(It->second[1], Pair(LineLocation(5, 6), 0x345U));
+ EXPECT_THAT(It->second, ElementsAre(Pair(LineLocation(1, 2), 0x234U),
+ Pair(LineLocation(5, 6), 0x345U)));
It = Pairs.find(0x234);
ASSERT_NE(It, Pairs.end());
- ASSERT_THAT(It->second, SizeIs(1));
- EXPECT_THAT(It->second[0], Pair(LineLocation(3, 4), 0U));
+ EXPECT_THAT(It->second, ElementsAre(Pair(LineLocation(3, 4), 0U)));
It = Pairs.find(0x345);
ASSERT_NE(It, Pairs.end());
- ASSERT_THAT(It->second, SizeIs(1));
- EXPECT_THAT(It->second[0], Pair(LineLocation(7, 8), 0U));
+ EXPECT_THAT(It->second, ElementsAre(Pair(LineLocation(7, 8), 0U)));
}
TEST_F(InstrProfTest, test_memprof_getrecord_error) {