aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ProfileData/CoverageMappingTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/ProfileData/CoverageMappingTest.cpp')
-rw-r--r--llvm/unittests/ProfileData/CoverageMappingTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
index c82ed66..a0995fb 100644
--- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -222,6 +222,21 @@ TEST_F(CoverageMappingTest, uncovered_function) {
ASSERT_EQ(CoverageSegment(3, 4, false), Segments[1]);
}
+TEST_F(CoverageMappingTest, uncovered_function_with_mapping) {
+ readProfCounts();
+
+ addCMR(Counter::getCounter(0), "file1", 1, 1, 9, 9);
+ addCMR(Counter::getCounter(1), "file1", 1, 1, 4, 7);
+ loadCoverageMapping("func", 0x1234);
+
+ CoverageData Data = LoadedCoverage->getCoverageForFile("file1");
+ std::vector<CoverageSegment> Segments(Data.begin(), Data.end());
+ ASSERT_EQ(3U, Segments.size());
+ ASSERT_EQ(CoverageSegment(1, 1, 0, true), Segments[0]);
+ ASSERT_EQ(CoverageSegment(4, 7, 0, false), Segments[1]);
+ ASSERT_EQ(CoverageSegment(9, 9, false), Segments[2]);
+}
+
TEST_F(CoverageMappingTest, combine_regions) {
ProfileWriter.addFunctionCounts("func", 0x1234, {10, 20, 30});
readProfCounts();