test_std_suppress.py 2.7 KB

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