test_std_suppress.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 tests.common
  9. class Test(tests.common.TestCase):
  10. def test_basic(self):
  11. runner = tests.common.ToolRunner('collect', ['--std.suppress',
  12. '--std.code.complexity.cyclomatic',
  13. '--std.code.length.total',
  14. '--std.general.size'])
  15. self.assertExec(runner.run())
  16. runner = tests.common.ToolRunner('view')
  17. self.assertExec(runner.run())
  18. runner = tests.common.ToolRunner('limit',
  19. ['--max-limit=std.code.complexity:cyclomatic:0'],
  20. exit_code=1,
  21. prefix='1')
  22. self.assertExec(runner.run())
  23. runner = tests.common.ToolRunner('limit',
  24. ['--max-limit=std.code.complexity:cyclomatic:0', '--disable-suppressions'],
  25. exit_code=8,
  26. prefix='2')
  27. self.assertExec(runner.run())
  28. runner = tests.common.ToolRunner('limit',
  29. ['--max-limit=std.code.length:total:0'],
  30. exit_code=7,
  31. prefix='3')
  32. self.assertExec(runner.run())
  33. runner = tests.common.ToolRunner('limit',
  34. ['--max-limit=std.code.length:total:0', '--disable-suppressions'],
  35. exit_code=26,
  36. prefix='4')
  37. self.assertExec(runner.run())
  38. runner = tests.common.ToolRunner('limit',
  39. ['--max-limit=std.code.complexity:cyclomatic:0', '--max-limit=std.code.length:total:0'],
  40. exit_code=8,
  41. prefix='5')
  42. self.assertExec(runner.run())
  43. runner = tests.common.ToolRunner('limit',
  44. ['--max-limit=std.general:size:0'],
  45. exit_code=0,
  46. prefix='size')
  47. self.assertExec(runner.run())
  48. runner = tests.common.ToolRunner('limit',
  49. ['--max-limit=std.general:size:0', '--disable-suppressions'],
  50. exit_code=1,
  51. prefix='size_nosup')
  52. self.assertExec(runner.run())
  53. if __name__ == '__main__':
  54. unittest.main()