File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright (C) 2019-2024 Intel Corporation
2
+ # SPDX-License-Identifier: BSD-3-Clause
3
+
4
+ import logging
5
+ import unittest
6
+ from io import StringIO
7
+
8
+ from codebasin .report import summary
9
+
10
+
11
+ class TestSummaryReport (unittest .TestCase ):
12
+ """
13
+ Test summary report functionality.
14
+ """
15
+
16
+ def setUp (self ):
17
+ logging .disable ()
18
+
19
+ def test_output (self ):
20
+ """Check summary report output"""
21
+ setmap = {
22
+ frozenset (["X" ]): 1 ,
23
+ frozenset (["Y" ]): 2 ,
24
+ frozenset (["X" , "Y" ]): 3 ,
25
+ frozenset ([]): 6 ,
26
+ }
27
+ output = StringIO ()
28
+ summary (setmap , stream = output )
29
+ expected = """
30
+ Summary
31
+ =======
32
+ ┌────────────────┬───────┬─────────┐
33
+ │ Platform Set │ LOC │ % LOC │
34
+ ├────────────────┼───────┼─────────┤
35
+ │ {} │ 6 │ 50.00 │
36
+ ├────────────────┼───────┼─────────┤
37
+ │ {X} │ 1 │ 8.33 │
38
+ ├────────────────┼───────┼─────────┤
39
+ │ {Y} │ 2 │ 16.67 │
40
+ ├────────────────┼───────┼─────────┤
41
+ │ {X, Y} │ 3 │ 25.00 │
42
+ └────────────────┴───────┴─────────┘
43
+ Code Divergence: 0.50
44
+ Code Utilization: 0.38
45
+ Unused Code (%): 50.00
46
+ Total SLOC: 12
47
+ """
48
+ self .assertEqual (expected , output .getvalue ())
49
+
50
+
51
+ if __name__ == "__main__" :
52
+ unittest .main ()
You can’t perform that action at this time.
0 commit comments