llvm.org GIT mirror llvm / 120c3be
[Coverage] Simplify r316141. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316147 91177308-0d34-0410-b5e6-96231b3b80d8 Vedant Kumar 2 years ago
2 changed file(s) with 10 addition(s) and 45 deletion(s). Raw diff Collapse all Expand all
671671 }
672672
673673 LineCoverageStats::LineCoverageStats(
674 ArrayRef LineSegments,
675 const coverage::CoverageSegment *WrappedSegment, unsigned Line)
674 ArrayRef LineSegments,
675 const CoverageSegment *WrappedSegment, unsigned Line)
676676 : ExecutionCount(0), HasMultipleRegions(false), Mapped(false), Line(Line),
677677 LineSegments(LineSegments), WrappedSegment(WrappedSegment) {
678678 // Find the minimum number of regions which start in this line.
679679 unsigned MinRegionCount = 0;
680 auto isStartOfRegion = [](const coverage::CoverageSegment *S) {
680 auto isStartOfRegion = [](const CoverageSegment *S) {
681681 return !S->IsGapRegion && S->HasCount && S->IsRegionEntry;
682682 };
683683 for (unsigned I = 0; I < LineSegments.size() && MinRegionCount < 2; ++I)
646646
647647 CoverageData Data = LoadedCoverage->getCoverageForFile("file1");
648648
649 unsigned NumLineStats = 0;
649 unsigned Line = 0;
650 unsigned LineCounts[] = {20, 20, 20, 20, 10, 10, 10, 10, 10, 0, 0};
650651 for (const auto &LCS : getLineCoverageStats(Data)) {
651 ++NumLineStats;
652 (void)LCS;
653 }
654 ASSERT_EQ(11U, NumLineStats);
655
656 LineCoverageIterator LCI{Data};
657
658 ASSERT_EQ(1U, LCI->getLine());
659 ASSERT_EQ(20ULL, LCI->getExecutionCount());
660 ++LCI;
661 ASSERT_EQ(2U, LCI->getLine());
662 ASSERT_EQ(20ULL, LCI->getExecutionCount());
663 ++LCI;
664 ASSERT_EQ(3U, LCI->getLine());
665 ASSERT_EQ(20ULL, LCI->getExecutionCount());
666 ++LCI;
667 ASSERT_EQ(4U, LCI->getLine());
668 ASSERT_EQ(20ULL, LCI->getExecutionCount());
669 ++LCI;
670 ASSERT_EQ(5U, LCI->getLine());
671 ASSERT_EQ(10ULL, LCI->getExecutionCount());
672 ++LCI;
673 ASSERT_EQ(6U, LCI->getLine());
674 ASSERT_EQ(10ULL, LCI->getExecutionCount());
675 ++LCI;
676 ASSERT_EQ(7U, LCI->getLine());
677 ASSERT_EQ(10ULL, LCI->getExecutionCount());
678 ++LCI;
679 ASSERT_EQ(8U, LCI->getLine());
680 ASSERT_EQ(10ULL, LCI->getExecutionCount());
681 ++LCI;
682 ASSERT_EQ(9U, LCI->getLine());
683 ASSERT_EQ(10ULL, LCI->getExecutionCount());
684 ++LCI;
685 ASSERT_EQ(10U, LCI->getLine());
686 ASSERT_EQ(0ULL, LCI->getExecutionCount());
687 ++LCI;
688 ASSERT_EQ(11U, LCI->getLine());
689 ASSERT_EQ(0ULL, LCI->getExecutionCount());
690 ++LCI;
691 ASSERT_EQ(LCI, LCI.getEnd());
652 ASSERT_EQ(Line + 1, LCS.getLine());
653 ASSERT_EQ(LineCounts[Line], LCS.getExecutionCount());
654 ++Line;
655 }
656 ASSERT_EQ(11U, Line);
692657 }
693658
694659 TEST_P(CoverageMappingTest, uncovered_function) {