-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: John Pennycook <[email protected]>
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,52 @@ | ||
# Copyright (C) 2019-2024 Intel Corporation | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
import logging | ||
import unittest | ||
from io import StringIO | ||
|
||
from codebasin.report import summary | ||
|
||
|
||
class TestSummaryReport(unittest.TestCase): | ||
""" | ||
Test summary report functionality. | ||
""" | ||
|
||
def setUp(self): | ||
logging.disable() | ||
|
||
def test_output(self): | ||
"""Check summary report output""" | ||
setmap = { | ||
frozenset(["X"]): 1, | ||
frozenset(["Y"]): 2, | ||
frozenset(["X", "Y"]): 3, | ||
frozenset([]): 6, | ||
} | ||
output = StringIO() | ||
summary(setmap, stream=output) | ||
expected = """ | ||
Summary | ||
======= | ||
┌────────────────┬───────┬─────────┐ | ||
│ Platform Set │ LOC │ % LOC │ | ||
├────────────────┼───────┼─────────┤ | ||
│ {} │ 6 │ 50.00 │ | ||
├────────────────┼───────┼─────────┤ | ||
│ {X} │ 1 │ 8.33 │ | ||
├────────────────┼───────┼─────────┤ | ||
│ {Y} │ 2 │ 16.67 │ | ||
├────────────────┼───────┼─────────┤ | ||
│ {X, Y} │ 3 │ 25.00 │ | ||
└────────────────┴───────┴─────────┘ | ||
Code Divergence: 0.50 | ||
Code Utilization: 0.38 | ||
Unused Code (%): 50.00 | ||
Total SLOC: 12 | ||
""" | ||
self.assertEqual(expected, output.getvalue()) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |