Go to the documentation of this file.00001
00002 from catkin.find_in_workspaces import find_in_workspaces
00003 import zipfile_interface
00004 from roscompile import get_functions
00005 import argparse
00006
00007 parser = argparse.ArgumentParser()
00008 parser.add_argument('zipfile', nargs='?')
00009 args = parser.parse_args()
00010
00011 if not args.zipfile:
00012 args.zipfile = find_in_workspaces(path='roscompile/test/test_data.zip', first_match_only=True)[0]
00013 config, cases = zipfile_interface.get_test_cases(args.zipfile)
00014 roscompile_functions = get_functions()
00015 coverage_counts = {}
00016 max_len = 0
00017 for name in roscompile_functions:
00018 coverage_counts[name] = 0
00019 max_len = max(max_len, len(name))
00020
00021 for test_config in config:
00022 for fne_name in test_config['functions']:
00023 coverage_counts[fne_name] += 1
00024
00025 z_count = 0
00026 for name, count in sorted(coverage_counts.items(), key=lambda kv: kv[1], reverse=True):
00027 print('{:{}} {:=3d}'.format(name, max_len, count))
00028 if count == 0:
00029 z_count += 1
00030
00031 if z_count > 0:
00032 print('Zero tests written for {} functions'.format(z_count))