test_std_code_cpp.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 TestBasic(tests.common.TestCase):
  23. def test_parser(self):
  24. runner = tests.common.ToolRunner('collect', ['--std.code.complexity.on'])
  25. self.assertExec(runner.run())
  26. runner = tests.common.ToolRunner('export')
  27. self.assertExec(runner.run())
  28. dirs_list = [os.path.join('.', each) for each in os.listdir(self.get_content_paths().cwd)]
  29. print dirs_list
  30. runner = tests.common.ToolRunner('export', opts_list=['--general.format=txt'], dirs_list=dirs_list, prefix='files')
  31. self.assertExec(runner.run())
  32. runner = tests.common.ToolRunner('limit',
  33. ['--general.max-limit=std.code.complexity:cyclomatic:0'],
  34. exit_code=11)
  35. self.assertExec(runner.run())
  36. if __name__ == '__main__':
  37. unittest.main()