test_boost_parts.py 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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_workflow(self):
  23. # first collection
  24. runner = tests.common.ToolRunner('collect',
  25. ['--std.code.complexity.cyclomatic',
  26. '--std.code.lines.code',
  27. '--log-level=INFO'],
  28. check_stderr=[(0, -1)],
  29. save_prev=True)
  30. self.assertExec(runner.run())
  31. runner = tests.common.ToolRunner('collect',
  32. ['--std.code.complexity.cyclomatic',
  33. '--std.code.lines.code',
  34. '--log-level=INFO'],
  35. check_stderr=[(0, -1)],
  36. prefix='second',
  37. cwd="sources_changed",
  38. use_prev=True)
  39. self.assertExec(runner.run())
  40. runner = tests.common.ToolRunner('view',
  41. ['--log-level=INFO'],
  42. check_stderr=[(0, -1)])
  43. self.assertExec(runner.run())
  44. runner = tests.common.ToolRunner('view',
  45. ['--log-level=INFO', '--scope-mode=all'],
  46. check_stderr=[(0, -1)],
  47. prefix='second_all',
  48. use_prev=True)
  49. self.assertExec(runner.run())
  50. runner = tests.common.ToolRunner('view',
  51. ['--log-level=INFO', '--scope-mode=touched'],
  52. check_stderr=[(0, -1)],
  53. prefix='second_touched',
  54. use_prev=True)
  55. self.assertExec(runner.run())
  56. runner = tests.common.ToolRunner('view',
  57. ['--log-level=INFO', '--scope-mode=new'],
  58. check_stderr=[(0, -1)],
  59. prefix='second_new',
  60. use_prev=True)
  61. self.assertExec(runner.run())
  62. runner = tests.common.ToolRunner('view',
  63. ['--log-level=INFO', '--format=xml'],
  64. check_stderr=[(0, -1)],
  65. prefix='second_per_file',
  66. dirs_list=['./interprocess/detail/managed_open_or_create_impl.hpp'],
  67. use_prev=True)
  68. runner = tests.common.ToolRunner('limit',
  69. ['--log-level=INFO',
  70. '--max-limit=std.code.complexity:cyclomatic:15'],
  71. check_stderr=[(0, -1)],
  72. exit_code=9)
  73. self.assertExec(runner.run())
  74. runner = tests.common.ToolRunner('limit',
  75. ['--log-level=INFO',
  76. '--max-limit=std.code.complexity:cyclomatic:15',
  77. '--warn-mode=touched'],
  78. check_stderr=[(0, -1)],
  79. prefix='second_touched',
  80. exit_code=6,
  81. use_prev=True)
  82. self.assertExec(runner.run())
  83. runner = tests.common.ToolRunner('limit',
  84. ['--log-level=INFO',
  85. '--max-limit=std.code.complexity:cyclomatic:15',
  86. '--warn-mode=trend'],
  87. check_stderr=[(0, -1)],
  88. prefix='second_trend',
  89. exit_code=2,
  90. use_prev=True)
  91. self.assertExec(runner.run())
  92. runner = tests.common.ToolRunner('limit',
  93. ['--log-level=INFO',
  94. '--max-limit=std.code.complexity:cyclomatic:15',
  95. '--warn-mode=new'],
  96. check_stderr=[(0, -1)],
  97. prefix='second_new',
  98. exit_code=0,
  99. use_prev=True)
  100. self.assertExec(runner.run())
  101. runner = tests.common.ToolRunner('info',
  102. ['--log-level=INFO'],
  103. check_stderr=[(0, -1)],
  104. exit_code=0)
  105. self.assertExec(runner.run())
  106. runner = tests.common.ToolRunner('export',
  107. ['--log-level=INFO'],
  108. check_stderr=[(0, -1)],
  109. exit_code=0)
  110. self.assertExec(runner.run())
  111. if __name__ == '__main__':
  112. unittest.main()