Prechádzať zdrojové kódy

added tests for format=prometheus

Greg Junkietech 4 rokov pred
rodič
commit
a4b78da15e

+ 12 - 3
metrixpp/tests/general/test_basic.py

@@ -227,9 +227,6 @@ class Test(tests.common.TestCase):
         runner = tests.common.ToolRunner('view', ['--format=xml'], prefix='xml')
         self.assertExec(runner.run())
         
-        runner = tests.common.ToolRunner('view', ['--format=prometheus'], prefix='prometheus')
-        self.assertExec(runner.run())
-        
         runner = tests.common.ToolRunner('collect',
                                          ['--std.code.complexity.cyclomatic'],
                                          prefix='nest',
@@ -250,6 +247,18 @@ class Test(tests.common.TestCase):
                                          use_prev=True)
         self.assertExec(runner.run())
 
+        runner = tests.common.ToolRunner('collect', ['--std.code.complexity.cyclomatic', '--std.code.lines.code'], save_prev=False)
+        self.assertExec(runner.run())
+
+        runner = tests.common.ToolRunner('view', ['--format=prometheus'], prefix='prometheus')
+        self.assertExec(runner.run())
+
+        runner = tests.common.ToolRunner('view',
+                                         ['--format=prometheus', '--ll=ERROR'],
+                                         prefix='prometheus_simple.cpp',
+                                         dirs_list=['./simple.cpp'])
+        self.assertExec(runner.run())
+
     def test_std_general_metrics(self):
 
         runner = tests.common.ToolRunner('collect',

+ 39 - 0
metrixpp/tests/general/test_basic/test_view_format_view_prometheus_simple.cpp_stdout.gold.txt

@@ -0,0 +1,39 @@
+std_code_lines_code {file="./simple.cpp", region="__global__"} 0
+
+std_code_lines_code {file="./simple.cpp", region="hmm"} 4
+
+std_code_lines_code {file="./simple.cpp", region="A"} 4
+
+std_code_complexity_cyclomatic {file="./simple.cpp", region="A"} 3
+std_code_lines_code {file="./simple.cpp", region="A"} 11
+
+std_code_complexity_cyclomatic {file="./simple.cpp", region="func"} 1
+std_code_lines_code {file="./simple.cpp", region="func"} 5
+
+std_code_lines_code {file="./simple.cpp", region="embeded"} 3
+
+std_code_complexity_cyclomatic {file="./simple.cpp", region="embeded"} 1
+std_code_lines_code {file="./simple.cpp", region="embeded"} 7
+
+std_code_complexity_cyclomatic {file="./simple.cpp", region="func_to_be_removed_in_new_sources"} 2
+std_code_lines_code {file="./simple.cpp", region="func_to_be_removed_in_new_sources"} 5
+
+std_code_lines_code {file="./simple.cpp", region="embeded"} 3
+
+std_code_complexity_cyclomatic {file="./simple.cpp", region="embeded"} 1
+std_code_lines_code {file="./simple.cpp", region="embeded"} 7
+
+std_code_complexity_cyclomatic {file="./simple.cpp", region="never"} 1
+std_code_lines_code {file="./simple.cpp", region="never"} 7
+
+std_code_complexity_cyclomatic_avg {file="./simple.cpp"} 1.5
+std_code_complexity_cyclomatic_min {file="./simple.cpp"} 1
+std_code_complexity_cyclomatic_max {file="./simple.cpp"} 3
+std_code_complexity_cyclomatic_total {file="./simple.cpp"} 9.0
+
+std_code_lines_code_avg {file="./simple.cpp"} 5.09090909
+std_code_lines_code_min {file="./simple.cpp"} 0
+std_code_lines_code_max {file="./simple.cpp"} 11
+std_code_lines_code_total {file="./simple.cpp"} 56.0
+
+ 

+ 5 - 0
metrixpp/tests/general/test_basic/test_view_format_view_prometheus_stdout.gold.txt

@@ -3,4 +3,9 @@ std_code_complexity_cyclomatic_min {file="./"} 1
 std_code_complexity_cyclomatic_max {file="./"} 3
 std_code_complexity_cyclomatic_total {file="./"} 11.0
 
+std_code_lines_code_avg {file="./"} 4.875
+std_code_lines_code_min {file="./"} 0
+std_code_lines_code_max {file="./"} 11
+std_code_lines_code_total {file="./"} 78.0
 
+