Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more
echo.py
00001 #!/usr/bin/env python 00002 00003 import re 00004 import sys 00005 import subprocess 00006 import os 00007 00008 def main(*args): 00009 desc = ' '.join(args).strip('-= ') 00010 name = 'test_' + desc.lower().replace(' ', '_').replace('-', '_') 00011 00012 exists = os.path.isfile('template_all_names.txt') 00013 00014 with open('template_all_names.txt', 'a') as file: 00015 file.write(name + '\n') 00016 file.write(desc + '\n') 00017 00018 with open('template_unit.fmt') as file: 00019 template = file.read() 00020 00021 template_header, template_footer = template.split('{test}') 00022 00023 if exists: 00024 with open('main.cpp', 'a') as file: 00025 file.write(template_footer.format( 00026 test_name=name)) 00027 00028 if name != 'test_results': 00029 with open('main.cpp', 'a') as file: 00030 file.write(template_header.format( 00031 test_name=name)) 00032 00033 if __name__ == "__main__": 00034 main(*sys.argv[1:])
Generated on Tue Jul 12 2022 13:02:51 by
