test_boost_parts.py 6.3 KB

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