-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tools/report-converter/tests/unit/output/statistics/test_checker_summary.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest | ||
import io | ||
import contextlib | ||
|
||
from codechecker_report_converter.report.statistics import Statistics | ||
|
||
|
||
class TestCheckerSummary(unittest.TestCase): | ||
""" Test the output of the statistics checker summary. """ | ||
|
||
def test_checker_summary(self): | ||
""" Test the output of the statistics checker summary. """ | ||
input = {"Checker_A":1, "Checker_B":2, "Checker_C": 3} | ||
Statistics.write_checker_summary(input) | ||
f = io.StringIO() | ||
with contextlib.redirect_stdout(f): | ||
Statistics.write_checker_summary(input, f) | ||
output = f.getvalue() | ||
self.assertIn("Checker_C | 3", output) | ||
self.assertIn("Checker_B | 2", output) | ||
self.assertIn("Checker_A | 1", output) | ||
|
||
# Check if checker_C comes first in the output | ||
self.assertLess(output.find("Checker_C"), output.find("Checker_B")) |