Explorar el Código

extended basic tests for cyclomatic_switch_case_once metric

prozessorkern hace 8 meses
padre
commit
eda5d4ea8a

+ 2 - 0
metrixpp/tests/general/test_basic.py

@@ -16,6 +16,7 @@ class Test(tests.common.TestCase):
         # first collection
         runner = tests.common.ToolRunner('collect',
                                          ['--std.code.complexity.cyclomatic',
+                                          '--std.code.complexity.cyclomatic_switch_case_once',
                                           '--std.code.lines.total',
                                           '--std.code.lines.code',
                                           '--std.code.lines.preprocessor',
@@ -53,6 +54,7 @@ class Test(tests.common.TestCase):
         # second collection
         runner = tests.common.ToolRunner('collect',
                                          ['--std.code.complexity.cyclomatic',
+                                          '--std.code.complexity.cyclomatic_switch_case_once',
                                           '--std.code.lines.total',
                                           '--std.code.lines.code',
                                           '--std.code.lines.preprocessor',

+ 4 - 0
metrixpp/tests/general/test_basic/test_help_collect_default_stdout.gold.txt

@@ -21,6 +21,10 @@ Options:
   --std.code.complexity.cyclomatic, --sccc
                         Enables collection of cyclomatic complexity metric
                         (McCabe) [default: False]
+  --std.code.complexity.cyclomatic_switch_case_once, --scccnsc
+                        Enables collection of cyclomatic complexity metric
+                        (McCabe) switch case is only counted once [default:
+                        False]
   --std.code.complexity.maxindent, --sccmi
                         Enables collection of maximum indent level metric
                         [default: False]

+ 19 - 19
metrixpp/tests/general/test_basic/test_workflow_export_default_stdout.gold.txt

@@ -1,19 +1,19 @@
-file,region,type,modified,line start,line end,std.code.complexity:cyclomatic,std.code.lines:code,std.code.lines:comments,std.code.lines:preprocessor,std.code.lines:total,std.code.ratio:comments,std.suppress:count,std.suppress:list,std.suppress.file:count,std.suppress.file:list
-./file_deleted_in_new_sources.cpp,__global__,global,,1,34,,0,0,0,0,0.0,,,,
-./file_deleted_in_new_sources.cpp,hmm,namespace,,3,24,,4,3,0,7,0.428,,,,
-./file_deleted_in_new_sources.cpp,B,class,,9,22,,3,0,0,3,0.0,,,,
-./file_deleted_in_new_sources.cpp,B,function,,12,20,1,8,2,0,9,0.2,,,,
-./file_deleted_in_new_sources.cpp,never_old,function,,26,33,1,7,0,0,7,0.0,,,,
-./file_deleted_in_new_sources.cpp,,file,,1,34,,,,,,,,,,
-./simple.cpp,__global__,global,,1,90,,0,0,0,0,0.0,,,,
-./simple.cpp,hmm,namespace,,3,89,,4,1,1,6,0.2,,,,
-./simple.cpp,A,class,,9,87,,20,0,0,20,0.0,,,,
-./simple.cpp,A,function,,12,23,3,11,2,0,12,0.153,,,,
-./simple.cpp,func,function,,26,40,1,5,0,0,5,0.0,,,,
-./simple.cpp,embeded,class,,28,38,,3,0,0,3,0.0,,,,
-./simple.cpp,embeded,function,,30,37,1,7,1,0,8,0.125,,,,
-./simple.cpp,func_to_be_removed_in_new_sources,function,,42,56,2,5,0,0,5,0.0,,,,
-./simple.cpp,embeded,class,,44,54,,3,0,0,3,0.0,,,,
-./simple.cpp,embeded,function,,46,53,1,7,1,0,8,0.125,,,,
-./simple.cpp,never,function,,58,65,1,7,0,0,7,0.0,,,,
-./simple.cpp,,file,,1,90,,,,,,,,,,
+file,region,type,modified,line start,line end,std.code.complexity:cyclomatic,std.code.complexity:cyclomatic_switch_case_once,std.code.lines:code,std.code.lines:comments,std.code.lines:preprocessor,std.code.lines:total,std.code.ratio:comments,std.suppress:count,std.suppress:list,std.suppress.file:count,std.suppress.file:list
+./file_deleted_in_new_sources.cpp,__global__,global,,1,34,,,0,0,0,0,0.0,,,,
+./file_deleted_in_new_sources.cpp,hmm,namespace,,3,24,,,4,3,0,7,0.428,,,,
+./file_deleted_in_new_sources.cpp,B,class,,9,22,,,3,0,0,3,0.0,,,,
+./file_deleted_in_new_sources.cpp,B,function,,12,20,1,1,8,2,0,9,0.2,,,,
+./file_deleted_in_new_sources.cpp,never_old,function,,26,33,1,1,7,0,0,7,0.0,,,,
+./file_deleted_in_new_sources.cpp,,file,,1,34,,,,,,,,,,,
+./simple.cpp,__global__,global,,1,90,,,0,0,0,0,0.0,,,,
+./simple.cpp,hmm,namespace,,3,89,,,4,1,1,6,0.2,,,,
+./simple.cpp,A,class,,9,87,,,20,0,0,20,0.0,,,,
+./simple.cpp,A,function,,12,23,3,3,11,2,0,12,0.153,,,,
+./simple.cpp,func,function,,26,40,1,1,5,0,0,5,0.0,,,,
+./simple.cpp,embeded,class,,28,38,,,3,0,0,3,0.0,,,,
+./simple.cpp,embeded,function,,30,37,1,1,7,1,0,8,0.125,,,,
+./simple.cpp,func_to_be_removed_in_new_sources,function,,42,56,2,2,5,0,0,5,0.0,,,,
+./simple.cpp,embeded,class,,44,54,,,3,0,0,3,0.0,,,,
+./simple.cpp,embeded,function,,46,53,1,1,7,1,0,8,0.125,,,,
+./simple.cpp,never,function,,58,65,1,1,7,0,0,7,0.0,,,,
+./simple.cpp,,file,,1,90,,,,,,,,,,,

+ 18 - 18
metrixpp/tests/general/test_basic/test_workflow_export_second_stdout.gold.txt

@@ -1,18 +1,18 @@
-file,region,type,modified,line start,line end,std.code.complexity:cyclomatic,std.code.lines:code,std.code.lines:comments,std.code.lines:preprocessor,std.code.lines:total,std.code.ratio:comments,std.suppress:count,std.suppress:list,std.suppress.file:count,std.suppress.file:list
-./simple.cpp,__global__,global,False,1,78,,0,0,0,0,0.0,,,,
-./simple.cpp,hmm,namespace,True,3,77,,4,1,2,7,0.2,,,,
-./simple.cpp,A,class,True,10,75,,4,0,0,4,0.0,,,,
-./simple.cpp,A,function,False,13,24,3,11,2,0,12,0.153,,,,
-./simple.cpp,func,function,False,26,42,1,5,0,0,5,0.0,,,,
-./simple.cpp,embeded,class,False,28,40,,3,0,0,3,0.0,,,,
-./simple.cpp,embeded,function,True,30,39,2,8,2,0,9,0.2,,,,
-./simple.cpp,never,function,True,44,51,1,7,1,0,7,0.125,,,,
-./simple.cpp,new_func,function,,53,56,0,3,1,0,4,0.25,,,,
-./simple.cpp,new_func_complex,function,,58,62,1,5,0,0,5,0.0,,,,
-./simple.cpp,new_func_complex_but_suppressed,function,,64,72,2,8,1,0,9,0.111,1,[std.code.complexity:cyclomatic],,
-./simple.cpp,,file,True,1,78,,,,,,,,,,
-./simple2.cpp,__global__,global,,1,26,,0,0,0,0,0.0,,,,
-./simple2.cpp,hmm,namespace,,3,25,,4,1,0,5,0.2,,,,
-./simple2.cpp,New_A,class,,7,23,,3,0,0,3,0.0,,,,
-./simple2.cpp,New_A,function,,10,21,3,10,2,0,12,0.166,,,,
-./simple2.cpp,,file,,1,26,,,,,,,,,,
+file,region,type,modified,line start,line end,std.code.complexity:cyclomatic,std.code.complexity:cyclomatic_switch_case_once,std.code.lines:code,std.code.lines:comments,std.code.lines:preprocessor,std.code.lines:total,std.code.ratio:comments,std.suppress:count,std.suppress:list,std.suppress.file:count,std.suppress.file:list
+./simple.cpp,__global__,global,False,1,78,,,0,0,0,0,0.0,,,,
+./simple.cpp,hmm,namespace,True,3,77,,,4,1,2,7,0.2,,,,
+./simple.cpp,A,class,True,10,75,,,4,0,0,4,0.0,,,,
+./simple.cpp,A,function,False,13,24,3,3,11,2,0,12,0.153,,,,
+./simple.cpp,func,function,False,26,42,1,1,5,0,0,5,0.0,,,,
+./simple.cpp,embeded,class,False,28,40,,,3,0,0,3,0.0,,,,
+./simple.cpp,embeded,function,True,30,39,2,2,8,2,0,9,0.2,,,,
+./simple.cpp,never,function,True,44,51,1,1,7,1,0,7,0.125,,,,
+./simple.cpp,new_func,function,,53,56,0,0,3,1,0,4,0.25,,,,
+./simple.cpp,new_func_complex,function,,58,62,1,1,5,0,0,5,0.0,,,,
+./simple.cpp,new_func_complex_but_suppressed,function,,64,72,2,2,8,1,0,9,0.111,1,[std.code.complexity:cyclomatic],,
+./simple.cpp,,file,True,1,78,,,,,,,,,,,
+./simple2.cpp,__global__,global,,1,26,,,0,0,0,0,0.0,,,,
+./simple2.cpp,hmm,namespace,,3,25,,,4,1,0,5,0.2,,,,
+./simple2.cpp,New_A,class,,7,23,,,3,0,0,3,0.0,,,,
+./simple2.cpp,New_A,function,,10,21,3,3,10,2,0,12,0.166,,,,
+./simple2.cpp,,file,,1,26,,,,,,,,,,,

+ 1 - 0
metrixpp/tests/general/test_basic/test_workflow_info_default_stdout.gold.txt

@@ -17,6 +17,7 @@ test_workflow.db:: info: Created using plugins and settings:
 
 test_workflow.db:: info: Collected metrics:
 	std.code.complexity:cyclomatic: 
+	std.code.complexity:cyclomatic_switch_case_once: 
 	std.code.lines:code: 
 	std.code.lines:comments: 
 	std.code.lines:preprocessor: 

+ 1 - 0
metrixpp/tests/general/test_basic/test_workflow_info_second_stdout.gold.txt

@@ -17,6 +17,7 @@ test_workflow.db:: info: Created using plugins and settings:
 
 test_workflow.db:: info: Collected metrics:
 	std.code.complexity:cyclomatic: 
+	std.code.complexity:cyclomatic_switch_case_once: 
 	std.code.lines:code: 
 	std.code.lines:comments: 
 	std.code.lines:preprocessor: 

+ 7 - 0
metrixpp/tests/general/test_basic/test_workflow_view_default_stdout.gold.txt

@@ -10,6 +10,13 @@
                         <distribution-bar count="1" metric="3" ratio="0.125" />
                     </distribution-bars>
                 </cyclomatic>
+                <cyclomatic_switch_case_once avg="1.375" count="8" max="3" min="1" nonzero="False" sup="0" total="11.0">
+                    <distribution-bars>
+                        <distribution-bar count="6" metric="1" ratio="0.75" />
+                        <distribution-bar count="1" metric="2" ratio="0.125" />
+                        <distribution-bar count="1" metric="3" ratio="0.125" />
+                    </distribution-bars>
+                </cyclomatic_switch_case_once>
             </std.code.complexity>
             <std.code.lines>
                 <code avg="5.875" count="16" max="20" min="0" nonzero="False" sup="0" total="94.0">

+ 20 - 11
metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_stdout.gold.txt

@@ -12,6 +12,15 @@
                         <distribution-bar __diff__="0" count="1" metric="3" ratio="0.14285714" />
                     </distribution-bars>
                 </cyclomatic>
+                <cyclomatic_switch_case_once avg="1.42857143" count="7" max="3" min="0" nonzero="False" sup="0" total="10.0">
+                    <__diff__ avg="-0.07142857" count="1" max="0" min="-1" nonzero="0" sup="0" total="1.0" />
+                    <distribution-bars>
+                        <distribution-bar __diff__="1" count="1" metric="0" ratio="0.14285714" />
+                        <distribution-bar __diff__="-1" count="3" metric="1" ratio="0.42857143" />
+                        <distribution-bar __diff__="1" count="2" metric="2" ratio="0.28571429" />
+                        <distribution-bar __diff__="0" count="1" metric="3" ratio="0.14285714" />
+                    </distribution-bars>
+                </cyclomatic_switch_case_once>
             </std.code.complexity>
             <std.code.lines>
                 <code avg="5.27272727" count="11" max="11" min="0" nonzero="False" sup="0" total="58.0">
@@ -123,8 +132,8 @@
                 </region>
                 <region>
                     <data>
-                        <std.code.complexity cyclomatic="3">
-                            <__diff__ cyclomatic="0" />
+                        <std.code.complexity cyclomatic="3" cyclomatic_switch_case_once="3">
+                            <__diff__ cyclomatic="0" cyclomatic_switch_case_once="0" />
                         </std.code.complexity>
                         <std.code.lines code="11" comments="2" preprocessor="0" total="12">
                             <__diff__ code="0" comments="0" preprocessor="0" total="0" />
@@ -137,8 +146,8 @@
                 </region>
                 <region>
                     <data>
-                        <std.code.complexity cyclomatic="1">
-                            <__diff__ cyclomatic="0" />
+                        <std.code.complexity cyclomatic="1" cyclomatic_switch_case_once="1">
+                            <__diff__ cyclomatic="0" cyclomatic_switch_case_once="0" />
                         </std.code.complexity>
                         <std.code.lines code="5" comments="0" preprocessor="0" total="5">
                             <__diff__ code="0" comments="0" preprocessor="0" total="0" />
@@ -162,8 +171,8 @@
                 </region>
                 <region>
                     <data>
-                        <std.code.complexity cyclomatic="2">
-                            <__diff__ cyclomatic="1" />
+                        <std.code.complexity cyclomatic="2" cyclomatic_switch_case_once="2">
+                            <__diff__ cyclomatic="1" cyclomatic_switch_case_once="1" />
                         </std.code.complexity>
                         <std.code.lines code="8" comments="2" preprocessor="0" total="9">
                             <__diff__ code="1" comments="1" preprocessor="0" total="1" />
@@ -176,8 +185,8 @@
                 </region>
                 <region>
                     <data>
-                        <std.code.complexity cyclomatic="1">
-                            <__diff__ cyclomatic="0" />
+                        <std.code.complexity cyclomatic="1" cyclomatic_switch_case_once="1">
+                            <__diff__ cyclomatic="0" cyclomatic_switch_case_once="0" />
                         </std.code.complexity>
                         <std.code.lines code="7" comments="1" preprocessor="0" total="7">
                             <__diff__ code="0" comments="1" preprocessor="0" total="0" />
@@ -190,7 +199,7 @@
                 </region>
                 <region>
                     <data>
-                        <std.code.complexity cyclomatic="0" />
+                        <std.code.complexity cyclomatic="0" cyclomatic_switch_case_once="0" />
                         <std.code.lines code="3" comments="1" preprocessor="0" total="4" />
                         <std.code.ratio comments="0.25" />
                     </data>
@@ -198,7 +207,7 @@
                 </region>
                 <region>
                     <data>
-                        <std.code.complexity cyclomatic="1" />
+                        <std.code.complexity cyclomatic="1" cyclomatic_switch_case_once="1" />
                         <std.code.lines code="5" comments="0" preprocessor="0" total="5" />
                         <std.code.ratio comments="0.0" />
                     </data>
@@ -206,7 +215,7 @@
                 </region>
                 <region>
                     <data>
-                        <std.code.complexity cyclomatic="2" />
+                        <std.code.complexity cyclomatic="2" cyclomatic_switch_case_once="2" />
                         <std.code.lines code="8" comments="1" preprocessor="0" total="9" />
                         <std.code.ratio comments="0.111" />
                         <std.suppress count="1" list="[std.code.complexity:cyclomatic]" />

+ 19 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_all_stdout.gold.txt

@@ -41,6 +41,7 @@
 	Line numbers   : 13-24
 	Modified       : False
 	std.code.complexity:cyclomatic: 3 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 3 [+0]
 	std.code.lines:code: 11 [+0]
 	std.code.lines:comments: 2 [+0]
 	std.code.lines:preprocessor: 0 [+0]
@@ -54,6 +55,7 @@
 	Line numbers   : 26-42
 	Modified       : False
 	std.code.complexity:cyclomatic: 1 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 1 [+0]
 	std.code.lines:code: 5 [+0]
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
@@ -79,6 +81,7 @@
 	Line numbers   : 30-39
 	Modified       : True
 	std.code.complexity:cyclomatic: 2 [+1]
+	std.code.complexity:cyclomatic_switch_case_once: 2 [+1]
 	std.code.lines:code: 8 [+1]
 	std.code.lines:comments: 2 [+1]
 	std.code.lines:preprocessor: 0 [+0]
@@ -92,6 +95,7 @@
 	Line numbers   : 44-51
 	Modified       : True
 	std.code.complexity:cyclomatic: 1 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 1 [+0]
 	std.code.lines:code: 7 [+0]
 	std.code.lines:comments: 1 [+1]
 	std.code.lines:preprocessor: 0 [+0]
@@ -105,6 +109,7 @@
 	Line numbers   : 53-56
 	Modified       : None
 	std.code.complexity:cyclomatic: 0
+	std.code.complexity:cyclomatic_switch_case_once: 0
 	std.code.lines:code: 3
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
@@ -118,6 +123,7 @@
 	Line numbers   : 58-62
 	Modified       : None
 	std.code.complexity:cyclomatic: 1
+	std.code.complexity:cyclomatic_switch_case_once: 1
 	std.code.lines:code: 5
 	std.code.lines:comments: 0
 	std.code.lines:preprocessor: 0
@@ -131,6 +137,7 @@
 	Line numbers   : 64-72
 	Modified       : None
 	std.code.complexity:cyclomatic: 2
+	std.code.complexity:cyclomatic_switch_case_once: 2
 	std.code.lines:code: 8
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
@@ -151,6 +158,18 @@
 	             2 : 0.286 : 0.857 : 2 [+1]	||||||||||||||||||||||||||||
 	             3 : 0.143 : 1.000 : 1 [+0]	||||||||||||||
 
+./simple.cpp:: info: Overall metrics for 'std.code.complexity:cyclomatic_switch_case_once' metric
+	Average        : 1.42857143 [-0.07142857]
+	Minimum        : 0 [-1]
+	Maximum        : 3 [+0]
+	Total          : 10.0 [+1.0]
+	Distribution   : 7 [+1] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	             0 : 0.143 : 0.143 : 1 [+1]	||||||||||||||
+	             1 : 0.429 : 0.571 : 3 [-1]	||||||||||||||||||||||||||||||||||||||||||
+	             2 : 0.286 : 0.857 : 2 [+1]	||||||||||||||||||||||||||||
+	             3 : 0.143 : 1.000 : 1 [+0]	||||||||||||||
+
 ./simple.cpp:: info: Overall metrics for 'std.code.lines:code' metric
 	Average        : 5.27272727 [-1.27272727]
 	Minimum        : 0 [+0]

+ 18 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_new_stdout.gold.txt

@@ -41,6 +41,7 @@
 	Line numbers   : 13-24
 	Modified       : False
 	std.code.complexity:cyclomatic: 3 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 3 [+0]
 	std.code.lines:code: 11 [+0]
 	std.code.lines:comments: 2 [+0]
 	std.code.lines:preprocessor: 0 [+0]
@@ -54,6 +55,7 @@
 	Line numbers   : 26-42
 	Modified       : False
 	std.code.complexity:cyclomatic: 1 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 1 [+0]
 	std.code.lines:code: 5 [+0]
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
@@ -79,6 +81,7 @@
 	Line numbers   : 30-39
 	Modified       : True
 	std.code.complexity:cyclomatic: 2 [+1]
+	std.code.complexity:cyclomatic_switch_case_once: 2 [+1]
 	std.code.lines:code: 8 [+1]
 	std.code.lines:comments: 2 [+1]
 	std.code.lines:preprocessor: 0 [+0]
@@ -92,6 +95,7 @@
 	Line numbers   : 44-51
 	Modified       : True
 	std.code.complexity:cyclomatic: 1 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 1 [+0]
 	std.code.lines:code: 7 [+0]
 	std.code.lines:comments: 1 [+1]
 	std.code.lines:preprocessor: 0 [+0]
@@ -105,6 +109,7 @@
 	Line numbers   : 53-56
 	Modified       : None
 	std.code.complexity:cyclomatic: 0
+	std.code.complexity:cyclomatic_switch_case_once: 0
 	std.code.lines:code: 3
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
@@ -118,6 +123,7 @@
 	Line numbers   : 58-62
 	Modified       : None
 	std.code.complexity:cyclomatic: 1
+	std.code.complexity:cyclomatic_switch_case_once: 1
 	std.code.lines:code: 5
 	std.code.lines:comments: 0
 	std.code.lines:preprocessor: 0
@@ -131,6 +137,7 @@
 	Line numbers   : 64-72
 	Modified       : None
 	std.code.complexity:cyclomatic: 2
+	std.code.complexity:cyclomatic_switch_case_once: 2
 	std.code.lines:code: 8
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
@@ -150,6 +157,17 @@
 	             1 : 0.333 : 0.667 : 1 [+1]	|||||||||||||||||||||||||||||||||
 	             2 : 0.333 : 1.000 : 1 [+1]	|||||||||||||||||||||||||||||||||
 
+./simple.cpp:: info: Overall metrics for 'std.code.complexity:cyclomatic_switch_case_once' metric
+	Average        : 1.0 [+1.0]
+	Minimum        : 0 [+0]
+	Maximum        : 2 [+2]
+	Total          : 3.0 [+3.0]
+	Distribution   : 3 [+3] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	             0 : 0.333 : 0.333 : 1 [+1]	|||||||||||||||||||||||||||||||||
+	             1 : 0.333 : 0.667 : 1 [+1]	|||||||||||||||||||||||||||||||||
+	             2 : 0.333 : 1.000 : 1 [+1]	|||||||||||||||||||||||||||||||||
+
 ./simple.cpp:: info: Overall metrics for 'std.code.lines:code' metric
 	Average        : 5.33333333 [+5.33333333]
 	Minimum        : 3 [+3]

+ 18 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_touched_stdout.gold.txt

@@ -41,6 +41,7 @@
 	Line numbers   : 13-24
 	Modified       : False
 	std.code.complexity:cyclomatic: 3 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 3 [+0]
 	std.code.lines:code: 11 [+0]
 	std.code.lines:comments: 2 [+0]
 	std.code.lines:preprocessor: 0 [+0]
@@ -54,6 +55,7 @@
 	Line numbers   : 26-42
 	Modified       : False
 	std.code.complexity:cyclomatic: 1 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 1 [+0]
 	std.code.lines:code: 5 [+0]
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
@@ -79,6 +81,7 @@
 	Line numbers   : 30-39
 	Modified       : True
 	std.code.complexity:cyclomatic: 2 [+1]
+	std.code.complexity:cyclomatic_switch_case_once: 2 [+1]
 	std.code.lines:code: 8 [+1]
 	std.code.lines:comments: 2 [+1]
 	std.code.lines:preprocessor: 0 [+0]
@@ -92,6 +95,7 @@
 	Line numbers   : 44-51
 	Modified       : True
 	std.code.complexity:cyclomatic: 1 [+0]
+	std.code.complexity:cyclomatic_switch_case_once: 1 [+0]
 	std.code.lines:code: 7 [+0]
 	std.code.lines:comments: 1 [+1]
 	std.code.lines:preprocessor: 0 [+0]
@@ -105,6 +109,7 @@
 	Line numbers   : 53-56
 	Modified       : None
 	std.code.complexity:cyclomatic: 0
+	std.code.complexity:cyclomatic_switch_case_once: 0
 	std.code.lines:code: 3
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
@@ -118,6 +123,7 @@
 	Line numbers   : 58-62
 	Modified       : None
 	std.code.complexity:cyclomatic: 1
+	std.code.complexity:cyclomatic_switch_case_once: 1
 	std.code.lines:code: 5
 	std.code.lines:comments: 0
 	std.code.lines:preprocessor: 0
@@ -131,6 +137,7 @@
 	Line numbers   : 64-72
 	Modified       : None
 	std.code.complexity:cyclomatic: 2
+	std.code.complexity:cyclomatic_switch_case_once: 2
 	std.code.lines:code: 8
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
@@ -150,6 +157,17 @@
 	             1 : 0.400 : 0.600 : 2 [-1]	||||||||||||||||||||||||||||||||||||||||
 	             2 : 0.400 : 1.000 : 2 [+1]	||||||||||||||||||||||||||||||||||||||||
 
+./simple.cpp:: info: Overall metrics for 'std.code.complexity:cyclomatic_switch_case_once' metric
+	Average        : 1.2 [-0.05]
+	Minimum        : 0 [-1]
+	Maximum        : 2 [+0]
+	Total          : 6.0 [+1.0]
+	Distribution   : 5 [+1] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	             0 : 0.200 : 0.200 : 1 [+1]	||||||||||||||||||||
+	             1 : 0.400 : 0.600 : 2 [-1]	||||||||||||||||||||||||||||||||||||||||
+	             2 : 0.400 : 1.000 : 2 [+1]	||||||||||||||||||||||||||||||||||||||||
+
 ./simple.cpp:: info: Overall metrics for 'std.code.lines:code' metric
 	Average        : 5.57142857 [-2.0]
 	Minimum        : 3 [+0]

+ 9 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_stdout.gold.txt

@@ -12,6 +12,15 @@
                         <distribution-bar __diff__="1" count="2" metric="3" ratio="0.25" />
                     </distribution-bars>
                 </cyclomatic>
+                <cyclomatic_switch_case_once avg="1.625" count="8" max="3" min="0" nonzero="False" sup="0" total="13.0">
+                    <__diff__ avg="0.25" count="0" max="0" min="-1" nonzero="0" sup="0" total="2.0" />
+                    <distribution-bars>
+                        <distribution-bar __diff__="1" count="1" metric="0" ratio="0.125" />
+                        <distribution-bar __diff__="-3" count="3" metric="1" ratio="0.375" />
+                        <distribution-bar __diff__="1" count="2" metric="2" ratio="0.25" />
+                        <distribution-bar __diff__="1" count="2" metric="3" ratio="0.25" />
+                    </distribution-bars>
+                </cyclomatic_switch_case_once>
             </std.code.complexity>
             <std.code.lines>
                 <code avg="5.0" count="15" max="11" min="0" nonzero="False" sup="0" total="75.0">

+ 12 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_txt_all_stdout.gold.txt

@@ -10,6 +10,18 @@
 	             2 : 0.250 : 0.750 : 2 [+1]	|||||||||||||||||||||||||
 	             3 : 0.250 : 1.000 : 2 [+1]	|||||||||||||||||||||||||
 
+./:: info: Overall metrics for 'std.code.complexity:cyclomatic_switch_case_once' metric
+	Average        : 1.625 [+0.25]
+	Minimum        : 0 [-1]
+	Maximum        : 3 [+0]
+	Total          : 13.0 [+2.0]
+	Distribution   : 8 [+0] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	             0 : 0.125 : 0.125 : 1 [+1]	||||||||||||
+	             1 : 0.375 : 0.500 : 3 [-3]	|||||||||||||||||||||||||||||||||||||
+	             2 : 0.250 : 0.750 : 2 [+1]	|||||||||||||||||||||||||
+	             3 : 0.250 : 1.000 : 2 [+1]	|||||||||||||||||||||||||
+
 ./:: info: Overall metrics for 'std.code.lines:code' metric
 	Average        : 5.0 [-0.875]
 	Minimum        : 0 [+0]

+ 12 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_txt_new_stdout.gold.txt

@@ -10,6 +10,18 @@
 	             2 : 0.250 : 0.750 : 1 [+1]	|||||||||||||||||||||||||
 	             3 : 0.250 : 1.000 : 1 [+1]	|||||||||||||||||||||||||
 
+./:: info: Overall metrics for 'std.code.complexity:cyclomatic_switch_case_once' metric
+	Average        : 1.5 [+1.5]
+	Minimum        : 0 [+0]
+	Maximum        : 3 [+3]
+	Total          : 6.0 [+6.0]
+	Distribution   : 4 [+4] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	             0 : 0.250 : 0.250 : 1 [+1]	|||||||||||||||||||||||||
+	             1 : 0.250 : 0.500 : 1 [+1]	|||||||||||||||||||||||||
+	             2 : 0.250 : 0.750 : 1 [+1]	|||||||||||||||||||||||||
+	             3 : 0.250 : 1.000 : 1 [+1]	|||||||||||||||||||||||||
+
 ./:: info: Overall metrics for 'std.code.lines:code' metric
 	Average        : 4.71428571 [+4.71428571]
 	Minimum        : 0 [+0]

+ 12 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_txt_touched_stdout.gold.txt

@@ -10,6 +10,18 @@
 	             2 : 0.333 : 0.833 : 2 [+1]	|||||||||||||||||||||||||||||||||
 	             3 : 0.167 : 1.000 : 1 [+1]	||||||||||||||||
 
+./:: info: Overall metrics for 'std.code.complexity:cyclomatic_switch_case_once' metric
+	Average        : 1.5 [+0.33333333]
+	Minimum        : 0 [-1]
+	Maximum        : 3 [+1]
+	Total          : 9.0 [+2.0]
+	Distribution   : 6 [+0] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	             0 : 0.167 : 0.167 : 1 [+1]	||||||||||||||||
+	             1 : 0.333 : 0.500 : 2 [-3]	|||||||||||||||||||||||||||||||||
+	             2 : 0.333 : 0.833 : 2 [+1]	|||||||||||||||||||||||||||||||||
+	             3 : 0.167 : 1.000 : 1 [+1]	||||||||||||||||
+
 ./:: info: Overall metrics for 'std.code.lines:code' metric
 	Average        : 5.09090909 [-1.15909091]
 	Minimum        : 0 [+0]