123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- #
- # Metrix++, Copyright 2009-2019, Metrix++ Project
- # Link: https://github.com/metrixplusplus/metrixplusplus
- #
- # This file is a part of Metrix++ Tool.
- #
- import unittest
- import tests.common
- class Test(tests.common.TestCase):
- def test_workflow(self):
-
- #
- # WARNING:
- # files generated by this test are used by project documents page
- # so, if the test is changed, html docs should be updated accordingly
- #
-
- runner = tests.common.ToolRunner('collect',
- ['--std.code.complexity.cyclomatic',
- '--std.code.lines.code',
- '--log-level=INFO'],
- check_stderr=[(0, -1)],
- save_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('collect',
- ['--std.code.complexity.cyclomatic',
- '--std.code.lines.code',
- '--log-level=INFO'],
- check_stderr=[(0, -1)],
- prefix='second',
- cwd="sources_changed",
- use_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('view',
- ['--log-level=INFO'],
- check_stderr=[(0, -1)])
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('view',
- ['--log-level=INFO', '--scope-mode=all'],
- check_stderr=[(0, -1)],
- prefix='second_all',
- use_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('view',
- ['--log-level=INFO', '--scope-mode=touched'],
- check_stderr=[(0, -1)],
- prefix='second_touched',
- use_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('view',
- ['--log-level=INFO', '--scope-mode=new'],
- check_stderr=[(0, -1)],
- prefix='second_new',
- use_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('view',
- ['--log-level=INFO'],
- check_stderr=[(0, -1)],
- prefix='second_per_file',
- dirs_list=['./interprocess/detail/managed_open_or_create_impl.hpp'],
- use_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('limit',
- ['--log-level=INFO',
- '--max-limit=std.code.complexity:cyclomatic:15',
- '--hotspots=3'],
- check_stderr=[(0, -1)],
- exit_code=3)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('limit',
- ['--log-level=INFO',
- '--max-limit=std.code.complexity:cyclomatic:15',
- '--warn-mode=touched'],
- check_stderr=[(0, -1)],
- prefix='second_touched',
- exit_code=6,
- use_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('limit',
- ['--log-level=INFO',
- '--max-limit=std.code.complexity:cyclomatic:15',
- '--warn-mode=trend'],
- check_stderr=[(0, -1)],
- prefix='second_trend',
- exit_code=2,
- use_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('limit',
- ['--log-level=INFO',
- '--max-limit=std.code.complexity:cyclomatic:15',
- '--warn-mode=new'],
- check_stderr=[(0, -1)],
- prefix='second_new',
- exit_code=0,
- use_prev=True)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('info',
- ['--log-level=INFO'],
- check_stderr=[(0, -1)],
- exit_code=0)
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('export',
- ['--log-level=INFO'],
- check_stderr=[(0, -1)],
- exit_code=0)
- self.assertExec(runner.run())
- def test_std_member_metrics(self):
- runner = tests.common.ToolRunner('collect',
- ['--std.code.member.fields',
- '--std.code.member.globals',
- '--std.code.member.classes',
- '--std.code.member.structs',
- '--std.code.member.interfaces',
- '--std.code.member.types',
- '--std.code.member.methods',
- '--std.code.member.namespaces'])
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('view',
- ['--nest-regions', '--format=txt'],
- prefix='nest_per_file',
- dirs_list=['./interprocess/detail/win32_api.hpp'])
- self.assertExec(runner.run())
- runner = tests.common.ToolRunner('view', ['--format=txt'], prefix='txt')
- self.assertExec(runner.run())
- if __name__ == '__main__':
- unittest.main()
-
|