test_std_code_cpp.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #
  2. # Metrix++, Copyright 2009-2019, Metrix++ Project
  3. # Link: https://github.com/metrixplusplus/metrixplusplus
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. import unittest
  8. import os
  9. import tests.common
  10. class Test(tests.common.TestCase):
  11. def test_parser(self):
  12. runner = tests.common.ToolRunner('collect', ['--std.code.complexity.cyclomatic'])
  13. self.assertExec(runner.run())
  14. runner = tests.common.ToolRunner('view', opts_list=['--format=xml'])
  15. self.assertExec(runner.run())
  16. dirs_list = [os.path.join('.', each) for each in sorted(os.listdir(self.get_content_paths().cwd))]
  17. runner = tests.common.ToolRunner('view', dirs_list=dirs_list, prefix='files')
  18. self.assertExec(runner.run())
  19. runner = tests.common.ToolRunner('limit',
  20. ['--max-limit=std.code.complexity:cyclomatic:0'],
  21. exit_code=12)
  22. self.assertExec(runner.run())
  23. if __name__ == '__main__':
  24. unittest.main()