Example #1
0
def _analyse_method(method):
    name = method.name
    body = method.body
    complexity = comp.complexity(body) if body else 0
    comp_method = Method(name, complexity)
    return comp_method
Example #2
0
 def test_compl_for_do_while(self):
     method = _METHODS_BY_NAME.get("doWhileExample")
     self.assertEqual(sut.complexity(method), 3)
Example #3
0
 def test_compl_for_if_elseif_example(self):
     method = _METHODS_BY_NAME.get("ifElseifExample")
     self.assertEqual(sut.complexity(method), 5)
Example #4
0
 def test_compl_for_if_in_loops(self):
     method = _METHODS_BY_NAME.get("ifInLoops")
     self.assertEqual(sut.complexity(method), 6)
Example #5
0
 def test_compl_for_switch_example(self):
     method = _METHODS_BY_NAME.get("switchExample")
     self.assertEqual(sut.complexity(method), 1)
Example #6
0
 def test_compl_for_compl_example4(self):
     method = _METHODS_BY_NAME.get("complExample4")
     self.assertEqual(sut.complexity(method), 96)