test_std_code_cs.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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', ['--nest-regions', '--format=xml'])
  15. self.assertExec(runner.run())
  16. dirs_list = [os.path.join('.', each) for each in os.listdir(self.get_content_paths().cwd)]
  17. runner = tests.common.ToolRunner('view',
  18. opts_list=['--nest-regions', '--format=txt'],
  19. dirs_list=dirs_list,
  20. prefix='files')
  21. self.assertExec(runner.run())
  22. runner = tests.common.ToolRunner('limit',
  23. ['--max-limit=std.code.complexity:cyclomatic:0'],
  24. exit_code=16)
  25. self.assertExec(runner.run())
  26. if __name__ == '__main__':
  27. unittest.main()