test_std_suppress.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #
  2. # Metrix++, Copyright 2009-2013, Metrix++ Project
  3. # Link: http://metrixplusplus.sourceforge.net
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. # Metrix++ is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, version 3 of the License.
  10. #
  11. # Metrix++ is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Metrix++. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. import unittest
  20. import os
  21. import tests.common
  22. class Test(tests.common.TestCase):
  23. def test_basic(self):
  24. runner = tests.common.ToolRunner('collect', ['--std.suppress',
  25. '--std.code.complexity.cyclomatic',
  26. '--std.code.length:size'])
  27. self.assertExec(runner.run())
  28. runner = tests.common.ToolRunner('limit',
  29. ['--max-limit=std.code.complexity:cyclomatic:0'],
  30. exit_code=1)
  31. runner = tests.common.ToolRunner('limit',
  32. ['--max-limit=std.code.complexity:cyclomatic:0', '--disable-suppressions'],
  33. exit_code=8)
  34. runner = tests.common.ToolRunner('limit',
  35. ['--max-limit=std.code.length:size:0'],
  36. exit_code=7)
  37. runner = tests.common.ToolRunner('limit',
  38. ['--max-limit=std.code.length:size:0', '--disable-suppressions'],
  39. exit_code=24)
  40. runner = tests.common.ToolRunner('limit',
  41. ['--max-limit=std.code.complexity:cyclomatic:0', '--max-limit=std.code.length:size:0'],
  42. exit_code=8)
  43. self.assertExec(runner.run())
  44. if __name__ == '__main__':
  45. unittest.main()