ESP32-basiertes Kraftort-Suchger�t mit GPS, LED-Ring und PlatformIO-Firmware.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

548 satır
22KB

  1. #!/usr/bin/ruby
  2. # =========================================================================
  3. # Unity - A Test Framework for C
  4. # ThrowTheSwitch.org
  5. # Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
  6. # SPDX-License-Identifier: MIT
  7. # =========================================================================
  8. class UnityTestRunnerGenerator
  9. def initialize(options = nil)
  10. @options = UnityTestRunnerGenerator.default_options
  11. case options
  12. when NilClass
  13. @options
  14. when String
  15. @options.merge!(UnityTestRunnerGenerator.grab_config(options))
  16. when Hash
  17. # Check if some of these have been specified
  18. @options[:has_setup] = !options[:setup_name].nil?
  19. @options[:has_teardown] = !options[:teardown_name].nil?
  20. @options[:has_suite_setup] = !options[:suite_setup].nil?
  21. @options[:has_suite_teardown] = !options[:suite_teardown].nil?
  22. @options.merge!(options)
  23. else
  24. raise 'If you specify arguments, it should be a filename or a hash of options'
  25. end
  26. require_relative 'type_sanitizer'
  27. end
  28. def self.default_options
  29. {
  30. includes: [],
  31. defines: [],
  32. plugins: [],
  33. framework: :unity,
  34. test_prefix: 'test|spec|should',
  35. mock_prefix: 'Mock',
  36. mock_suffix: '',
  37. setup_name: 'setUp',
  38. teardown_name: 'tearDown',
  39. test_reset_name: 'resetTest',
  40. test_verify_name: 'verifyTest',
  41. main_name: 'main', # set to :auto to automatically generate each time
  42. main_export_decl: '',
  43. cmdline_args: false,
  44. omit_begin_end: false,
  45. use_param_tests: false,
  46. use_system_files: true,
  47. include_extensions: '(?:hpp|hh|H|h)',
  48. source_extensions: '(?:cpp|cc|ino|C|c)'
  49. }
  50. end
  51. def self.grab_config(config_file)
  52. options = default_options
  53. unless config_file.nil? || config_file.empty?
  54. require_relative 'yaml_helper'
  55. yaml_guts = YamlHelper.load_file(config_file)
  56. options.merge!(yaml_guts[:unity] || yaml_guts[:cmock])
  57. raise "No :unity or :cmock section found in #{config_file}" unless options
  58. end
  59. options
  60. end
  61. def run(input_file, output_file, options = nil)
  62. @options.merge!(options) unless options.nil?
  63. # pull required data from source file
  64. source = File.read(input_file)
  65. source = source.force_encoding('ISO-8859-1').encode('utf-8', replace: nil)
  66. tests = find_tests(source)
  67. headers = find_includes(source)
  68. testfile_includes = @options[:use_system_files] ? (headers[:local] + headers[:system]) : (headers[:local])
  69. used_mocks = find_mocks(testfile_includes)
  70. testfile_includes = (testfile_includes - used_mocks)
  71. testfile_includes.delete_if { |inc| inc =~ /(unity|cmock)/ }
  72. find_setup_and_teardown(source)
  73. # build runner file
  74. generate(input_file, output_file, tests, used_mocks, testfile_includes)
  75. # determine which files were used to return them
  76. all_files_used = [input_file, output_file]
  77. all_files_used += testfile_includes.map { |filename| "#{filename}.c" } unless testfile_includes.empty?
  78. all_files_used += @options[:includes] unless @options[:includes].empty?
  79. all_files_used += headers[:linkonly] unless headers[:linkonly].empty?
  80. all_files_used.uniq
  81. end
  82. def generate(input_file, output_file, tests, used_mocks, testfile_includes)
  83. File.open(output_file, 'w') do |output|
  84. create_header(output, used_mocks, testfile_includes)
  85. create_externs(output, tests, used_mocks)
  86. create_mock_management(output, used_mocks)
  87. create_setup(output)
  88. create_teardown(output)
  89. create_suite_setup(output)
  90. create_suite_teardown(output)
  91. create_reset(output)
  92. create_run_test(output) unless tests.empty?
  93. create_args_wrappers(output, tests)
  94. create_main(output, input_file, tests, used_mocks)
  95. end
  96. return unless @options[:header_file] && !@options[:header_file].empty?
  97. File.open(@options[:header_file], 'w') do |output|
  98. create_h_file(output, @options[:header_file], tests, testfile_includes, used_mocks)
  99. end
  100. end
  101. def find_tests(source)
  102. tests_and_line_numbers = []
  103. # contains characters which will be substituted from within strings, doing
  104. # this prevents these characters from interfering with scrubbers
  105. # @ is not a valid C character, so there should be no clashes with files genuinely containing these markers
  106. substring_subs = { '{' => '@co@', '}' => '@cc@', ';' => '@ss@', '/' => '@fs@' }
  107. substring_re = Regexp.union(substring_subs.keys)
  108. substring_unsubs = substring_subs.invert # the inverse map will be used to fix the strings afterwords
  109. substring_unsubs['@quote@'] = '\\"'
  110. substring_unsubs['@apos@'] = '\\\''
  111. substring_unre = Regexp.union(substring_unsubs.keys)
  112. source_scrubbed = source.clone
  113. source_scrubbed = source_scrubbed.gsub(/\\"/, '@quote@') # hide escaped quotes to allow capture of the full string/char
  114. source_scrubbed = source_scrubbed.gsub(/\\'/, '@apos@') # hide escaped apostrophes to allow capture of the full string/char
  115. source_scrubbed = source_scrubbed.gsub(/("[^"\n]*")|('[^'\n]*')/) { |s| s.gsub(substring_re, substring_subs) } # temporarily hide problematic characters within strings
  116. source_scrubbed = source_scrubbed.gsub(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
  117. source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
  118. source_scrubbed = source_scrubbed.gsub(/\/\/.*$/, '') # remove line comments (all that remain)
  119. lines = source_scrubbed.split(/(^\s*\#.*$) | (;|\{|\}) /x) # Treat preprocessor directives as a logical line. Match ;, {, and } as end of lines
  120. .map { |line| line.gsub(substring_unre, substring_unsubs) } # unhide the problematic characters previously removed
  121. lines.each_with_index do |line, _index|
  122. # find tests
  123. next unless line =~ /^((?:\s*(?:TEST_(?:CASE|RANGE|MATRIX))\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/m
  124. next unless line =~ /^((?:\s*(?:TEST_(?:CASE|RANGE|MATRIX))\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]})\w*)\s*\(\s*(.*)\s*\)/m
  125. arguments = Regexp.last_match(1)
  126. name = Regexp.last_match(2)
  127. call = Regexp.last_match(3)
  128. params = Regexp.last_match(4)
  129. args = nil
  130. if @options[:use_param_tests] && !arguments.empty?
  131. args = []
  132. type_and_args = arguments.split(/TEST_(CASE|RANGE|MATRIX)/)
  133. (1...type_and_args.length).step(2).each do |i|
  134. case type_and_args[i]
  135. when 'CASE'
  136. args << type_and_args[i + 1].sub(/^\s*\(\s*(.*?)\s*\)\s*$/m, '\1')
  137. when 'RANGE'
  138. args += type_and_args[i + 1].scan(/(\[|<)\s*(-?\d+.?\d*)\s*,\s*(-?\d+.?\d*)\s*,\s*(-?\d+.?\d*)\s*(\]|>)/m).map do |arg_values_str|
  139. exclude_end = arg_values_str[0] == '<' && arg_values_str[-1] == '>'
  140. arg_values_str[1...-1].map do |arg_value_str|
  141. arg_value_str.include?('.') ? arg_value_str.to_f : arg_value_str.to_i
  142. end.push(exclude_end)
  143. end.map do |arg_values|
  144. Range.new(arg_values[0], arg_values[1], arg_values[3]).step(arg_values[2]).to_a
  145. end.reduce(nil) do |result, arg_range_expanded|
  146. result.nil? ? arg_range_expanded.map { |a| [a] } : result.product(arg_range_expanded)
  147. end.map do |arg_combinations|
  148. arg_combinations.flatten.join(', ')
  149. end
  150. when 'MATRIX'
  151. single_arg_regex_string = /(?:(?:"(?:\\"|[^\\])*?")+|(?:'\\?.')+|(?:[^\s\]\["',]|\[[\d\S_-]+\])+)/.source
  152. args_regex = /\[((?:\s*#{single_arg_regex_string}\s*,?)*(?:\s*#{single_arg_regex_string})?\s*)\]/m
  153. arg_elements_regex = /\s*(#{single_arg_regex_string})\s*,\s*/m
  154. args += type_and_args[i + 1].scan(args_regex).flatten.map do |arg_values_str|
  155. "#{arg_values_str},".scan(arg_elements_regex)
  156. end.reduce do |result, arg_range_expanded|
  157. result.product(arg_range_expanded)
  158. end.map do |arg_combinations|
  159. arg_combinations.flatten.join(', ')
  160. end
  161. end
  162. end
  163. end
  164. tests_and_line_numbers << { test: name, args: args, call: call, params: params, line_number: 0 }
  165. end
  166. tests_and_line_numbers.uniq! { |v| v[:test] }
  167. # determine line numbers and create tests to run
  168. source_lines = source.split("\n")
  169. source_index = 0
  170. tests_and_line_numbers.size.times do |i|
  171. source_lines[source_index..].each_with_index do |line, index|
  172. next unless line =~ /\s+#{tests_and_line_numbers[i][:test]}(?:\s|\()/
  173. source_index += index
  174. tests_and_line_numbers[i][:line_number] = source_index + 1
  175. break
  176. end
  177. end
  178. tests_and_line_numbers
  179. end
  180. def find_includes(source)
  181. # remove comments (block and line, in three steps to ensure correct precedence)
  182. source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
  183. source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
  184. source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
  185. # parse out includes
  186. {
  187. local: source.scan(/^\s*#include\s+"\s*(.+\.#{@options[:include_extensions]})\s*"/).flatten,
  188. system: source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" },
  189. linkonly: source.scan(/^TEST_SOURCE_FILE\(\s*"\s*(.+\.#{@options[:source_extensions]})\s*"/).flatten
  190. }
  191. end
  192. def find_mocks(includes)
  193. mock_headers = []
  194. includes.each do |include_path|
  195. include_file = File.basename(include_path)
  196. mock_headers << include_path if include_file =~ /^#{@options[:mock_prefix]}.*#{@options[:mock_suffix]}\.h$/i
  197. end
  198. mock_headers
  199. end
  200. def find_setup_and_teardown(source)
  201. @options[:has_setup] = source =~ /void\s+#{@options[:setup_name]}\s*\(/
  202. @options[:has_teardown] = source =~ /void\s+#{@options[:teardown_name]}\s*\(/
  203. @options[:has_suite_setup] ||= (source =~ /void\s+suiteSetUp\s*\(/)
  204. @options[:has_suite_teardown] ||= (source =~ /int\s+suiteTearDown\s*\(int\s+([a-zA-Z0-9_])+\s*\)/)
  205. end
  206. def create_header(output, mocks, testfile_includes = [])
  207. output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
  208. output.puts("\n/*=======Automagically Detected Files To Include=====*/")
  209. output.puts('extern "C" {') if @options[:externcincludes]
  210. output.puts("#include \"#{@options[:framework]}.h\"")
  211. output.puts('#include "cmock.h"') unless mocks.empty?
  212. output.puts('}') if @options[:externcincludes]
  213. if @options[:defines] && !@options[:defines].empty?
  214. output.puts('/* injected defines for unity settings, etc */')
  215. @options[:defines].each do |d|
  216. def_only = d.match(/(\w+).*/)[1]
  217. output.puts("#ifndef #{def_only}\n#define #{d}\n#endif /* #{def_only} */")
  218. end
  219. end
  220. if @options[:header_file] && !@options[:header_file].empty?
  221. output.puts("#include \"#{File.basename(@options[:header_file])}\"")
  222. else
  223. @options[:includes].flatten.uniq.compact.each do |inc|
  224. output.puts("#include #{inc.include?('<') ? inc : "\"#{inc}\""}")
  225. end
  226. testfile_includes.each do |inc|
  227. output.puts("#include #{inc.include?('<') ? inc : "\"#{inc}\""}")
  228. end
  229. end
  230. output.puts('extern "C" {') if @options[:externcincludes]
  231. mocks.each do |mock|
  232. output.puts("#include \"#{mock}\"")
  233. end
  234. output.puts('}') if @options[:externcincludes]
  235. output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception)
  236. return unless @options[:enforce_strict_ordering]
  237. output.puts('')
  238. output.puts('int GlobalExpectCount;')
  239. output.puts('int GlobalVerifyOrder;')
  240. output.puts('char* GlobalOrderError;')
  241. end
  242. def create_externs(output, tests, _mocks)
  243. output.puts("\n/*=======External Functions This Runner Calls=====*/")
  244. output.puts("extern void #{@options[:setup_name]}(void);")
  245. output.puts("extern void #{@options[:teardown_name]}(void);")
  246. output.puts("\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif") if @options[:externc]
  247. tests.each do |test|
  248. output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
  249. end
  250. output.puts("#ifdef __cplusplus\n}\n#endif") if @options[:externc]
  251. output.puts('')
  252. end
  253. def create_mock_management(output, mock_headers)
  254. output.puts("\n/*=======Mock Management=====*/")
  255. output.puts('static void CMock_Init(void)')
  256. output.puts('{')
  257. if @options[:enforce_strict_ordering]
  258. output.puts(' GlobalExpectCount = 0;')
  259. output.puts(' GlobalVerifyOrder = 0;')
  260. output.puts(' GlobalOrderError = NULL;')
  261. end
  262. mocks = mock_headers.map { |mock| File.basename(mock, '.*') }
  263. mocks.each do |mock|
  264. mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
  265. output.puts(" #{mock_clean}_Init();")
  266. end
  267. output.puts("}\n")
  268. output.puts('static void CMock_Verify(void)')
  269. output.puts('{')
  270. mocks.each do |mock|
  271. mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
  272. output.puts(" #{mock_clean}_Verify();")
  273. end
  274. output.puts("}\n")
  275. output.puts('static void CMock_Destroy(void)')
  276. output.puts('{')
  277. mocks.each do |mock|
  278. mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
  279. output.puts(" #{mock_clean}_Destroy();")
  280. end
  281. output.puts("}\n")
  282. end
  283. def create_setup(output)
  284. return if @options[:has_setup]
  285. output.puts("\n/*=======Setup (stub)=====*/")
  286. output.puts("void #{@options[:setup_name]}(void) {}")
  287. end
  288. def create_teardown(output)
  289. return if @options[:has_teardown]
  290. output.puts("\n/*=======Teardown (stub)=====*/")
  291. output.puts("void #{@options[:teardown_name]}(void) {}")
  292. end
  293. def create_suite_setup(output)
  294. return if @options[:suite_setup].nil?
  295. output.puts("\n/*=======Suite Setup=====*/")
  296. output.puts('void suiteSetUp(void)')
  297. output.puts('{')
  298. output.puts(@options[:suite_setup])
  299. output.puts('}')
  300. end
  301. def create_suite_teardown(output)
  302. return if @options[:suite_teardown].nil?
  303. output.puts("\n/*=======Suite Teardown=====*/")
  304. output.puts('int suiteTearDown(int num_failures)')
  305. output.puts('{')
  306. output.puts(@options[:suite_teardown])
  307. output.puts('}')
  308. end
  309. def create_reset(output)
  310. output.puts("\n/*=======Test Reset Options=====*/")
  311. output.puts("void #{@options[:test_reset_name]}(void);")
  312. output.puts("void #{@options[:test_reset_name]}(void)")
  313. output.puts('{')
  314. output.puts(" #{@options[:teardown_name]}();")
  315. output.puts(' CMock_Verify();')
  316. output.puts(' CMock_Destroy();')
  317. output.puts(' CMock_Init();')
  318. output.puts(" #{@options[:setup_name]}();")
  319. output.puts('}')
  320. output.puts("void #{@options[:test_verify_name]}(void);")
  321. output.puts("void #{@options[:test_verify_name]}(void)")
  322. output.puts('{')
  323. output.puts(' CMock_Verify();')
  324. output.puts('}')
  325. end
  326. def create_run_test(output)
  327. require 'erb'
  328. file = File.read(File.join(__dir__, 'run_test.erb'))
  329. template = ERB.new(file, trim_mode: '<>')
  330. output.puts("\n#{template.result(binding)}")
  331. end
  332. def create_args_wrappers(output, tests)
  333. return unless @options[:use_param_tests]
  334. output.puts("\n/*=======Parameterized Test Wrappers=====*/")
  335. tests.each do |test|
  336. next if test[:args].nil? || test[:args].empty?
  337. test[:args].each.with_index(1) do |args, idx|
  338. output.puts("static void runner_args#{idx}_#{test[:test]}(void)")
  339. output.puts('{')
  340. output.puts(" #{test[:test]}(#{args});")
  341. output.puts("}\n")
  342. end
  343. end
  344. end
  345. def create_main(output, filename, tests, used_mocks)
  346. output.puts("\n/*=======MAIN=====*/")
  347. main_name = @options[:main_name].to_sym == :auto ? "main_#{filename.gsub('.c', '')}" : (@options[:main_name]).to_s
  348. if @options[:cmdline_args]
  349. if main_name != 'main'
  350. output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv);")
  351. end
  352. output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv)")
  353. output.puts('{')
  354. output.puts('#ifdef UNITY_USE_COMMAND_LINE_ARGS')
  355. output.puts(' int parse_status = UnityParseOptions(argc, argv);')
  356. output.puts(' if (parse_status != 0)')
  357. output.puts(' {')
  358. output.puts(' if (parse_status < 0)')
  359. output.puts(' {')
  360. output.puts(" UnityPrint(\"#{filename.gsub('.c', '').gsub(/\\/, '\\\\\\')}.\");")
  361. output.puts(' UNITY_PRINT_EOL();')
  362. tests.each do |test|
  363. if (!@options[:use_param_tests]) || test[:args].nil? || test[:args].empty?
  364. output.puts(" UnityPrint(\" #{test[:test]}\");")
  365. output.puts(' UNITY_PRINT_EOL();')
  366. else
  367. test[:args].each do |args|
  368. output.puts(" UnityPrint(\" #{test[:test]}(#{args})\");")
  369. output.puts(' UNITY_PRINT_EOL();')
  370. end
  371. end
  372. end
  373. output.puts(' return 0;')
  374. output.puts(' }')
  375. output.puts(' return parse_status;')
  376. output.puts(' }')
  377. output.puts('#endif')
  378. else
  379. main_return = @options[:omit_begin_end] ? 'void' : 'int'
  380. if main_name != 'main'
  381. output.puts("#{@options[:main_export_decl]} #{main_return} #{main_name}(void);")
  382. end
  383. output.puts("#{main_return} #{main_name}(void)")
  384. output.puts('{')
  385. end
  386. output.puts(' suiteSetUp();') if @options[:has_suite_setup]
  387. if @options[:omit_begin_end]
  388. output.puts(" UnitySetTestFile(\"#{filename.gsub(/\\/, '\\\\\\')}\");")
  389. else
  390. output.puts(" UnityBegin(\"#{filename.gsub(/\\/, '\\\\\\')}\");")
  391. end
  392. tests.each do |test|
  393. if (!@options[:use_param_tests]) || test[:args].nil? || test[:args].empty?
  394. output.puts(" run_test(#{test[:test]}, \"#{test[:test]}\", #{test[:line_number]});")
  395. else
  396. test[:args].each.with_index(1) do |args, idx|
  397. wrapper = "runner_args#{idx}_#{test[:test]}"
  398. testname = "#{test[:test]}(#{args})".dump
  399. output.puts(" run_test(#{wrapper}, #{testname}, #{test[:line_number]});")
  400. end
  401. end
  402. end
  403. output.puts
  404. output.puts(' CMock_Guts_MemFreeFinal();') unless used_mocks.empty?
  405. if @options[:has_suite_teardown]
  406. if @options[:omit_begin_end]
  407. output.puts(' (void) suite_teardown(0);')
  408. else
  409. output.puts(' return suiteTearDown(UNITY_END());')
  410. end
  411. else
  412. output.puts(' return UNITY_END();') unless @options[:omit_begin_end]
  413. end
  414. output.puts('}')
  415. end
  416. def create_h_file(output, filename, tests, testfile_includes, used_mocks)
  417. filename = File.basename(filename).gsub(/[-\/\\.,\s]/, '_').upcase
  418. output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
  419. output.puts("#ifndef _#{filename}")
  420. output.puts("#define _#{filename}\n\n")
  421. output.puts("#include \"#{@options[:framework]}.h\"")
  422. output.puts('#include "cmock.h"') unless used_mocks.empty?
  423. @options[:includes].flatten.uniq.compact.each do |inc|
  424. output.puts("#include #{inc.include?('<') ? inc : "\"#{inc}\""}")
  425. end
  426. testfile_includes.each do |inc|
  427. output.puts("#include #{inc.include?('<') ? inc : "\"#{inc}\""}")
  428. end
  429. output.puts "\n"
  430. tests.each do |test|
  431. if test[:params].nil? || test[:params].empty?
  432. output.puts("void #{test[:test]}(void);")
  433. else
  434. output.puts("void #{test[:test]}(#{test[:params]});")
  435. end
  436. end
  437. output.puts("#endif\n\n")
  438. end
  439. end
  440. if $0 == __FILE__
  441. options = { includes: [] }
  442. # parse out all the options first (these will all be removed as we go)
  443. ARGV.reject! do |arg|
  444. case arg
  445. when '-cexception'
  446. options[:plugins] = [:cexception]
  447. true
  448. when '-externcincludes'
  449. options[:externcincludes] = true
  450. true
  451. when /\.*\.ya?ml$/
  452. options = UnityTestRunnerGenerator.grab_config(arg)
  453. true
  454. when /--(\w+)="?(.*)"?/
  455. options[Regexp.last_match(1).to_sym] = Regexp.last_match(2)
  456. true
  457. when /\.*\.(?:hpp|hh|H|h)$/
  458. options[:includes] << arg
  459. true
  460. else false
  461. end
  462. end
  463. # make sure there is at least one parameter left (the input file)
  464. unless ARGV[0]
  465. puts ["\nusage: ruby #{__FILE__} (files) (options) input_test_file (output)",
  466. "\n input_test_file - this is the C file you want to create a runner for",
  467. ' output - this is the name of the runner file to generate',
  468. ' defaults to (input_test_file)_Runner',
  469. ' files:',
  470. ' *.yml / *.yaml - loads configuration from here in :unity or :cmock',
  471. ' *.h - header files are added as #includes in runner',
  472. ' options:',
  473. ' -cexception - include cexception support',
  474. ' -externc - add extern "C" for cpp support',
  475. ' --setup_name="" - redefine setUp func name to something else',
  476. ' --teardown_name="" - redefine tearDown func name to something else',
  477. ' --main_name="" - redefine main func name to something else',
  478. ' --test_prefix="" - redefine test prefix from default test|spec|should',
  479. ' --test_reset_name="" - redefine resetTest func name to something else',
  480. ' --test_verify_name="" - redefine verifyTest func name to something else',
  481. ' --suite_setup="" - code to execute for setup of entire suite',
  482. ' --suite_teardown="" - code to execute for teardown of entire suite',
  483. ' --use_param_tests=1 - enable parameterized tests (disabled by default)',
  484. ' --omit_begin_end=1 - omit calls to UnityBegin and UNITY_END (disabled by default)',
  485. ' --header_file="" - path/name of test header file to generate too'].join("\n")
  486. exit 1
  487. end
  488. # create the default test runner name if not specified
  489. ARGV[1] = ARGV[0].gsub('.c', '_Runner.c') unless ARGV[1]
  490. UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
  491. end