mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
update ceedling to 0.29.0
This commit is contained in:
parent
774a9f63ab
commit
b25faa97c2
133
test/vendor/ceedling/bin/ceedling
vendored
133
test/vendor/ceedling/bin/ceedling
vendored
@ -31,95 +31,111 @@ unless (project_found)
|
||||
include Thor::Actions
|
||||
|
||||
desc "new PROJECT_NAME", "create a new ceedling project"
|
||||
method_option :no_docs, :type => :boolean, :default => false, :desc => "No docs in vendor directory"
|
||||
method_option :nodocs, :type => :boolean, :default => false
|
||||
method_option :as_gem, :type => :boolean, :default => false, :desc => "Create the scaffold using Ceedling as a gem instead of filling in the vendor directory. Implies --no-docs."
|
||||
method_option :asgem, :type => :boolean, :default => false
|
||||
method_option :with_ignore, :type => :boolean, :default => false, :desc => "Create a gitignore file for ignoring ceedling generated files."
|
||||
method_option :withignore, :type => :boolean, :default => false
|
||||
method_option :no_configs, :type => :boolean, :default => false, :desc => "Don't install starter configuration files."
|
||||
method_option :docs, :type => :boolean, :default => false, :desc => "Add docs in project vendor directory"
|
||||
method_option :local, :type => :boolean, :default => false, :desc => "Create a copy of Ceedling in the project vendor directory"
|
||||
method_option :gitignore, :type => :boolean, :default => false, :desc => "Create a gitignore file for ignoring ceedling generated files"
|
||||
method_option :no_configs, :type => :boolean, :default => false, :desc => "Don't install starter configuration files"
|
||||
method_option :noconfigs, :type => :boolean, :default => false
|
||||
|
||||
#deprecated:
|
||||
method_option :no_docs, :type => :boolean, :default => false
|
||||
method_option :nodocs, :type => :boolean, :default => false
|
||||
method_option :as_gem, :type => :boolean, :default => false
|
||||
method_option :asgem, :type => :boolean, :default => false
|
||||
method_option :with_ignore, :type => :boolean, :default => false
|
||||
method_option :withignore, :type => :boolean, :default => false
|
||||
def new(name, silent = false)
|
||||
copy_assets_and_create_structure(name, silent, false, options)
|
||||
end
|
||||
|
||||
desc "upgrade PROJECT_NAME", "upgrade ceedling for a project (not req'd if gem used)"
|
||||
method_option :no_docs, :type => :boolean, :default => false, :desc => "No docs in vendor directory"
|
||||
method_option :nodocs, :type => :boolean, :default => false
|
||||
method_option :no_configs, :type => :boolean, :default => true, :desc => "Don't install starter configuration files."
|
||||
method_option :docs, :type => :boolean, :default => false, :desc => "Add docs in project vendor directory"
|
||||
method_option :local, :type => :boolean, :default => false, :desc => "Create a copy of Ceedling in the project vendor directory"
|
||||
method_option :no_configs, :type => :boolean, :default => false, :desc => "Don't install starter configuration files"
|
||||
method_option :noconfigs, :type => :boolean, :default => false
|
||||
|
||||
#deprecated:
|
||||
method_option :no_docs, :type => :boolean, :default => false
|
||||
method_option :nodocs, :type => :boolean, :default => false
|
||||
def upgrade(name, silent = false)
|
||||
copy_assets_and_create_structure(name, silent, true, options)
|
||||
copy_assets_and_create_structure(name, silent, true, options || {:upgrade => true})
|
||||
end
|
||||
|
||||
no_commands do
|
||||
def copy_assets_and_create_structure(name, silent=false, force=false, options = {})
|
||||
|
||||
no_docs = options[:no_docs] || options[:nodocs] || false
|
||||
no_configs = options[:no_configs] || options[:noconfigs] || false
|
||||
as_gem = options[:as_gem] || options[:asgem] || false
|
||||
with_ignore = options[:with_ignore] || options[:withignore] || false
|
||||
puts "WARNING: --no_docs deprecated. It is now the default. Specify -docs if you want docs installed." if (options[:no_docs] || options[:nodocs])
|
||||
puts "WARNING: --as_gem deprecated. It is now the default. Specify -local if you want ceedling installed to this project." if (options[:as_gem] || options[:asgem])
|
||||
puts "WARNING: --with_ignore deprecated. It is now called -gitignore" if (options[:with_ignore] || options[:with_ignore])
|
||||
|
||||
use_docs = options[:docs] || false
|
||||
use_configs = !(options[:no_configs] || options[:noconfigs] || false)
|
||||
use_gem = !(options[:local])
|
||||
use_ignore = options[:gitignore] || false
|
||||
is_upgrade = options[:upgrade] || false
|
||||
|
||||
ceedling_path = File.join(name, 'vendor', 'ceedling')
|
||||
source_path = File.join(name, 'src')
|
||||
test_path = File.join(name, 'test')
|
||||
test_support_path = File.join(name, 'test/support')
|
||||
|
||||
[source_path, test_path, test_support_path].each do |d|
|
||||
FileUtils.mkdir_p d
|
||||
# If it's not an upgrade, make sure we have the paths we expect
|
||||
if (!is_upgrade)
|
||||
[source_path, test_path, test_support_path].each do |d|
|
||||
FileUtils.mkdir_p d
|
||||
end
|
||||
end
|
||||
|
||||
unless as_gem
|
||||
# Genarate gitkeep in test support path
|
||||
FileUtils.touch(File.join(test_support_path, '.gitkeep'))
|
||||
|
||||
# If documentation requested, create a place to dump them and do so
|
||||
if use_docs
|
||||
doc_path = File.join(ceedling_path, 'docs')
|
||||
FileUtils.mkdir_p doc_path
|
||||
|
||||
in_doc_path = lambda {|f| File.join(doc_path, f)}
|
||||
|
||||
doc_files = [
|
||||
'docs/CeedlingPacket.md',
|
||||
'vendor/c_exception/docs/CException.md',
|
||||
'vendor/cmock/docs/CMock_Summary.md',
|
||||
'vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf',
|
||||
'vendor/unity/docs/UnityAssertionsReference.md',
|
||||
'vendor/unity/docs/UnityConfigurationGuide.md',
|
||||
'vendor/unity/docs/UnityGettingStartedGuide.md',
|
||||
'vendor/unity/docs/UnityHelperScriptsGuide.md',
|
||||
'vendor/unity/docs/ThrowTheSwitchCodingStandard.md',
|
||||
]
|
||||
|
||||
doc_files.each do |f|
|
||||
copy_file(f, in_doc_path.call(File.basename(f)), :force => force)
|
||||
end
|
||||
end
|
||||
|
||||
# If installed locally to project, copy ceedling, unity, cmock, & supports to vendor
|
||||
unless use_gem
|
||||
FileUtils.mkdir_p ceedling_path
|
||||
|
||||
unless no_docs
|
||||
doc_path = File.join(ceedling_path, 'docs')
|
||||
FileUtils.mkdir_p doc_path
|
||||
|
||||
in_doc_path = lambda {|f| File.join(doc_path, f)}
|
||||
|
||||
doc_files = [
|
||||
'docs/CeedlingPacket.md',
|
||||
'vendor/c_exception/docs/CException.md',
|
||||
'vendor/cmock/docs/CMock_Summary.md',
|
||||
'vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf',
|
||||
'vendor/unity/docs/UnityAssertionsReference.md',
|
||||
'vendor/unity/docs/UnityConfigurationGuide.md',
|
||||
'vendor/unity/docs/UnityGettingStartedGuide.md',
|
||||
'vendor/unity/docs/UnityHelperScriptsGuide.md',
|
||||
'vendor/unity/docs/ThrowTheSwitchCodingStandard.md',
|
||||
]
|
||||
|
||||
doc_files.each do |f|
|
||||
copy_file(f, in_doc_path.call(File.basename(f)), :force => force)
|
||||
end
|
||||
end
|
||||
|
||||
folders = if as_gem
|
||||
%w{plugins lib}
|
||||
else
|
||||
%w{plugins lib bin}
|
||||
end
|
||||
|
||||
#copy full folders from ceedling gem into project
|
||||
folders.map do |f|
|
||||
%w{plugins lib bin}.map do |f|
|
||||
{:src => f, :dst => File.join(ceedling_path, f)}
|
||||
end.each do |f|
|
||||
directory(f[:src], f[:dst], :force => force)
|
||||
end
|
||||
|
||||
# mark ceedling as an executable
|
||||
File.chmod(0755, File.join(ceedling_path, 'bin', 'ceedling')) unless is_windows?
|
||||
|
||||
#copy necessary subcomponents from ceedling gem into project
|
||||
sub_components = [
|
||||
{:src => 'vendor/c_exception/lib/', :dst => 'vendor/c_exception/lib'},
|
||||
{:src => 'vendor/c_exception/release/', :dst => 'vendor/c_exception/release'},
|
||||
{:src => 'vendor/cmock/config/', :dst => 'vendor/cmock/config'},
|
||||
{:src => 'vendor/cmock/lib/', :dst => 'vendor/cmock/lib'},
|
||||
{:src => 'vendor/cmock/release/', :dst => 'vendor/cmock/release'},
|
||||
{:src => 'vendor/cmock/src/', :dst => 'vendor/cmock/src'},
|
||||
{:src => 'vendor/deep_merge/lib/', :dst => 'vendor/deep_merge/lib'},
|
||||
{:src => 'vendor/diy/lib', :dst => 'vendor/diy/lib'},
|
||||
{:src => 'vendor/unity/auto/', :dst => 'vendor/unity/auto'},
|
||||
{:src => 'vendor/unity/release/', :dst => 'vendor/unity/release'},
|
||||
{:src => 'vendor/unity/src/', :dst => 'vendor/unity/src'},
|
||||
]
|
||||
|
||||
@ -128,8 +144,9 @@ unless (project_found)
|
||||
end
|
||||
end
|
||||
|
||||
unless (no_configs)
|
||||
if as_gem
|
||||
# We're copying in a configuration file if we haven't said not to
|
||||
if (use_configs)
|
||||
if use_gem
|
||||
copy_file(File.join('assets', 'project_as_gem.yml'), File.join(name, 'project.yml'), :force => force)
|
||||
else
|
||||
copy_file(File.join('assets', 'project_with_guts.yml'), File.join(name, 'project.yml'), :force => force)
|
||||
@ -137,18 +154,20 @@ unless (project_found)
|
||||
copy_file(File.join('assets', 'ceedling.cmd'), File.join(name, 'ceedling.cmd'), :force => force)
|
||||
else
|
||||
copy_file(File.join('assets', 'ceedling'), File.join(name, 'ceedling'), :force => force)
|
||||
File.chmod(0755, File.join(name, 'ceedling'))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (with_ignore)
|
||||
# Copy the gitignore file if requested
|
||||
if (use_ignore)
|
||||
copy_file(File.join('assets', 'default_gitignore'), File.join(name, '.gitignore'), :force => force)
|
||||
end
|
||||
|
||||
unless silent
|
||||
puts "\n"
|
||||
puts "Project '#{name}' #{force ? "upgraded" : "created"}!"
|
||||
puts " - Tool documentation is located in vendor/ceedling/docs" if (not no_docs) and (not as_gem)
|
||||
puts " - Tool documentation is located in vendor/ceedling/docs" if use_docs
|
||||
puts " - Execute 'ceedling help' to view available test & build tasks"
|
||||
puts ''
|
||||
end
|
||||
@ -167,7 +186,7 @@ unless (project_found)
|
||||
def example(proj_name, dest=nil)
|
||||
if dest.nil? then dest = proj_name end
|
||||
|
||||
invoke :new, [dest, true]
|
||||
copy_assets_and_create_structure(dest, true, false, {:local=>true, :docs=>true})
|
||||
|
||||
dest_src = File.join(dest,'src')
|
||||
dest_test = File.join(dest,'test')
|
||||
@ -266,6 +285,8 @@ else
|
||||
abort
|
||||
when /^help$/
|
||||
options[:list_tasks] = true
|
||||
when /^-T$/
|
||||
options[:list_tasks] = true
|
||||
when /^project:(\w+)/
|
||||
ENV['CEEDLING_USER_PROJECT_FILE'] = "#{$1}.yml"
|
||||
else
|
||||
|
11
test/vendor/ceedling/lib/ceedling/cacheinator.rb
vendored
11
test/vendor/ceedling/lib/ceedling/cacheinator.rb
vendored
@ -26,16 +26,21 @@ class Cacheinator
|
||||
return cached_filepath
|
||||
end
|
||||
|
||||
|
||||
def diff_cached_test_config?(hash)
|
||||
cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)
|
||||
|
||||
|
||||
return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
|
||||
end
|
||||
|
||||
def diff_cached_test_defines?(files)
|
||||
cached_filepath = @file_path_utils.form_test_build_cache_path(DEFINES_DEPENDENCY_CACHE_FILE)
|
||||
|
||||
return @cacheinator_helper.diff_cached_defines?( cached_filepath, files )
|
||||
end
|
||||
|
||||
def diff_cached_release_config?(hash)
|
||||
cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE)
|
||||
|
||||
|
||||
return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
|
||||
end
|
||||
|
||||
|
@ -8,5 +8,24 @@ class CacheinatorHelper
|
||||
return true if ( (@file_wrapper.exist?(cached_filepath)) and (!(@yaml_wrapper.load(cached_filepath) == hash)) )
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
def diff_cached_defines?(cached_filepath, files)
|
||||
current_defines = COLLECTION_DEFINES_TEST_AND_VENDOR.reject(&:empty?)
|
||||
|
||||
current_dependency = Hash[files.collect { |source| [source, current_defines.dup] }]
|
||||
if not @file_wrapper.exist?(cached_filepath)
|
||||
@yaml_wrapper.dump(cached_filepath, current_dependency)
|
||||
return false
|
||||
end
|
||||
|
||||
dependencies = @yaml_wrapper.load(cached_filepath)
|
||||
if dependencies.values_at(*current_dependency.keys) != current_dependency.values
|
||||
dependencies.merge!(current_dependency)
|
||||
@yaml_wrapper.dump(cached_filepath, dependencies)
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -64,6 +64,8 @@ class Configurator
|
||||
end
|
||||
|
||||
|
||||
# The default values defined in defaults.rb (eg. DEFAULT_TOOLS_TEST) are populated
|
||||
# into @param config
|
||||
def populate_defaults(config)
|
||||
new_config = DEFAULT_CEEDLING_CONFIG.deep_clone
|
||||
new_config.deep_merge!(config)
|
||||
@ -184,7 +186,8 @@ class Configurator
|
||||
plugin_defaults = @configurator_plugins.find_plugin_defaults(config, paths_hash)
|
||||
|
||||
config_plugins.each do |plugin|
|
||||
config.deep_merge!( @yaml_wrapper.load(plugin) )
|
||||
plugin_config = @yaml_wrapper.load(plugin)
|
||||
config.deep_merge(plugin_config)
|
||||
end
|
||||
|
||||
plugin_defaults.each do |defaults|
|
||||
@ -346,6 +349,10 @@ class Configurator
|
||||
end
|
||||
|
||||
def eval_path_list( paths )
|
||||
if paths.kind_of?(Array)
|
||||
paths = Array.new(paths)
|
||||
end
|
||||
|
||||
paths.flatten.each do |path|
|
||||
path.replace( @system_wrapper.module_eval( path ) ) if (path =~ RUBY_STRING_REPLACEMENT_PATTERN)
|
||||
end
|
||||
|
@ -274,10 +274,17 @@ class ConfiguratorBuilder
|
||||
|
||||
return {:collection_all_assembly => all_assembly} if ((not in_hash[:release_build_use_assembly]) && (not in_hash[:test_build_use_assembly]))
|
||||
|
||||
# Sprinkle in all assembly files we can find in the source folders
|
||||
in_hash[:collection_paths_source].each do |path|
|
||||
all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") )
|
||||
end
|
||||
|
||||
# Also add all assembly files we can find in the support folders
|
||||
in_hash[:collection_paths_support].each do |path|
|
||||
all_assembly.include( File.join(path, "*#{in_hash[:extension_assembly]}") )
|
||||
end
|
||||
|
||||
# Also add files that we are explicitly adding via :files:assembly: section
|
||||
@file_system_utils.revise_file_list( all_assembly, in_hash[:files_assembly] )
|
||||
|
||||
return {:collection_all_assembly => all_assembly}
|
||||
|
@ -63,7 +63,7 @@ DEFAULT_CEEDLING_MAIN_PROJECT_FILE = 'project.yml' unless defined?(DEFAULT_CEEDL
|
||||
DEFAULT_CEEDLING_USER_PROJECT_FILE = 'user.yml' unless defined?(DEFAULT_CEEDLING_USER_PROJECT_FILE) # supplemental user config file
|
||||
|
||||
INPUT_CONFIGURATION_CACHE_FILE = 'input.yml' unless defined?(INPUT_CONFIGURATION_CACHE_FILE) # input configuration file dump
|
||||
|
||||
DEFINES_DEPENDENCY_CACHE_FILE = 'defines_dependency.yml' unless defined?(DEFINES_DEPENDENCY_CACHE_FILE) # preprocessor definitions for files
|
||||
|
||||
TEST_ROOT_NAME = 'test' unless defined?(TEST_ROOT_NAME)
|
||||
TEST_TASK_ROOT = TEST_ROOT_NAME + ':' unless defined?(TEST_TASK_ROOT)
|
||||
|
@ -38,20 +38,23 @@ class Dependinator
|
||||
|
||||
|
||||
def enhance_runner_dependencies(runner_filepath)
|
||||
@rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
||||
@rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
|
||||
@project_config_manager.test_defines_changed)
|
||||
end
|
||||
|
||||
|
||||
def enhance_shallow_include_lists_dependencies(include_lists)
|
||||
include_lists.each do |include_list_filepath|
|
||||
@rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
||||
@rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
|
||||
@project_config_manager.test_defines_changed)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def enhance_preprocesed_file_dependencies(files)
|
||||
files.each do |filepath|
|
||||
@rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
||||
@rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
|
||||
@project_config_manager.test_defines_changed)
|
||||
end
|
||||
end
|
||||
|
||||
@ -59,7 +62,8 @@ class Dependinator
|
||||
def enhance_mock_dependencies(mocks_list)
|
||||
# if input configuration or ceedling changes, make sure these guys get rebuilt
|
||||
mocks_list.each do |mock_filepath|
|
||||
@rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
||||
@rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
|
||||
@project_config_manager.test_defines_changed)
|
||||
@rake_wrapper[mock_filepath].enhance( @configurator.cmock_unity_helper ) if (@configurator.cmock_unity_helper)
|
||||
end
|
||||
end
|
||||
@ -67,25 +71,28 @@ class Dependinator
|
||||
|
||||
def enhance_dependencies_dependencies(dependencies)
|
||||
dependencies.each do |dependencies_filepath|
|
||||
@rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
||||
@rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
|
||||
@project_config_manager.test_defines_changed)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def enhance_test_build_object_dependencies(objects)
|
||||
objects.each do |object_filepath|
|
||||
@rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
||||
@rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
|
||||
@project_config_manager.test_defines_changed)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def enhance_results_dependencies(result_filepath)
|
||||
@rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed)
|
||||
@rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed ||
|
||||
@project_config_manager.test_defines_changed)
|
||||
end
|
||||
|
||||
|
||||
def setup_test_executable_dependencies(test, objects)
|
||||
@rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects)
|
||||
@rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects )
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -19,6 +19,7 @@ class Generator
|
||||
|
||||
|
||||
def generate_shallow_includes_list(context, file)
|
||||
@streaminator.stdout_puts("Generating include list for #{File.basename(file)}...", Verbosity::NORMAL)
|
||||
@preprocessinator.preprocess_shallow_includes(file)
|
||||
end
|
||||
|
||||
@ -92,6 +93,8 @@ class Generator
|
||||
arg_hash[:list],
|
||||
arg_hash[:dependencies])
|
||||
|
||||
@streaminator.stdout_puts("Command: #{command}", Verbosity::DEBUG)
|
||||
|
||||
begin
|
||||
shell_result = @tool_executor.exec( command[:line], command[:options] )
|
||||
rescue ShellExecutionException => ex
|
||||
@ -124,6 +127,7 @@ class Generator
|
||||
arg_hash[:map],
|
||||
arg_hash[:libraries]
|
||||
)
|
||||
@streaminator.stdout_puts("Command: #{command}", Verbosity::DEBUG)
|
||||
|
||||
begin
|
||||
shell_result = @tool_executor.exec( command[:line], command[:options] )
|
||||
@ -157,9 +161,12 @@ class Generator
|
||||
# Unity's exit code is equivalent to the number of failed tests, so we tell @tool_executor not to fail out if there are failures
|
||||
# so that we can run all tests and collect all results
|
||||
command = @tool_executor.build_command_line(arg_hash[:tool], [], arg_hash[:executable])
|
||||
@streaminator.stdout_puts("Command: #{command}", Verbosity::DEBUG)
|
||||
command[:options][:boom] = false
|
||||
shell_result = @tool_executor.exec( command[:line], command[:options] )
|
||||
shell_result[:exit_code] = 0 #Don't Let The Failure Count Make Us Believe Things Aren't Working
|
||||
|
||||
#Don't Let The Failure Count Make Us Believe Things Aren't Working
|
||||
shell_result[:exit_code] = 0
|
||||
@generator_helper.test_results_error_handler(executable, shell_result)
|
||||
|
||||
processed = @generator_test_results.process_and_write_results( shell_result,
|
||||
|
@ -7,7 +7,7 @@ class GeneratorTestResults
|
||||
constructor :configurator, :generator_test_results_sanity_checker, :yaml_wrapper
|
||||
|
||||
def process_and_write_results(unity_shell_result, results_file, test_file)
|
||||
output_file = results_file
|
||||
output_file = results_file
|
||||
|
||||
results = get_results_structure
|
||||
|
||||
@ -17,10 +17,10 @@ class GeneratorTestResults
|
||||
|
||||
# process test statistics
|
||||
if (unity_shell_result[:output] =~ TEST_STDOUT_STATISTICS_PATTERN)
|
||||
results[:counts][:total] = $1.to_i
|
||||
results[:counts][:failed] = $2.to_i
|
||||
results[:counts][:total] = $1.to_i
|
||||
results[:counts][:failed] = $2.to_i
|
||||
results[:counts][:ignored] = $3.to_i
|
||||
results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored])
|
||||
results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored])
|
||||
end
|
||||
|
||||
# remove test statistics lines
|
||||
@ -31,16 +31,16 @@ class GeneratorTestResults
|
||||
case line
|
||||
when /(:IGNORE)/
|
||||
elements = extract_line_elements(line, results[:source][:file])
|
||||
results[:ignores] << elements[0]
|
||||
results[:stdout] << elements[1] if (!elements[1].nil?)
|
||||
results[:ignores] << elements[0]
|
||||
results[:stdout] << elements[1] if (!elements[1].nil?)
|
||||
when /(:PASS$)/
|
||||
elements = extract_line_elements(line, results[:source][:file])
|
||||
results[:successes] << elements[0]
|
||||
results[:stdout] << elements[1] if (!elements[1].nil?)
|
||||
results[:stdout] << elements[1] if (!elements[1].nil?)
|
||||
when /(:FAIL)/
|
||||
elements = extract_line_elements(line, results[:source][:file])
|
||||
results[:failures] << elements[0]
|
||||
results[:stdout] << elements[1] if (!elements[1].nil?)
|
||||
results[:failures] << elements[0]
|
||||
results[:stdout] << elements[1] if (!elements[1].nil?)
|
||||
else # collect up all other
|
||||
results[:stdout] << line.chomp
|
||||
end
|
||||
|
@ -15,7 +15,9 @@ class GeneratorTestRunner
|
||||
pre_test_file = @file_path_utils.form_preprocessed_file_filepath(test_file)
|
||||
|
||||
#actually look for the tests using Unity's test runner generator
|
||||
tests_and_line_numbers = @test_runner_generator.find_tests(@file_wrapper.read(pre_test_file))
|
||||
contents = @file_wrapper.read(pre_test_file)
|
||||
tests_and_line_numbers = @test_runner_generator.find_tests(contents)
|
||||
@test_runner_generator.find_setup_and_teardown(contents)
|
||||
|
||||
#look up the line numbers in the original file
|
||||
source_lines = @file_wrapper.read(test_file).split("\n")
|
||||
@ -31,7 +33,9 @@ class GeneratorTestRunner
|
||||
end
|
||||
else
|
||||
#Just look for the tests using Unity's test runner generator
|
||||
tests_and_line_numbers = @test_runner_generator.find_tests(@file_wrapper.read(test_file))
|
||||
contents = @file_wrapper.read(test_file)
|
||||
tests_and_line_numbers = @test_runner_generator.find_tests(contents)
|
||||
@test_runner_generator.find_setup_and_teardown(contents)
|
||||
end
|
||||
|
||||
return tests_and_line_numbers
|
||||
|
@ -41,7 +41,9 @@ project_file_loader:
|
||||
project_config_manager:
|
||||
compose:
|
||||
- cacheinator
|
||||
- configurator
|
||||
- yaml_wrapper
|
||||
- file_wrapper
|
||||
|
||||
cacheinator:
|
||||
compose:
|
||||
@ -172,6 +174,7 @@ task_invoker:
|
||||
- dependinator
|
||||
- rake_utils
|
||||
- rake_wrapper
|
||||
- project_config_manager
|
||||
|
||||
flaginator:
|
||||
compose:
|
||||
|
@ -28,8 +28,7 @@ class Preprocessinator
|
||||
end
|
||||
|
||||
def preprocess_shallow_includes(filepath)
|
||||
dependencies_rule = @preprocessinator_includes_handler.form_shallow_dependencies_rule(filepath)
|
||||
includes = @preprocessinator_includes_handler.extract_shallow_includes(dependencies_rule)
|
||||
includes = @preprocessinator_includes_handler.extract_includes(filepath)
|
||||
|
||||
@preprocessinator_includes_handler.write_shallow_includes_list(
|
||||
@file_path_utils.form_preprocessed_includes_list_filepath(filepath), includes)
|
||||
|
@ -3,6 +3,7 @@
|
||||
class PreprocessinatorIncludesHandler
|
||||
|
||||
constructor :configurator, :tool_executor, :task_invoker, :file_path_utils, :yaml_wrapper, :file_wrapper
|
||||
@@makefile_cache = {}
|
||||
|
||||
# shallow includes: only those headers a source file explicitly includes
|
||||
|
||||
@ -20,6 +21,9 @@ class PreprocessinatorIncludesHandler
|
||||
# === Return
|
||||
# _String_:: The text of the dependency rule generated by the preprocessor.
|
||||
def form_shallow_dependencies_rule(filepath)
|
||||
if @@makefile_cache.has_key?(filepath)
|
||||
return @@makefile_cache[filepath]
|
||||
end
|
||||
# change filename (prefix of '_') to prevent preprocessor from finding
|
||||
# include files in temp directory containing file it's scanning
|
||||
temp_filepath = @file_path_utils.form_temp_path(filepath, '_')
|
||||
@ -44,6 +48,7 @@ class PreprocessinatorIncludesHandler
|
||||
command = @tool_executor.build_command_line(@configurator.tools_test_includes_preprocessor, [], temp_filepath)
|
||||
shell_result = @tool_executor.exec(command[:line], command[:options])
|
||||
|
||||
@@makefile_cache[filepath] = shell_result[:output]
|
||||
return shell_result[:output]
|
||||
end
|
||||
|
||||
@ -52,19 +57,52 @@ class PreprocessinatorIncludesHandler
|
||||
# provided, annotated Make dependency rule.
|
||||
#
|
||||
# === Arguments
|
||||
# +make_rule+ _String_:: Annotated Make dependency rule.
|
||||
# +filepath+ _String_:: C source or header file to extract includes for.
|
||||
#
|
||||
# === Return
|
||||
# _Array_ of _String_:: Array of the direct dependencies for the source file.
|
||||
def extract_shallow_includes(make_rule)
|
||||
def extract_includes(filepath)
|
||||
to_process = [filepath]
|
||||
ignore_list = []
|
||||
list = []
|
||||
|
||||
include_paths = @configurator.project_config_hash[:collection_paths_include]
|
||||
include_paths = [] if include_paths.nil?
|
||||
include_paths.map! {|path| File.expand_path(path)}
|
||||
|
||||
while to_process.length > 0
|
||||
target = to_process.shift()
|
||||
ignore_list << target
|
||||
# puts "[HELL] Processing: \t\t#{target}"
|
||||
new_deps, new_to_process = extract_includes_helper(target, include_paths, ignore_list)
|
||||
list += new_deps
|
||||
to_process += new_to_process
|
||||
if (!@configurator.project_config_hash.has_key?(:project_auto_link_deep_dependencies) or
|
||||
!@configurator.project_config_hash[:project_auto_link_deep_dependencies])
|
||||
break
|
||||
else
|
||||
list = list.uniq()
|
||||
to_process = to_process.uniq()
|
||||
end
|
||||
end
|
||||
|
||||
return list
|
||||
end
|
||||
|
||||
def extract_includes_helper(filepath, include_paths, ignore_list)
|
||||
# Extract the dependencies from the make rule
|
||||
hdr_ext = @configurator.extension_header
|
||||
make_rule = self.form_shallow_dependencies_rule(filepath)
|
||||
dependencies = make_rule.split.find_all {|path| path.end_with?(hdr_ext) }.uniq
|
||||
dependencies.map! {|hdr| hdr.gsub('\\','/') }
|
||||
|
||||
# Separate the real files form the annotated ones and remove the '@@@@'
|
||||
annotated_headers, real_headers = dependencies.partition {|hdr| hdr =~ /^@@@@/ }
|
||||
annotated_headers.map! {|hdr| hdr.gsub('@@@@','') }
|
||||
# Matching annotated_headers values against real_headers to ensure that
|
||||
# annotated_headers contain full path entries (as returned by make rule)
|
||||
annotated_headers.map! {|hdr| real_headers.find {|real_hdr| !real_hdr.match(/(.*\/)?#{Regexp.escape(hdr)}/).nil? } }
|
||||
annotated_headers = annotated_headers.compact
|
||||
|
||||
# Find which of our annotated headers are "real" dependencies. This is
|
||||
# intended to weed out dependencies that have been removed due to build
|
||||
@ -87,7 +125,54 @@ class PreprocessinatorIncludesHandler
|
||||
sdependencies.map! {|hdr| hdr.gsub('\\','/') }
|
||||
list += sdependencies
|
||||
|
||||
list
|
||||
to_process = []
|
||||
|
||||
if @configurator.project_config_hash.has_key?(:project_auto_link_deep_dependencies) && @configurator.project_config_hash[:project_auto_link_deep_dependencies]
|
||||
# Creating list of mocks
|
||||
mocks = annotated_headers.find_all do |annotated_header|
|
||||
File.basename(annotated_header) =~ /^#{@configurator.project_config_hash[:cmock_mock_prefix]}.*$/
|
||||
end.compact
|
||||
|
||||
# Creating list of headers that should be recursively pre-processed
|
||||
# Skipping mocks and unity.h
|
||||
headers_to_deep_link = annotated_headers.select do |annotated_header|
|
||||
!(mocks.include? annotated_header) and (annotated_header.match(/^(.*\/)?unity\.h$/).nil?)
|
||||
end
|
||||
headers_to_deep_link.map! {|hdr| File.expand_path(hdr)}
|
||||
|
||||
mocks.each do |mock|
|
||||
dirname = File.dirname(mock)
|
||||
#basename = File.basename(mock).delete_prefix(@configurator.project_config_hash[:cmock_mock_prefix])
|
||||
basename = File.basename(mock).sub(@configurator.project_config_hash[:cmock_mock_prefix], '')
|
||||
if dirname != "."
|
||||
ignore_list << File.join(dirname, basename)
|
||||
else
|
||||
ignore_list << basename
|
||||
end
|
||||
end.compact
|
||||
|
||||
# Filtering list of final includes to only include mocks and anything that is NOT in the ignore_list
|
||||
list = list.select do |item|
|
||||
mocks.include? item or !(ignore_list.any? { |ignore_item| !item.match(/^(.*\/)?#{Regexp.escape(ignore_item)}$/).nil? })
|
||||
end
|
||||
|
||||
headers_to_deep_link.each do |hdr|
|
||||
if (ignore_list.none? {|ignore_header| hdr.match(/^(.*\/)?#{Regexp.escape(ignore_header)}$/)} and
|
||||
include_paths.none? {|include_path| hdr =~ /^#{include_path}\.*/})
|
||||
if File.exist?(hdr)
|
||||
to_process << hdr
|
||||
#source_file = hdr.delete_suffix(hdr_ext) + src_ext
|
||||
source_file = hdr.chomp(hdr_ext) + src_ext
|
||||
if source_file != hdr and File.exist?(source_file)
|
||||
to_process << source_file
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return list, to_process
|
||||
|
||||
end
|
||||
|
||||
def write_shallow_includes_list(filepath, list)
|
||||
|
@ -3,16 +3,17 @@ require 'ceedling/constants'
|
||||
|
||||
class ProjectConfigManager
|
||||
|
||||
attr_reader :options_files, :release_config_changed, :test_config_changed
|
||||
attr_reader :options_files, :release_config_changed, :test_config_changed, :test_defines_changed
|
||||
attr_accessor :config_hash
|
||||
|
||||
constructor :cacheinator, :yaml_wrapper
|
||||
constructor :cacheinator, :configurator, :yaml_wrapper, :file_wrapper
|
||||
|
||||
|
||||
def setup
|
||||
@options_files = []
|
||||
@release_config_changed = false
|
||||
@test_config_changed = false
|
||||
@test_defines_changed = false
|
||||
end
|
||||
|
||||
|
||||
@ -34,4 +35,12 @@ class ProjectConfigManager
|
||||
@test_config_changed = @cacheinator.diff_cached_test_config?( @config_hash )
|
||||
end
|
||||
|
||||
def process_test_defines_change(files)
|
||||
# has definitions changed since last test build
|
||||
@test_defines_changed = @cacheinator.diff_cached_test_defines?( files )
|
||||
if @test_defines_changed
|
||||
# update timestamp for rake task prerequisites
|
||||
@file_wrapper.touch( @configurator.project_test_force_rebuild_filepath )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -35,8 +35,7 @@ end
|
||||
|
||||
rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file|
|
||||
|
||||
lib_args = ((defined? LIBRARIES_SYSTEM) ? LIBRARIES_SYSTEM : [])
|
||||
lib_args.map! {|v| LIBRARIES_FLAG.gsub(/\$\{1\}/, v) } if (defined? LIBRARIES_FLAG)
|
||||
lib_args = @ceedling[:test_invoker].convert_libraries_to_arguments()
|
||||
|
||||
@ceedling[:generator].generate_executable_file(
|
||||
TOOLS_TEST_LINKER,
|
||||
@ -67,6 +66,7 @@ namespace TEST_SYM do
|
||||
@ceedling[:file_finder].find_test_from_file_path(test)
|
||||
end
|
||||
]) do |test|
|
||||
@ceedling[:rake_wrapper][:directories].reenable if @ceedling[:task_invoker].first_run == false && @ceedling[:project_config_manager].test_defines_changed
|
||||
@ceedling[:rake_wrapper][:directories].invoke
|
||||
@ceedling[:test_invoker].setup_and_invoke([test.source])
|
||||
end
|
||||
|
@ -1,8 +1,16 @@
|
||||
|
||||
class StreamWrapper
|
||||
|
||||
def stdout_override(&fnc)
|
||||
@stdout_overide_fnc = fnc
|
||||
end
|
||||
|
||||
def stdout_puts(string)
|
||||
$stdout.puts(string)
|
||||
if @stdout_overide_fnc
|
||||
@stdout_overide_fnc.call(string)
|
||||
else
|
||||
$stdout.puts(string)
|
||||
end
|
||||
end
|
||||
|
||||
def stdout_flush
|
||||
|
@ -2,11 +2,14 @@ require 'ceedling/par_map'
|
||||
|
||||
class TaskInvoker
|
||||
|
||||
constructor :dependinator, :rake_utils, :rake_wrapper
|
||||
attr_accessor :first_run
|
||||
|
||||
constructor :dependinator, :rake_utils, :rake_wrapper, :project_config_manager
|
||||
|
||||
def setup
|
||||
@test_regexs = [/^#{TEST_ROOT_NAME}:/]
|
||||
@release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/]
|
||||
@first_run = true
|
||||
end
|
||||
|
||||
def add_test_task_regex(regex)
|
||||
@ -46,17 +49,22 @@ class TaskInvoker
|
||||
|
||||
def invoke_test_mocks(mocks)
|
||||
@dependinator.enhance_mock_dependencies( mocks )
|
||||
mocks.each { |mock| @rake_wrapper[mock].invoke }
|
||||
mocks.each { |mock|
|
||||
@rake_wrapper[mock].reenable if @first_run == false && @project_config_manager.test_defines_changed
|
||||
@rake_wrapper[mock].invoke
|
||||
}
|
||||
end
|
||||
|
||||
def invoke_test_runner(runner)
|
||||
@dependinator.enhance_runner_dependencies( runner )
|
||||
@rake_wrapper[runner].reenable if @first_run == false && @project_config_manager.test_defines_changed
|
||||
@rake_wrapper[runner].invoke
|
||||
end
|
||||
|
||||
def invoke_test_shallow_include_lists(files)
|
||||
@dependinator.enhance_shallow_include_lists_dependencies( files )
|
||||
par_map(PROJECT_COMPILE_THREADS, files) do |file|
|
||||
@rake_wrapper[file].reenable if @first_run == false && @project_config_manager.test_defines_changed
|
||||
@rake_wrapper[file].invoke
|
||||
end
|
||||
end
|
||||
@ -64,6 +72,7 @@ class TaskInvoker
|
||||
def invoke_test_preprocessed_files(files)
|
||||
@dependinator.enhance_preprocesed_file_dependencies( files )
|
||||
par_map(PROJECT_COMPILE_THREADS, files) do |file|
|
||||
@rake_wrapper[file].reenable if @first_run == false && @project_config_manager.test_defines_changed
|
||||
@rake_wrapper[file].invoke
|
||||
end
|
||||
end
|
||||
@ -71,30 +80,37 @@ class TaskInvoker
|
||||
def invoke_test_dependencies_files(files)
|
||||
@dependinator.enhance_dependencies_dependencies( files )
|
||||
par_map(PROJECT_COMPILE_THREADS, files) do |file|
|
||||
@rake_wrapper[file].reenable if @first_run == false && @project_config_manager.test_defines_changed
|
||||
@rake_wrapper[file].invoke
|
||||
end
|
||||
end
|
||||
|
||||
def invoke_test_objects(objects)
|
||||
par_map(PROJECT_COMPILE_THREADS, objects) do |object|
|
||||
@rake_wrapper[object].invoke
|
||||
@rake_wrapper[object].reenable if @first_run == false && @project_config_manager.test_defines_changed
|
||||
@rake_wrapper[object].invoke
|
||||
end
|
||||
end
|
||||
|
||||
def invoke_test_executable(file)
|
||||
@rake_wrapper[file].invoke
|
||||
end
|
||||
|
||||
def invoke_test_results(result)
|
||||
@dependinator.enhance_results_dependencies( result )
|
||||
@rake_wrapper[result].reenable if @first_run == false && @project_config_manager.test_defines_changed
|
||||
@rake_wrapper[result].invoke
|
||||
end
|
||||
|
||||
def invoke_release_dependencies_files(files)
|
||||
par_map(PROJECT_COMPILE_THREADS, files) do |file|
|
||||
@rake_wrapper[file].invoke
|
||||
@rake_wrapper[file].invoke
|
||||
end
|
||||
end
|
||||
|
||||
def invoke_release_objects(objects)
|
||||
par_map(PROJECT_COMPILE_THREADS, objects) do |object|
|
||||
@rake_wrapper[object].invoke
|
||||
@rake_wrapper[object].invoke
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -89,7 +89,6 @@ namespace :options do
|
||||
|
||||
desc "Merge #{option} project options."
|
||||
task option.downcase.to_sym do
|
||||
# @ceedling[:setupinator].reset_defaults( @ceedling[:setupinator].config_hash )
|
||||
hash = @ceedling[:project_config_manager].merge_options( @ceedling[:setupinator].config_hash, option_path )
|
||||
@ceedling[:setupinator].do_setup( hash )
|
||||
if @ceedling[:configurator].project_release_build
|
||||
|
@ -81,7 +81,10 @@ namespace :files do
|
||||
['source', COLLECTION_ALL_SOURCE],
|
||||
['header', COLLECTION_ALL_HEADERS]
|
||||
]
|
||||
categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if (RELEASE_BUILD_USE_ASSEMBLY)
|
||||
|
||||
using_assembly = (defined?(TEST_BUILD_USE_ASSEMBLY) && TEST_BUILD_USE_ASSEMBLY) ||
|
||||
(defined?(RELEASE_BUILD_USE_ASSEMBLY) && RELEASE_BUILD_USE_ASSEMBLY)
|
||||
categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if using_assembly
|
||||
|
||||
categories.each do |category|
|
||||
name = category[0]
|
||||
|
@ -1,7 +1,7 @@
|
||||
require 'ceedling/constants'
|
||||
|
||||
task :test => [:directories] do
|
||||
@ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS)
|
||||
Rake.application['test:all'].invoke
|
||||
end
|
||||
|
||||
namespace TEST_SYM do
|
||||
@ -25,6 +25,11 @@ namespace TEST_SYM do
|
||||
@ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, TEST_SYM, {:force_run => false})
|
||||
end
|
||||
|
||||
desc "Just build tests without running."
|
||||
task :build_only => [:directories] do
|
||||
@ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, TEST_SYM, {:build_only => true})
|
||||
end
|
||||
|
||||
desc "Run tests by matching regular expression pattern."
|
||||
task :pattern, [:regex] => [:directories] do |t, args|
|
||||
matches = []
|
||||
|
@ -54,7 +54,20 @@ class TestInvoker
|
||||
end
|
||||
end
|
||||
|
||||
def setup_and_invoke(tests, context=TEST_SYM, options={:force_run => true})
|
||||
# Convert libraries configuration form YAML configuration
|
||||
# into a string that can be given to the compiler.
|
||||
def convert_libraries_to_arguments()
|
||||
if @configurator.project_config_hash.has_key?(:libraries_test)
|
||||
lib_args = @configurator.project_config_hash[:libraries_test]
|
||||
lib_args.flatten!
|
||||
lib_flag = @configurator.project_config_hash[:libraries_flag]
|
||||
lib_args.map! {|v| lib_flag.gsub(/\$\{1\}/, v) } if (defined? lib_flag)
|
||||
return lib_args
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def setup_and_invoke(tests, context=TEST_SYM, options={:force_run => true, :build_only => false})
|
||||
|
||||
@tests = tests
|
||||
|
||||
@ -68,7 +81,7 @@ class TestInvoker
|
||||
begin
|
||||
@plugin_manager.pre_test( test )
|
||||
test_name ="#{File.basename(test)}".chomp('.c')
|
||||
def_test_key="defines_#{test_name}"
|
||||
def_test_key="defines_#{test_name.downcase}"
|
||||
|
||||
# Re-define the project out path and pre-processor defines.
|
||||
if @configurator.project_config_hash.has_key?(def_test_key.to_sym)
|
||||
@ -94,6 +107,8 @@ class TestInvoker
|
||||
results_pass = @file_path_utils.form_pass_results_filepath( test )
|
||||
results_fail = @file_path_utils.form_fail_results_filepath( test )
|
||||
|
||||
@project_config_manager.process_test_defines_change(sources)
|
||||
|
||||
# add the definition value in the build option for the unit test
|
||||
if @configurator.defines_use_test_definition
|
||||
add_test_definition(test)
|
||||
@ -119,8 +134,15 @@ class TestInvoker
|
||||
# build test objects
|
||||
@task_invoker.invoke_test_objects( objects )
|
||||
|
||||
# 3, 2, 1... launch
|
||||
@task_invoker.invoke_test_results( results_pass )
|
||||
# if the option build_only has been specified, build only the executable
|
||||
# but don't run the test
|
||||
if (options[:build_only])
|
||||
executable = @file_path_utils.form_test_executable_filepath( test )
|
||||
@task_invoker.invoke_test_executable( executable )
|
||||
else
|
||||
# 3, 2, 1... launch
|
||||
@task_invoker.invoke_test_results( results_pass )
|
||||
end
|
||||
rescue => e
|
||||
@build_invoker_utils.process_exception( e, context )
|
||||
ensure
|
||||
@ -142,6 +164,8 @@ class TestInvoker
|
||||
# store away what's been processed
|
||||
@mocks.concat( mock_list )
|
||||
@sources.concat( sources )
|
||||
|
||||
@task_invoker.first_run = false
|
||||
end
|
||||
|
||||
# post-process collected mock list
|
||||
|
@ -18,6 +18,8 @@ class ToolExecutor
|
||||
end
|
||||
|
||||
# build up a command line from yaml provided config
|
||||
|
||||
# @param extra_params is an array of parameters to append to executable
|
||||
def build_command_line(tool_config, extra_params, *args)
|
||||
@tool_name = tool_config[:name]
|
||||
@executable = tool_config[:executable]
|
||||
@ -50,7 +52,6 @@ class ToolExecutor
|
||||
options[:boom] = true if (options[:boom].nil?)
|
||||
options[:stderr_redirect] = StdErrRedirect::NONE if (options[:stderr_redirect].nil?)
|
||||
options[:background_exec] = BackgroundExec::NONE if (options[:background_exec].nil?)
|
||||
|
||||
# build command line
|
||||
command_line = [
|
||||
@tool_executor_helper.background_exec_cmdline_prepend( options ),
|
||||
@ -60,6 +61,8 @@ class ToolExecutor
|
||||
@tool_executor_helper.background_exec_cmdline_append( options ),
|
||||
].flatten.compact.join(' ')
|
||||
|
||||
@streaminator.stderr_puts("Verbose: #{__method__.to_s}(): #{command_line}", Verbosity::DEBUG)
|
||||
|
||||
shell_result = {}
|
||||
|
||||
# depending on background exec option, we shell out differently
|
||||
@ -73,7 +76,10 @@ class ToolExecutor
|
||||
shell_result[:time] = time
|
||||
|
||||
#scrub the string for illegal output
|
||||
shell_result[:output].scrub! unless (!("".respond_to? :scrub!) || (shell_result[:output].nil?))
|
||||
unless shell_result[:output].nil?
|
||||
shell_result[:output] = shell_result[:output].scrub if "".respond_to?(:scrub)
|
||||
shell_result[:output].gsub!(/\033\[\d\dm/,'')
|
||||
end
|
||||
|
||||
@tool_executor_helper.print_happy_results( command_line, shell_result, options[:boom] )
|
||||
@tool_executor_helper.print_error_results( command_line, shell_result, options[:boom] )
|
||||
|
39
test/vendor/ceedling/lib/ceedling/version.rb
vendored
39
test/vendor/ceedling/lib/ceedling/version.rb
vendored
@ -1,15 +1,36 @@
|
||||
|
||||
# @private
|
||||
module Ceedling
|
||||
module Version
|
||||
# @private
|
||||
GEM = "0.28.3"
|
||||
# @private
|
||||
# Check for local or global version of vendor directory in order to look up versions
|
||||
{
|
||||
"CEXCEPTION" => File.join("vendor","c_exception","lib","CException.h"),
|
||||
"CMOCK" => File.join("vendor","cmock","src","cmock.h"),
|
||||
"UNITY" => File.join("vendor","unity","src","unity.h"),
|
||||
}.each_pair do |name, path|
|
||||
filename = if (File.exist?(File.join("..","..",path)))
|
||||
File.join("..","..",path)
|
||||
elsif (File.exist?(File.join(File.dirname(__FILE__),"..","..",path)))
|
||||
File.join(File.dirname(__FILE__),"..","..",path)
|
||||
else
|
||||
eval "#{name} = 'unknown'"
|
||||
continue
|
||||
end
|
||||
|
||||
# Actually look up the versions
|
||||
a = [0,0,0]
|
||||
File.readlines(filename) do |line|
|
||||
["VERSION_MAJOR", "VERSION_MINOR", "VERSION_BUILD"].each_with_index do |field, i|
|
||||
m = line.match(/#{name}_#{field}\s+(\d+)/)
|
||||
a[i] = m[1] unless (m.nil?)
|
||||
end
|
||||
end
|
||||
|
||||
# Make a constant from each, so that we can use it elsewhere
|
||||
eval "#{name} = '#{a.join(".")}'"
|
||||
end
|
||||
|
||||
GEM = "0.29.0"
|
||||
CEEDLING = GEM
|
||||
# @private
|
||||
CEXCEPTION = "1.3.1"
|
||||
# @private
|
||||
CMOCK = "2.4.5"
|
||||
# @private
|
||||
UNITY = "2.4.2"
|
||||
end
|
||||
end
|
||||
|
@ -15,7 +15,6 @@ Define any of these sections in :tools: to provide additional hooks to be called
|
||||
:pre_link_execute
|
||||
:post_link_execute
|
||||
:pre_test_fixture_execute
|
||||
:pre_test_fixture_execute
|
||||
:pre_test
|
||||
:post_test
|
||||
:pre_release
|
||||
@ -24,13 +23,13 @@ Define any of these sections in :tools: to provide additional hooks to be called
|
||||
:post_build
|
||||
```
|
||||
|
||||
Each of these tools can support an :executable string and an :args list, like so:
|
||||
Each of these tools can support an :executable string and an :arguments list, like so:
|
||||
|
||||
```
|
||||
:tools:
|
||||
:post_link_execute:
|
||||
:executable: objcopy.exe
|
||||
:args:
|
||||
:arguments:
|
||||
- ${1} #This is replaced with the executable name
|
||||
- output.srec
|
||||
- --strip-all
|
||||
@ -42,11 +41,13 @@ You may also specify an array of executables to be called in a particular place,
|
||||
:tools:
|
||||
:post_test:
|
||||
- :executable: echo
|
||||
:args: "${1} was glorious!"
|
||||
:arguments: "${1} was glorious!"
|
||||
- :executable: echo
|
||||
:args:
|
||||
:arguments:
|
||||
- it kinda made me cry a little.
|
||||
- you?
|
||||
```
|
||||
|
||||
Please note that it varies which arguments are being parsed down to the
|
||||
hooks. For now see `command_hooks.rb` to figure out which suits you best.
|
||||
Happy Tweaking!
|
||||
|
@ -1,6 +1,5 @@
|
||||
require 'ceedling/plugin'
|
||||
require 'ceedling/constants'
|
||||
|
||||
class CommandHooks < Plugin
|
||||
|
||||
attr_reader :config
|
||||
@ -23,7 +22,6 @@ class CommandHooks < Plugin
|
||||
:post_release => ((defined? TOOLS_POST_RELEASE) ? TOOLS_POST_RELEASE : nil ),
|
||||
:pre_build => ((defined? TOOLS_PRE_BUILD) ? TOOLS_PRE_BUILD : nil ),
|
||||
:post_build => ((defined? TOOLS_POST_BUILD) ? TOOLS_POST_BUILD : nil ),
|
||||
:post_build => ((defined? TOOLS_POST_BUILD) ? TOOLS_POST_BUILD : nil ),
|
||||
:post_error => ((defined? TOOLS_POST_ERROR) ? TOOLS_POST_ERROR : nil ),
|
||||
}
|
||||
@plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||
@ -49,14 +47,33 @@ class CommandHooks < Plugin
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
# Run a hook if its available.
|
||||
#
|
||||
# :args:
|
||||
# - hook: Name of the hook to run
|
||||
# - name: Name of file (default: "")
|
||||
#
|
||||
# :return:
|
||||
# shell_result.
|
||||
#
|
||||
def run_hook_step(hook, name="")
|
||||
if (hook[:executable])
|
||||
args = ( (hook[:args].is_a? Array) ? hook[:args] : [] )
|
||||
cmd = @ceedling[:tool_executor].build_command_line( hook, args, name )
|
||||
shell_result = @ceedling[:tool_executor].exec( cmd[:line], cmd[:options] )
|
||||
# Handle argument replacemant ({$1}), and get commandline
|
||||
cmd = @ceedling[:tool_executor].build_command_line( hook, [], name )
|
||||
shell_result = @ceedling[:tool_executor].exec(cmd[:line], cmd[:options])
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Run a hook if its available.
|
||||
#
|
||||
# If __which_hook__ is an array, run each of them sequentially.
|
||||
#
|
||||
# :args:
|
||||
# - which_hook: Name of the hook to run
|
||||
# - name: Name of file
|
||||
#
|
||||
def run_hook(which_hook, name="")
|
||||
if (@config[which_hook])
|
||||
@ceedling[:streaminator].stdout_puts("Running Hook #{which_hook}...", Verbosity::NORMAL)
|
||||
|
75
test/vendor/ceedling/plugins/gcov/README.md
vendored
75
test/vendor/ceedling/plugins/gcov/README.md
vendored
@ -1,13 +1,16 @@
|
||||
ceedling-gcov
|
||||
=============
|
||||
|
||||
# Plugin Overview
|
||||
|
||||
Plugin for integrating GNU GCov code coverage tool into Ceedling projects.
|
||||
Currently only designed for the gcov command (like LCOV for example). In the
|
||||
future we could configure this to work with other code coverage tools.
|
||||
|
||||
This plugin currently uses `gcovr` to generate HTML and/or XML reports as a
|
||||
utility. The normal gcov plugin _must_ be run first for this report to generate.
|
||||
|
||||
This plugin currently uses `gcovr` to generate HTML reports as a utility. The
|
||||
normal gcov plugin _must_ be run first for this report to generate.
|
||||
## Installation
|
||||
|
||||
Gcovr can be installed via pip like so:
|
||||
|
||||
@ -15,27 +18,83 @@ Gcovr can be installed via pip like so:
|
||||
pip install gcovr
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The gcov plugin supports configuration options via your `project.yml` provided
|
||||
by Ceedling.
|
||||
|
||||
Generation of HTML reports may be enabled or disabled with the following
|
||||
config. Set to `true` to enable or set to `false` to disable.
|
||||
|
||||
```
|
||||
:gcov:
|
||||
:html_report: true
|
||||
```
|
||||
|
||||
Generation of XML reports may be enabled or disabled with the following
|
||||
config. Set to `true` to enable or set to `false` to disable.
|
||||
|
||||
```
|
||||
:gcov:
|
||||
:xml_report: true
|
||||
```
|
||||
|
||||
There are two types of gcovr HTML reports that can be configured in your
|
||||
`project.yml`. To create a basic HTML report with only the overall file
|
||||
information use the following config.
|
||||
`project.yml`. To create a basic HTML report, with only the overall file
|
||||
information, use the following config.
|
||||
|
||||
```
|
||||
:gcov:
|
||||
:html_report_type: basic
|
||||
```
|
||||
To create a detailed HTML report with line by line breakdown of the coverage use
|
||||
the following config.
|
||||
|
||||
To create a detailed HTML report, with line by line breakdown of the
|
||||
coverage, use the following config.
|
||||
|
||||
```
|
||||
:gcov:
|
||||
:html_report_type: detailed
|
||||
```
|
||||
|
||||
These reports will be found in `build/artifacts/gcov`.
|
||||
There are a number of options to control which files are considered part of
|
||||
the coverage report. Most often, we only care about coverage on our source code, and not
|
||||
on tests or automatically generated mocks, runners, etc. However, there are times
|
||||
where this isn't true... or there are times where we've moved ceedling's directory
|
||||
structure so that the project file isn't at the root of the project anymore. In these
|
||||
cases, you may need to tweak the following:
|
||||
|
||||
```
|
||||
:gcov:
|
||||
:report_root: "."
|
||||
:report_exclude: "^build|^vendor|^test|^support"
|
||||
:report_include: "^src"
|
||||
```
|
||||
|
||||
One important note about html_report_root: gcovr will only take a single root folder, unlike
|
||||
Ceedling's ability to take as many as you like. So you will need to choose a folder which is
|
||||
a superset of ALL the folders you want, and then use the include or exclude options to set up
|
||||
patterns of files to pay attention to or ignore. It's not ideal, but it works.
|
||||
|
||||
# To-Do list
|
||||
Finally, there are a number of settings which can be specified in order to adjust the
|
||||
default behaviors of gcov:
|
||||
|
||||
```
|
||||
:gcov:
|
||||
:html_medium_threshold: 75
|
||||
:html_high_threshold: 90
|
||||
:fail_under_line: 30
|
||||
:fail_under_branch: 30
|
||||
```
|
||||
|
||||
These HTML and XML reports will be found in `build/artifacts/gcov`.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```
|
||||
ceedling gcov:all utils:gcov
|
||||
```
|
||||
|
||||
## To-Do list
|
||||
|
||||
- Generate overall report (combined statistics from all files with coverage)
|
||||
- Generate coverage output files
|
||||
|
@ -11,6 +11,7 @@
|
||||
- -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE
|
||||
- -D$: COLLECTION_DEFINES_TEST_AND_VENDOR
|
||||
- -DGCOV_COMPILER
|
||||
- -DCODE_COVERAGE
|
||||
- -c "${1}"
|
||||
- -o "${2}"
|
||||
:gcov_linker:
|
||||
@ -20,6 +21,7 @@
|
||||
- -ftest-coverage
|
||||
- ${1}
|
||||
- -o ${2}
|
||||
- ${3}
|
||||
:gcov_fixture:
|
||||
:executable: ${1}
|
||||
:gcov_report:
|
||||
@ -36,9 +38,8 @@
|
||||
:arguments:
|
||||
- -p
|
||||
- -b
|
||||
- -e "${1}"
|
||||
- ${1}
|
||||
- --html
|
||||
- -r .
|
||||
- -o GcovCoverageResults.html
|
||||
:gcov_post_report_basic:
|
||||
:executable: gcovr
|
||||
@ -46,9 +47,8 @@
|
||||
:arguments:
|
||||
- -p
|
||||
- -b
|
||||
- -e "${1}"
|
||||
- ${1}
|
||||
- --html
|
||||
- -r .
|
||||
- -o "$": GCOV_ARTIFACTS_FILE
|
||||
:gcov_post_report_advanced:
|
||||
:executable: gcovr
|
||||
@ -56,11 +56,18 @@
|
||||
:arguments:
|
||||
- -p
|
||||
- -b
|
||||
- -e "${1}"
|
||||
- ${1}
|
||||
- --html
|
||||
- --html-details
|
||||
- -r .
|
||||
- -o "$": GCOV_ARTIFACTS_FILE
|
||||
|
||||
:gcov_post_report_xml:
|
||||
:executable: gcovr
|
||||
:optional: TRUE
|
||||
:arguments:
|
||||
- -p
|
||||
- -b
|
||||
- ${1}
|
||||
- --xml
|
||||
- -o "$": GCOV_ARTIFACTS_FILE_XML
|
||||
|
||||
...
|
||||
|
66
test/vendor/ceedling/plugins/gcov/gcov.rake
vendored
66
test/vendor/ceedling/plugins/gcov/gcov.rake
vendored
@ -31,11 +31,14 @@ rule(/#{GCOV_BUILD_OUTPUT_PATH}\/#{'.+\\' + EXTENSION_OBJECT}$/ => [
|
||||
end
|
||||
|
||||
rule(/#{GCOV_BUILD_OUTPUT_PATH}\/#{'.+\\' + EXTENSION_EXECUTABLE}$/) do |bin_file|
|
||||
lib_args = @ceedling[:test_invoker].convert_libraries_to_arguments()
|
||||
|
||||
@ceedling[:generator].generate_executable_file(
|
||||
TOOLS_GCOV_LINKER,
|
||||
GCOV_SYM,
|
||||
bin_file.prerequisites,
|
||||
bin_file.name,
|
||||
lib_args,
|
||||
@ceedling[:file_path_utils].form_test_build_map_filepath(bin_file.name)
|
||||
)
|
||||
end
|
||||
@ -151,6 +154,17 @@ if PROJECT_USE_DEEP_DEPENDENCIES
|
||||
end
|
||||
|
||||
namespace UTILS_SYM do
|
||||
def gcov_args_builder(opts)
|
||||
args = ""
|
||||
args += "-r \"#{opts[:gcov_report_root] || '.'}\" "
|
||||
args += "-f \"#{opts[:gcov_report_include]}\" " unless opts[:gcov_report_include].nil?
|
||||
args += "-e \"#{opts[:gcov_report_exclude] || GCOV_FILTER_EXCLUDE}\" "
|
||||
[ :gcov_fail_under_line, :gcov_fail_under_branch, :gcov_html_medium_threshold, :gcov_html_high_threshold].each do |opt|
|
||||
args += "--#{opt.to_s.gsub('_','-').sub(/:?gcov-/,'')} #{opts[opt]} " unless opts[opt].nil?
|
||||
end
|
||||
return args
|
||||
end
|
||||
|
||||
desc 'Create gcov code coverage html report (must run ceedling gcov first)'
|
||||
task GCOV_SYM do
|
||||
|
||||
@ -158,23 +172,49 @@ namespace UTILS_SYM do
|
||||
FileUtils.mkdir_p GCOV_ARTIFACTS_PATH
|
||||
end
|
||||
|
||||
filter = @ceedling[:configurator].project_config_hash[:gcov_html_report_filter] || GCOV_FILTER_EXPR
|
||||
args = gcov_args_builder(@ceedling[:configurator].project_config_hash)
|
||||
|
||||
if @ceedling[:configurator].project_config_hash[:gcov_html_report_type] == 'basic'
|
||||
puts "Creating a basic html report of gcov results in #{GCOV_ARTIFACTS_FILE}..."
|
||||
command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_POST_REPORT_BASIC, [], filter)
|
||||
@ceedling[:tool_executor].exec(command[:line], command[:options])
|
||||
elsif @ceedling[:configurator].project_config_hash[:gcov_html_report_type] == 'detailed'
|
||||
puts "Creating a detailed html report of gcov results in #{GCOV_ARTIFACTS_FILE}..."
|
||||
command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_POST_REPORT_ADVANCED, [], filter)
|
||||
@ceedling[:tool_executor].exec(command[:line], command[:options])
|
||||
if @ceedling[:configurator].project_config_hash[:gcov_html_report].nil?
|
||||
puts "In your project.yml, define: \n\n:gcov:\n :html_report:\n\n to true or false to refine this feature."
|
||||
puts "For now, assumimg you want an html report generated."
|
||||
html_enabled = true
|
||||
else
|
||||
puts "In your project.yml, define: \n\n:gcov:\n :html_report_type:\n\n to basic or detailed to refine this feature."
|
||||
puts "For now, just creating basic."
|
||||
puts "Creating a basic html report of gcov results in #{GCOV_ARTIFACTS_FILE}..."
|
||||
command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_POST_REPORT_BASIC, [], filter)
|
||||
html_enabled = @ceedling[:configurator].project_config_hash[:gcov_html_report]
|
||||
end
|
||||
|
||||
if @ceedling[:configurator].project_config_hash[:gcov_xml_report].nil?
|
||||
puts "In your project.yml, define: \n\n:gcov:\n :xml_report:\n\n to true or false to refine this feature."
|
||||
puts "For now, assumimg you do not want an xml report generated."
|
||||
xml_enabled = false
|
||||
else
|
||||
xml_enabled = @ceedling[:configurator].project_config_hash[:gcov_xml_report]
|
||||
end
|
||||
|
||||
if html_enabled
|
||||
if @ceedling[:configurator].project_config_hash[:gcov_html_report_type] == 'basic'
|
||||
puts "Creating a basic html report of gcov results in #{GCOV_ARTIFACTS_FILE}..."
|
||||
command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_POST_REPORT_BASIC, [], args)
|
||||
@ceedling[:tool_executor].exec(command[:line], command[:options])
|
||||
elsif @ceedling[:configurator].project_config_hash[:gcov_html_report_type] == 'detailed'
|
||||
puts "Creating a detailed html report of gcov results in #{GCOV_ARTIFACTS_FILE}..."
|
||||
command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_POST_REPORT_ADVANCED, [], args)
|
||||
@ceedling[:tool_executor].exec(command[:line], command[:options])
|
||||
|
||||
else
|
||||
puts "In your project.yml, define: \n\n:gcov:\n :html_report_type:\n\n to basic or detailed to refine this feature."
|
||||
puts "For now, just creating basic."
|
||||
puts "Creating a basic html report of gcov results in #{GCOV_ARTIFACTS_FILE}..."
|
||||
command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_POST_REPORT_BASIC, [], args)
|
||||
@ceedling[:tool_executor].exec(command[:line], command[:options])
|
||||
end
|
||||
end
|
||||
|
||||
if xml_enabled
|
||||
puts "Creating an xml report of gcov results in #{GCOV_ARTIFACTS_FILE_XML}..."
|
||||
command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_POST_REPORT_XML, [], filter)
|
||||
@ceedling[:tool_executor].exec(command[:line], command[:options])
|
||||
end
|
||||
|
||||
puts "Done."
|
||||
end
|
||||
end
|
||||
|
13
test/vendor/ceedling/plugins/gcov/lib/gcov.rb
vendored
13
test/vendor/ceedling/plugins/gcov/lib/gcov.rb
vendored
@ -14,8 +14,7 @@ class Gcov < Plugin
|
||||
project_test_results_path: GCOV_RESULTS_PATH,
|
||||
project_test_dependencies_path: GCOV_DEPENDENCIES_PATH,
|
||||
defines_test: DEFINES_TEST + ['CODE_COVERAGE'],
|
||||
collection_defines_test_and_vendor: COLLECTION_DEFINES_TEST_AND_VENDOR + ['CODE_COVERAGE'],
|
||||
gcov_html_report_filter: GCOV_FILTER_EXPR
|
||||
gcov_html_report_filter: GCOV_FILTER_EXCLUDE
|
||||
}
|
||||
|
||||
@plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||
@ -23,13 +22,15 @@ class Gcov < Plugin
|
||||
end
|
||||
|
||||
def generate_coverage_object_file(source, object)
|
||||
lib_args = @ceedling[:test_invoker].convert_libraries_to_arguments()
|
||||
compile_command =
|
||||
@ceedling[:tool_executor].build_command_line(
|
||||
TOOLS_GCOV_COMPILER,
|
||||
@ceedling[:flaginator].flag_down(OPERATION_COMPILE_SYM, GCOV_SYM, source),
|
||||
source,
|
||||
object,
|
||||
@ceedling[:file_path_utils].form_test_build_list_filepath(object)
|
||||
@ceedling[:file_path_utils].form_test_build_list_filepath(object),
|
||||
lib_args
|
||||
)
|
||||
@ceedling[:streaminator].stdout_puts("Compiling #{File.basename(source)} with coverage...")
|
||||
@ceedling[:tool_executor].exec(compile_command[:line], compile_command[:options])
|
||||
@ -96,6 +97,12 @@ class Gcov < Plugin
|
||||
@ceedling[:streaminator].stdout_puts(report + "\n\n")
|
||||
end
|
||||
end
|
||||
|
||||
COLLECTION_ALL_SOURCE.each do |source|
|
||||
unless coverage_sources.include?(source)
|
||||
@ceedling[:streaminator].stdout_puts("Could not find coverage results for " + source + "\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -10,9 +10,10 @@ GCOV_DEPENDENCIES_PATH = File.join(GCOV_BUILD_PATH, "dependencies")
|
||||
GCOV_ARTIFACTS_PATH = File.join(PROJECT_BUILD_ARTIFACTS_ROOT, GCOV_ROOT_NAME)
|
||||
|
||||
GCOV_ARTIFACTS_FILE = File.join(GCOV_ARTIFACTS_PATH, "GcovCoverageResults.html")
|
||||
GCOV_ARTIFACTS_FILE_XML = File.join(GCOV_ARTIFACTS_PATH, "GcovCoverageResults.xml")
|
||||
|
||||
GCOV_IGNORE_SOURCES = %w(unity cmock cexception).freeze
|
||||
|
||||
GCOV_FILTER_EXPR = '^vendor.*|^build.*|^test.*|^lib.*'
|
||||
GCOV_FILTER_EXCLUDE = '^vendor.*|^build.*|^test.*|^lib.*'
|
||||
|
||||
|
||||
|
@ -22,7 +22,10 @@ class JunitTestsReport < Plugin
|
||||
def post_build
|
||||
@results_list.each_key do |context|
|
||||
results = @ceedling[:plugin_reportinator].assemble_test_results(@results_list[context])
|
||||
file_path = File.join( PROJECT_BUILD_ARTIFACTS_ROOT, context.to_s, 'report.xml' )
|
||||
|
||||
artifact_filename = @ceedling[:configurator].project_config_hash[:junit_tests_report_artifact_filename] || 'report.xml'
|
||||
artifact_fullpath = @ceedling[:configurator].project_config_hash[:junit_tests_report_path] || File.join(PROJECT_BUILD_ARTIFACTS_ROOT, context.to_s)
|
||||
file_path = File.join(artifact_fullpath, artifact_filename)
|
||||
|
||||
@ceedling[:file_wrapper].open( file_path, 'w' ) do |f|
|
||||
@testsuite_counter = 0
|
||||
@ -90,7 +93,14 @@ class JunitTestsReport < Plugin
|
||||
|
||||
unless suite[:stdout].empty?
|
||||
stream.puts(' <system-out>')
|
||||
suite[:stdout].each{|line| stream.puts line }
|
||||
suite[:stdout].each do |line|
|
||||
line.gsub!(/&/, '&')
|
||||
line.gsub!(/</, '<')
|
||||
line.gsub!(/>/, '>')
|
||||
line.gsub!(/"/, '"')
|
||||
line.gsub!(/'/, ''')
|
||||
stream.puts(line)
|
||||
end
|
||||
stream.puts(' </system-out>')
|
||||
end
|
||||
|
||||
@ -98,6 +108,7 @@ class JunitTestsReport < Plugin
|
||||
end
|
||||
|
||||
def write_test( test, stream )
|
||||
test[:test].gsub!('"', '"')
|
||||
case test[:result]
|
||||
when :success
|
||||
stream.puts(' <testcase name="%<test>s" />' % test)
|
||||
|
@ -39,10 +39,29 @@ class ModuleGenerator < Plugin
|
||||
:update_svn => ((defined? MODULE_GENERATOR_UPDATE_SVN ) ? MODULE_GENERATOR_UPDATE_SVN : false ),
|
||||
}
|
||||
|
||||
# Read Boilerplate template file.
|
||||
if (defined? MODULE_GENERATOR_BOILERPLATE_FILES)
|
||||
|
||||
bf = MODULE_GENERATOR_BOILERPLATE_FILES
|
||||
|
||||
if !bf[:src].nil? && File.exists?(bf[:src])
|
||||
unity_generator_options[:boilerplates][:src] = File.read(bf[:src])
|
||||
end
|
||||
|
||||
if !bf[:inc].nil? && File.exists?(bf[:inc])
|
||||
unity_generator_options[:boilerplates][:inc] = File.read(bf[:inc])
|
||||
end
|
||||
|
||||
if !bf[:tst].nil? && File.exists?(bf[:tst])
|
||||
unity_generator_options[:boilerplates][:tst] = File.read(bf[:tst])
|
||||
end
|
||||
end
|
||||
|
||||
# If using "create[<module_root>:<module_name>]" option from command line.
|
||||
unless optz[:module_root_path].to_s.empty?
|
||||
unity_generator_options[:path_src] = File.join(optz[:module_root_path], unity_generator_options[:path_src])
|
||||
unity_generator_options[:path_inc] = File.join(optz[:module_root_path], unity_generator_options[:path_inc])
|
||||
unity_generator_options[:path_tst] = File.join(optz[:module_root_path], unity_generator_options[:path_tst])
|
||||
unity_generator_options[:path_src] = File.join(optz[:module_root_path], unity_generator_options[:path_src])
|
||||
unity_generator_options[:path_inc] = File.join(optz[:module_root_path], unity_generator_options[:path_inc])
|
||||
unity_generator_options[:path_tst] = File.join(optz[:module_root_path], unity_generator_options[:path_tst])
|
||||
end
|
||||
|
||||
return unity_generator_options
|
||||
|
@ -10,15 +10,20 @@ namespace :module do
|
||||
p = files.delete(pat)
|
||||
optz[:pattern] = p unless p.nil?
|
||||
end
|
||||
files.each {
|
||||
|v|
|
||||
files.each do |v|
|
||||
module_root_path, module_name = v.split(module_root_separator, 2)
|
||||
if module_name
|
||||
optz[:module_root_path] = module_root_path
|
||||
v = module_name
|
||||
end
|
||||
@ceedling[:module_generator].create(v, optz)
|
||||
}
|
||||
if (v =~ /^test_?/i)
|
||||
# If the name of the file starts with test, automatically treat it as one
|
||||
@ceedling[:module_generator].create(v.sub(/^test_?/i,''), optz.merge({:pattern => 'test'}))
|
||||
else
|
||||
# Otherwise, go through the normal procedure
|
||||
@ceedling[:module_generator].create(v, optz)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Destroy module (source, header and test files)"
|
||||
@ -29,15 +34,14 @@ namespace :module do
|
||||
p = files.delete(pat)
|
||||
optz[:pattern] = p unless p.nil?
|
||||
end
|
||||
files.each {
|
||||
|v|
|
||||
files.each do |v|
|
||||
module_root_path, module_name = v.split(module_root_separator, 2)
|
||||
if module_name
|
||||
optz[:module_root_path] = module_root_path
|
||||
v = module_name
|
||||
end
|
||||
@ceedling[:module_generator].create(v, optz)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -19,7 +19,9 @@ class XmlTestsReport < Plugin
|
||||
@results_list.each_key do |context|
|
||||
results = @ceedling[:plugin_reportinator].assemble_test_results(@results_list[context])
|
||||
|
||||
file_path = File.join(PROJECT_BUILD_ARTIFACTS_ROOT, context.to_s, 'report.xml')
|
||||
artifact_filename = @ceedling[:configurator].project_config_hash[:xml_tests_report_artifact_filename] || 'report.xml'
|
||||
artifact_fullpath = @ceedling[:configurator].project_config_hash[:xml_tests_report_path] || File.join(PROJECT_BUILD_ARTIFACTS_ROOT, context.to_s)
|
||||
file_path = File.join(artifact_fullpath, artifact_filename)
|
||||
|
||||
@ceedling[:file_wrapper].open(file_path, 'w') do |f|
|
||||
@test_counter = 1
|
||||
|
@ -9,6 +9,11 @@ extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
#define CEXCEPTION_VERSION_MAJOR 1
|
||||
#define CEXCEPTION_VERSION_MINOR 3
|
||||
#define CEXCEPTION_VERSION_BUILD 2
|
||||
#define CEXCEPTION_VERSION ((CEXCEPTION_VERSION_MAJOR << 16) | (CEXCEPTION_VERSION_MINOR << 8) | CEXCEPTION_VERSION_BUILD)
|
||||
|
||||
//To Use CException, you have a number of options:
|
||||
//1. Just include it and run with the defaults
|
||||
//2. Define any of the following symbols at the command line to override them
|
||||
|
@ -22,6 +22,7 @@ class CMockConfig
|
||||
:fail_on_unexpected_calls => true,
|
||||
:unity_helper_path => false,
|
||||
:treat_as => {},
|
||||
:treat_as_array => {},
|
||||
:treat_as_void => [],
|
||||
:memcmp_if_unknown => true,
|
||||
:when_no_prototypes => :warn, #the options being :ignore, :warn, or :error
|
||||
@ -36,6 +37,8 @@ class CMockConfig
|
||||
:includes_c_pre_header => nil,
|
||||
:includes_c_post_header => nil,
|
||||
:orig_header_include_fmt => "#include \"%s\"",
|
||||
:array_size_type => [],
|
||||
:array_size_name => 'size|len',
|
||||
}
|
||||
|
||||
def initialize(options=nil)
|
||||
@ -61,6 +64,7 @@ class CMockConfig
|
||||
end
|
||||
options[:unity_helper_path] ||= options[:unity_helper]
|
||||
options[:unity_helper_path] = [options[:unity_helper_path]] if options[:unity_helper_path].is_a? String
|
||||
options[:includes_c_post_header] = ((options[:includes_c_post_header] || []) + (options[:unity_helper_path] || [])).uniq
|
||||
options[:plugins].compact!
|
||||
options[:plugins].map! {|p| p.to_sym}
|
||||
@options = options
|
||||
@ -69,7 +73,11 @@ class CMockConfig
|
||||
treat_as_map.merge!(@options[:treat_as])
|
||||
@options[:treat_as] = treat_as_map
|
||||
|
||||
@options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") }
|
||||
@options.each_key do |key|
|
||||
unless methods.include?(key)
|
||||
eval("def #{key.to_s}() return @options[:#{key.to_s}] end")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def load_config_file_from_yaml yaml_filename
|
||||
|
@ -57,9 +57,7 @@ class CMockGenerator
|
||||
private if $ThisIsOnlyATest.nil? ##############################
|
||||
|
||||
def create_mock_subdir()
|
||||
if @subdir
|
||||
@file_writer.create_subdir(@subdir)
|
||||
end
|
||||
@file_writer.create_subdir(@subdir)
|
||||
end
|
||||
|
||||
def create_mock_header_file(parsed_stuff)
|
||||
@ -95,6 +93,7 @@ class CMockGenerator
|
||||
file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
|
||||
file << "#ifndef _#{define_name}_H\n"
|
||||
file << "#define _#{define_name}_H\n\n"
|
||||
file << "#include \"#{@framework}.h\"\n"
|
||||
@includes_h_pre_orig_header.each {|inc| file << "#include #{inc}\n"}
|
||||
file << @config.orig_header_include_fmt.gsub(/%s/, "#{orig_filename}") + "\n"
|
||||
@includes_h_post_orig_header.each {|inc| file << "#include #{inc}\n"}
|
||||
@ -144,7 +143,6 @@ class CMockGenerator
|
||||
file << "#include <string.h>\n"
|
||||
file << "#include <stdlib.h>\n"
|
||||
file << "#include <setjmp.h>\n"
|
||||
file << "#include \"#{@framework}.h\"\n"
|
||||
file << "#include \"cmock.h\"\n"
|
||||
@includes_c_pre_header.each {|inc| file << "#include #{inc}\n"}
|
||||
file << "#include \"#{header_file}\"\n"
|
||||
@ -190,9 +188,15 @@ class CMockGenerator
|
||||
|
||||
def create_mock_verify_function(file, functions)
|
||||
file << "void #{@clean_mock_name}_Verify(void)\n{\n"
|
||||
verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join
|
||||
file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" unless verifications.empty?
|
||||
file << verifications
|
||||
verifications = functions.collect do |function|
|
||||
v = @plugins.run(:mock_verify, function)
|
||||
v.empty? ? v : [" call_instance = Mock.#{function[:name]}_CallInstance;\n", v]
|
||||
end.join
|
||||
unless verifications.empty?
|
||||
file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n"
|
||||
file << " CMOCK_MEM_INDEX_TYPE call_instance;\n"
|
||||
file << verifications
|
||||
end
|
||||
file << "}\n\n"
|
||||
end
|
||||
|
||||
|
@ -16,83 +16,73 @@ class CMockGeneratorPluginCallback
|
||||
@priority = 6
|
||||
|
||||
@include_count = @config.callback_include_count
|
||||
if (@config.callback_after_arg_check)
|
||||
alias :mock_implementation :mock_implementation_for_callbacks_after_arg_check
|
||||
alias :mock_implementation_precheck :nothing
|
||||
else
|
||||
alias :mock_implementation_precheck :mock_implementation_for_callbacks_without_arg_check
|
||||
alias :mock_implementation :nothing
|
||||
end
|
||||
end
|
||||
|
||||
def instance_structure(function)
|
||||
func_name = function[:name]
|
||||
" CMOCK_#{func_name}_CALLBACK #{func_name}_CallbackFunctionPointer;\n" +
|
||||
" int #{func_name}_CallbackBool;\n" \
|
||||
" CMOCK_#{func_name}_CALLBACK #{func_name}_CallbackFunctionPointer;\n" \
|
||||
" int #{func_name}_CallbackCalls;\n"
|
||||
end
|
||||
|
||||
def mock_function_declarations(function)
|
||||
func_name = function[:name]
|
||||
return_type = function[:return][:type]
|
||||
action = @config.callback_after_arg_check ? 'AddCallback' : 'Stub'
|
||||
style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2)
|
||||
styles = [ "void", "int cmock_num_calls", function[:args_string], "#{function[:args_string]}, int cmock_num_calls" ]
|
||||
"typedef #{return_type} (* CMOCK_#{func_name}_CALLBACK)(#{styles[style]});\nvoid #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback);\n"
|
||||
"typedef #{return_type} (* CMOCK_#{func_name}_CALLBACK)(#{styles[style]});\n" \
|
||||
"void #{func_name}_AddCallback(CMOCK_#{func_name}_CALLBACK Callback);\n" \
|
||||
"void #{func_name}_Stub(CMOCK_#{func_name}_CALLBACK Callback);\n" \
|
||||
"#define #{func_name}_StubWithCallback #{func_name}_#{action}\n"
|
||||
end
|
||||
|
||||
def mock_implementation_for_callbacks_after_arg_check(function)
|
||||
func_name = function[:name]
|
||||
style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4)
|
||||
" if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" +
|
||||
case(style)
|
||||
when 0 then " Mock.#{func_name}_CallbackFunctionPointer();\n }\n"
|
||||
when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n"
|
||||
when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n"
|
||||
when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n"
|
||||
when 4 then " cmock_call_instance->ReturnVal = Mock.#{func_name}_CallbackFunctionPointer();\n }\n"
|
||||
when 5 then " cmock_call_instance->ReturnVal = Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n"
|
||||
when 6 then " cmock_call_instance->ReturnVal = Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n"
|
||||
when 7 then " cmock_call_instance->ReturnVal = Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n"
|
||||
end
|
||||
def generate_call(function)
|
||||
args = function[:args].map { |m| m[:name] }
|
||||
args << "Mock.#{function[:name]}_CallbackCalls++" if @include_count
|
||||
"Mock.#{function[:name]}_CallbackFunctionPointer(#{args.join(', ')})"
|
||||
end
|
||||
|
||||
def mock_implementation_for_callbacks_without_arg_check(function)
|
||||
func_name = function[:name]
|
||||
style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4)
|
||||
" if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" +
|
||||
case(style)
|
||||
when 0 then " Mock.#{func_name}_CallbackFunctionPointer();\n return;\n }\n"
|
||||
when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n return;\n }\n"
|
||||
when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n return;\n }\n"
|
||||
when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n return;\n }\n"
|
||||
when 4 then " return Mock.#{func_name}_CallbackFunctionPointer();\n }\n"
|
||||
when 5 then " return Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n"
|
||||
when 6 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n"
|
||||
when 7 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n"
|
||||
end
|
||||
def mock_implementation(function)
|
||||
" if (Mock.#{function[:name]}_CallbackFunctionPointer != NULL)\n {\n" +
|
||||
if function[:return][:void?]
|
||||
" #{generate_call(function)};\n }\n"
|
||||
else
|
||||
" cmock_call_instance->ReturnVal = #{generate_call(function)};\n }\n"
|
||||
end
|
||||
end
|
||||
|
||||
def nothing(function)
|
||||
return ""
|
||||
def mock_implementation_precheck(function)
|
||||
" if (!Mock.#{function[:name]}_CallbackBool &&\n" \
|
||||
" Mock.#{function[:name]}_CallbackFunctionPointer != NULL)\n {\n" +
|
||||
if function[:return][:void?]
|
||||
" #{generate_call(function)};\n" \
|
||||
" UNITY_CLR_DETAILS();\n" \
|
||||
" return;\n }\n"
|
||||
else
|
||||
" #{function[:return][:type]} ret = #{generate_call(function)};\n" \
|
||||
" UNITY_CLR_DETAILS();\n" \
|
||||
" return ret;\n }\n"
|
||||
end
|
||||
end
|
||||
|
||||
def mock_interfaces(function)
|
||||
func_name = function[:name]
|
||||
has_ignore = @config.plugins.include? :ignore
|
||||
lines = ""
|
||||
lines << "void #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback)\n{\n"
|
||||
if @config.plugins.include? :ignore
|
||||
lines << " Mock.#{func_name}_IgnoreBool = (int)0;\n"
|
||||
end
|
||||
lines << "void #{func_name}_AddCallback(CMOCK_#{func_name}_CALLBACK Callback)\n{\n"
|
||||
lines << " Mock.#{func_name}_IgnoreBool = (int)0;\n" if has_ignore
|
||||
lines << " Mock.#{func_name}_CallbackBool = (int)1;\n"
|
||||
lines << " Mock.#{func_name}_CallbackFunctionPointer = Callback;\n}\n\n"
|
||||
lines << "void #{func_name}_Stub(CMOCK_#{func_name}_CALLBACK Callback)\n{\n"
|
||||
lines << " Mock.#{func_name}_IgnoreBool = (int)0;\n" if has_ignore
|
||||
lines << " Mock.#{func_name}_CallbackBool = (int)0;\n"
|
||||
lines << " Mock.#{func_name}_CallbackFunctionPointer = Callback;\n}\n\n"
|
||||
end
|
||||
|
||||
def mock_destroy(function)
|
||||
" Mock.#{function[:name]}_CallbackFunctionPointer = NULL;\n" +
|
||||
" Mock.#{function[:name]}_CallbackCalls = 0;\n"
|
||||
end
|
||||
|
||||
def mock_verify(function)
|
||||
func_name = function[:name]
|
||||
" if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n"
|
||||
" if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n call_instance = CMOCK_GUTS_NONE;\n"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -64,7 +64,7 @@ class CMockGeneratorPluginExpect
|
||||
|
||||
def mock_implementation_might_check_args(function)
|
||||
return "" if (function[:args].empty?)
|
||||
lines = " if (cmock_call_instance->IgnoreMode != CMOCK_ARG_NONE)\n {\n"
|
||||
lines = " if (!cmock_call_instance->ExpectAnyArgsBool)\n {\n"
|
||||
function[:args].each do |arg|
|
||||
lines << @utils.code_verify_an_arg_expectation(function, arg)
|
||||
end
|
||||
@ -91,14 +91,13 @@ class CMockGeneratorPluginExpect
|
||||
lines << @utils.code_add_base_expectation(func_name)
|
||||
lines << @utils.code_call_argument_loader(function)
|
||||
lines << @utils.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]) unless (function[:return][:void?])
|
||||
lines << " UNITY_CLR_DETAILS();\n"
|
||||
lines << "}\n\n"
|
||||
end
|
||||
|
||||
def mock_verify(function)
|
||||
func_name = function[:name]
|
||||
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n" +
|
||||
" UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.#{func_name}_CallInstance, cmock_line, CMockStringCalledLess);\n"
|
||||
" UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == call_instance, cmock_line, CMockStringCalledLess);\n" +
|
||||
" UNITY_CLR_DETAILS();\n"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -15,40 +15,39 @@ class CMockGeneratorPluginExpectAnyArgs
|
||||
@priority = 3
|
||||
end
|
||||
|
||||
def instance_structure(function)
|
||||
if (function[:return][:void?]) || (@config.plugins.include? :ignore)
|
||||
""
|
||||
else
|
||||
" #{function[:return][:type]} #{function[:name]}_FinalReturn;\n"
|
||||
end
|
||||
end
|
||||
|
||||
def instance_typedefs(function)
|
||||
" CMOCK_ARG_MODE IgnoreMode;\n"
|
||||
" int ExpectAnyArgsBool;\n"
|
||||
end
|
||||
|
||||
def mock_function_declarations(function)
|
||||
if (function[:return][:void?])
|
||||
return "#define #{function[:name]}_ExpectAnyArgs() #{function[:name]}_CMockExpectAnyArgs(__LINE__)\n" +
|
||||
"void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line);\n"
|
||||
unless (function[:args].empty?)
|
||||
if (function[:return][:void?])
|
||||
return "#define #{function[:name]}_ExpectAnyArgs() #{function[:name]}_CMockExpectAnyArgs(__LINE__)\n" +
|
||||
"void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line);\n"
|
||||
else
|
||||
return "#define #{function[:name]}_ExpectAnyArgsAndReturn(cmock_retval) #{function[:name]}_CMockExpectAnyArgsAndReturn(__LINE__, cmock_retval)\n" +
|
||||
"void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n"
|
||||
end
|
||||
else
|
||||
return "#define #{function[:name]}_ExpectAnyArgsAndReturn(cmock_retval) #{function[:name]}_CMockExpectAnyArgsAndReturn(__LINE__, cmock_retval)\n" +
|
||||
"void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n"
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def mock_interfaces(function)
|
||||
lines = ""
|
||||
if (function[:return][:void?])
|
||||
lines << "void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)\n{\n"
|
||||
else
|
||||
lines << "void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n"
|
||||
unless (function[:args].empty?)
|
||||
if (function[:return][:void?])
|
||||
lines << "void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)\n{\n"
|
||||
else
|
||||
lines << "void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n"
|
||||
end
|
||||
lines << @utils.code_add_base_expectation(function[:name], true)
|
||||
unless (function[:return][:void?])
|
||||
lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n"
|
||||
end
|
||||
lines << " cmock_call_instance->ExpectAnyArgsBool = (int)1;\n"
|
||||
lines << "}\n\n"
|
||||
end
|
||||
lines << @utils.code_add_base_expectation(function[:name], true)
|
||||
unless (function[:return][:void?])
|
||||
lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n"
|
||||
end
|
||||
lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_NONE;\n"
|
||||
lines << "}\n\n"
|
||||
return lines
|
||||
end
|
||||
end
|
||||
|
@ -70,6 +70,6 @@ class CMockGeneratorPluginIgnore
|
||||
|
||||
def mock_verify(function)
|
||||
func_name = function[:name]
|
||||
" if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n"
|
||||
" if (Mock.#{func_name}_IgnoreBool)\n call_instance = CMOCK_GUTS_NONE;\n"
|
||||
end
|
||||
end
|
||||
|
@ -24,7 +24,13 @@ class CMockGeneratorPluginReturnThruPtr
|
||||
function[:args].each do |arg|
|
||||
if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
|
||||
lines << "#define #{function[:name]}_ReturnThruPtr_#{arg[:name]}(#{arg[:name]})"
|
||||
lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, sizeof(*#{arg[:name]}))\n"
|
||||
# If the pointer type actually contains an asterisk, we can do sizeof the type (super safe), otherwise
|
||||
# we need to do a sizeof the dereferenced pointer (which could be a problem if give the wrong size
|
||||
if (arg[:type][-1] == '*')
|
||||
lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, sizeof(#{arg[:type][0..-2]}))\n"
|
||||
else
|
||||
lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, sizeof(*#{arg[:name]}))\n"
|
||||
end
|
||||
lines << "#define #{function[:name]}_ReturnArrayThruPtr_#{arg[:name]}(#{arg[:name]}, cmock_len)"
|
||||
lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, (int)(cmock_len * (int)sizeof(*#{arg[:name]})))\n"
|
||||
lines << "#define #{function[:name]}_ReturnMemThruPtr_#{arg[:name]}(#{arg[:name]}, cmock_size)"
|
||||
|
@ -19,7 +19,7 @@ class CMockGeneratorUtils
|
||||
@ignore_arg = @config.plugins.include? :ignore_arg
|
||||
@ignore = @config.plugins.include? :ignore
|
||||
@treat_as = @config.treat_as
|
||||
@helpers = helpers
|
||||
@helpers = helpers
|
||||
end
|
||||
|
||||
def self.arg_type_with_const(arg)
|
||||
@ -57,7 +57,7 @@ class CMockGeneratorUtils
|
||||
lines << " cmock_call_instance->LineNumber = cmock_line;\n"
|
||||
lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported)
|
||||
lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception)
|
||||
lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_ALL;\n" if (@expect_any)
|
||||
lines << " cmock_call_instance->ExpectAnyArgsBool = (int)0;\n" if (@expect_any)
|
||||
lines
|
||||
end
|
||||
|
||||
@ -73,7 +73,10 @@ class CMockGeneratorUtils
|
||||
if (arg[:ptr?] or @treat_as.include?(arg[:type]))
|
||||
" #{dest} = #{arg[:name]};\n"
|
||||
else
|
||||
" memcpy(&#{dest}, &#{arg[:name]}, sizeof(#{arg[:type]}));\n"
|
||||
assert_expr = "sizeof(#{arg[:name]}) == sizeof(#{arg[:type]}) ? 1 : -1"
|
||||
comment = "/* add #{arg[:type]} to :treat_as_array if this causes an error */"
|
||||
" memcpy((void*)(&#{dest}), (void*)(&#{arg[:name]}),\n" +
|
||||
" sizeof(#{arg[:type]}[#{assert_expr}])); #{comment}\n"
|
||||
end
|
||||
end
|
||||
|
||||
@ -84,10 +87,12 @@ class CMockGeneratorUtils
|
||||
type = arg_type_with_const(m)
|
||||
m[:ptr?] ? "#{type} #{m[:name]}, int #{m[:name]}_Depth" : "#{type} #{m[:name]}"
|
||||
end.join(', ')
|
||||
"void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string});\n" +
|
||||
"void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" +
|
||||
function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg, (arg[:ptr?] ? "#{arg[:name]}_Depth" : 1) ) } +
|
||||
"}\n\n"
|
||||
else
|
||||
"void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]});\n" +
|
||||
"void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]})\n{\n" +
|
||||
function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg) } +
|
||||
"}\n\n"
|
||||
@ -100,7 +105,13 @@ class CMockGeneratorUtils
|
||||
def code_call_argument_loader(function)
|
||||
if (function[:args_string] != "void")
|
||||
args = function[:args].map do |m|
|
||||
(@arrays and m[:ptr?]) ? "#{m[:name]}, 1" : m[:name]
|
||||
if (@arrays and m[:ptr?] and not m[:array_data?])
|
||||
"#{m[:name]}, 1"
|
||||
elsif (@arrays and m[:array_size?])
|
||||
"#{m[:name]}, #{m[:name]}"
|
||||
else
|
||||
m[:name]
|
||||
end
|
||||
end
|
||||
" CMockExpectParameters_#{function[:name]}(cmock_call_instance, #{args.join(', ')});\n"
|
||||
else
|
||||
@ -170,6 +181,7 @@ class CMockGeneratorUtils
|
||||
lines << " if (!#{ignore})\n" if @ignore_arg
|
||||
lines << " {\n"
|
||||
lines << " UNITY_SET_DETAILS(CMockString_#{function[:name]},CMockString_#{arg_name});\n"
|
||||
lines << " if (#{pre}#{expected} != #{pre}#{arg_name}) {\n"
|
||||
case(unity_func)
|
||||
when "UNITY_TEST_ASSERT_EQUAL_MEMORY"
|
||||
c_type_local = c_type.gsub(/\*$/,'')
|
||||
@ -195,7 +207,7 @@ class CMockGeneratorUtils
|
||||
else
|
||||
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch);\n"
|
||||
end
|
||||
lines << " }\n"
|
||||
lines << " }\n }\n"
|
||||
lines
|
||||
end
|
||||
|
||||
@ -206,6 +218,7 @@ class CMockGeneratorUtils
|
||||
lines << " if (!#{ignore})\n" if @ignore_arg
|
||||
lines << " {\n"
|
||||
lines << " UNITY_SET_DETAILS(CMockString_#{function[:name]},CMockString_#{arg_name});\n"
|
||||
lines << " if (#{pre}#{expected} != #{pre}#{arg_name}) {\n"
|
||||
case(unity_func)
|
||||
when "UNITY_TEST_ASSERT_EQUAL_MEMORY"
|
||||
c_type_local = c_type.gsub(/\*$/,'')
|
||||
@ -233,7 +246,7 @@ class CMockGeneratorUtils
|
||||
else
|
||||
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch);\n"
|
||||
end
|
||||
lines << " }\n"
|
||||
lines << " }\n }\n"
|
||||
lines
|
||||
end
|
||||
|
||||
|
@ -14,9 +14,12 @@ class CMockHeaderParser
|
||||
@c_attr_noconst = cfg.attributes.uniq - ['const']
|
||||
@c_attributes = ['const'] + c_attr_noconst
|
||||
@c_calling_conventions = cfg.c_calling_conventions.uniq
|
||||
@treat_as_array = cfg.treat_as_array
|
||||
@treat_as_void = (['void'] + cfg.treat_as_void).uniq
|
||||
@declaration_parse_matcher = /([\d\w\s\*\(\),\[\]]+??)\(([\d\w\s\*\(\),\.\[\]+-]*)\)$/m
|
||||
@declaration_parse_matcher = /([\w\s\*\(\),\[\]]+??)\(([\w\s\*\(\),\.\[\]+-]*)\)$/m
|
||||
@standards = (['int','short','char','long','unsigned','signed'] + cfg.treat_as.keys).uniq
|
||||
@array_size_name = cfg.array_size_name
|
||||
@array_size_type = (['int', 'size_t'] + cfg.array_size_type).uniq
|
||||
@when_no_prototypes = cfg.when_no_prototypes
|
||||
@local_as_void = @treat_as_void
|
||||
@verbosity = cfg.verbosity
|
||||
@ -54,7 +57,7 @@ class CMockHeaderParser
|
||||
# void must be void for cmock _ExpectAndReturn calls to process properly, not some weird typedef which equates to void
|
||||
# to a certain extent, this action assumes we're chewing on pre-processed header files, otherwise we'll most likely just get stuff from @treat_as_void
|
||||
@local_as_void = @treat_as_void
|
||||
void_types = source.scan(/typedef\s+(?:\(\s*)?void(?:\s*\))?\s+([\w\d]+)\s*;/)
|
||||
void_types = source.scan(/typedef\s+(?:\(\s*)?void(?:\s*\))?\s+([\w]+)\s*;/)
|
||||
if void_types
|
||||
@local_as_void += void_types.flatten.uniq.compact
|
||||
end
|
||||
@ -63,9 +66,9 @@ class CMockHeaderParser
|
||||
source.gsub!(/\s*\\\s*/m, ' ')
|
||||
|
||||
#remove comments (block and line, in three steps to ensure correct precedence)
|
||||
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
||||
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
||||
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
||||
source.gsub!(/(?<!\*)\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
||||
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
||||
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
||||
|
||||
# remove assembler pragma sections
|
||||
source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '')
|
||||
@ -87,6 +90,9 @@ class CMockHeaderParser
|
||||
source.gsub!(/\)(\w)/, ') \1') # add space between parenthese and alphanumeric
|
||||
source.gsub!(/(^|\W+)(?:#{@c_strippables.join('|')})(?=$|\W+)/,'\1') unless @c_strippables.empty? # remove known attributes slated to be stripped
|
||||
|
||||
#scan standalone function pointers and remove them, because they can just be ignored
|
||||
source.gsub!(/\w+\s*\(\s*\*\s*\w+\s*\)\s*\([^)]*\)\s*;/,';')
|
||||
|
||||
#scan for functions which return function pointers, because they are a pain
|
||||
source.gsub!(/([\w\s\*]+)\(*\(\s*\*([\w\s\*]+)\s*\(([\w\s\*,]*)\)\)\s*\(([\w\s\*,]*)\)\)*/) do |m|
|
||||
functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}"
|
||||
@ -184,8 +190,29 @@ class CMockHeaderParser
|
||||
arg_info = parse_type_and_name(arg)
|
||||
arg_info.delete(:modifier) # don't care about this
|
||||
arg_info.delete(:c_calling_convention) # don't care about this
|
||||
|
||||
# in C, array arguments implicitly degrade to pointers
|
||||
# make the translation explicit here to simplify later logic
|
||||
if @treat_as_array[arg_info[:type]] and not arg_info[:ptr?] then
|
||||
arg_info[:type] = "#{@treat_as_array[arg_info[:type]]}*"
|
||||
arg_info[:type] = "const #{arg_info[:type]}" if arg_info[:const?]
|
||||
arg_info[:ptr?] = true
|
||||
end
|
||||
|
||||
args << arg_info
|
||||
end
|
||||
|
||||
# Try to find array pair in parameters following this pattern : <type> * <name>, <@array_size_type> <@array_size_name>
|
||||
args.each_with_index {|val, index|
|
||||
next_index = index + 1
|
||||
if (args.length > next_index)
|
||||
if (val[:ptr?] == true and args[next_index][:name].match(@array_size_name) and @array_size_type.include?(args[next_index][:type]))
|
||||
val[:array_data?] = true
|
||||
args[next_index][:array_size?] = true
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
return args
|
||||
end
|
||||
|
||||
@ -220,7 +247,7 @@ class CMockHeaderParser
|
||||
return 'void'
|
||||
else
|
||||
c=0
|
||||
arg_list.gsub!(/(\w+)(?:\s*\[\s*\(*[\s\d\w+-]*\)*\s*\])+/,'*\1') # magically turn brackets into asterisks, also match for parentheses that come from macros
|
||||
arg_list.gsub!(/(\w+)(?:\s*\[\s*\(*[\s\w+-]*\)*\s*\])+/,'*\1') # magically turn brackets into asterisks, also match for parentheses that come from macros
|
||||
arg_list.gsub!(/\s+\*/,'*') # remove space to place asterisks with type (where they belong)
|
||||
arg_list.gsub!(/\*(\w)/,'* \1') # pull asterisks away from arg to place asterisks with type (where they belong)
|
||||
|
||||
|
18
test/vendor/ceedling/vendor/cmock/src/cmock.c
vendored
18
test/vendor/ceedling/vendor/cmock/src/cmock.c
vendored
@ -4,13 +4,12 @@
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
#include "unity.h"
|
||||
#include "cmock.h"
|
||||
|
||||
//public constants to be used by mocks
|
||||
const char* CMockStringOutOfMemory = "CMock has run out of memory. Please allocate more.";
|
||||
const char* CMockStringCalledMore = "Called more times than expected.";
|
||||
const char* CMockStringCalledLess = "Called less times than expected.";
|
||||
const char* CMockStringCalledLess = "Called fewer times than expected.";
|
||||
const char* CMockStringCalledEarly = "Called earlier than expected.";
|
||||
const char* CMockStringCalledLate = "Called later than expected.";
|
||||
const char* CMockStringCallOrder = "Called out of order.";
|
||||
@ -24,12 +23,11 @@ const char* CMockStringMismatch = "Function called with unexpected argument v
|
||||
#ifdef CMOCK_MEM_DYNAMIC
|
||||
static unsigned char* CMock_Guts_Buffer = NULL;
|
||||
static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_ALIGN_SIZE;
|
||||
static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr;
|
||||
static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr = CMOCK_MEM_ALIGN_SIZE;
|
||||
#else
|
||||
static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferArray[(CMOCK_MEM_SIZE + CMOCK_MEM_INDEX_SIZE - 1) / CMOCK_MEM_INDEX_SIZE];
|
||||
#define CMock_Guts_Buffer ((unsigned char*)CMock_Guts_BufferArray)
|
||||
static unsigned char CMock_Guts_Buffer[CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE];
|
||||
static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE;
|
||||
static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr;
|
||||
static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr = CMOCK_MEM_ALIGN_SIZE;
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------
|
||||
@ -169,6 +167,14 @@ void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index)
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// CMock_Guts_MemBytesCapacity
|
||||
//-------------------------------------------------------
|
||||
CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesCapacity(void)
|
||||
{
|
||||
return (sizeof(CMock_Guts_Buffer) - CMOCK_MEM_ALIGN_SIZE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// CMock_Guts_MemBytesFree
|
||||
//-------------------------------------------------------
|
||||
|
10
test/vendor/ceedling/vendor/cmock/src/cmock.h
vendored
10
test/vendor/ceedling/vendor/cmock/src/cmock.h
vendored
@ -9,6 +9,11 @@
|
||||
|
||||
#include "cmock_internals.h"
|
||||
|
||||
#define CMOCK_VERSION_MAJOR 2
|
||||
#define CMOCK_VERSION_MINOR 5
|
||||
#define CMOCK_VERSION_BUILD 0
|
||||
#define CMOCK_VERSION ((CMOCK_VERSION_MAJOR << 16) | (CMOCK_VERSION_MINOR << 8) | CMOCK_VERSION_BUILD)
|
||||
|
||||
//should be big enough to index full range of CMOCK_MEM_MAX
|
||||
#ifndef CMOCK_MEM_INDEX_TYPE
|
||||
#define CMOCK_MEM_INDEX_TYPE unsigned int
|
||||
@ -16,10 +21,6 @@
|
||||
|
||||
#define CMOCK_GUTS_NONE (0)
|
||||
|
||||
#define CMOCK_ARG_MODE CMOCK_MEM_INDEX_TYPE
|
||||
#define CMOCK_ARG_ALL 0
|
||||
#define CMOCK_ARG_NONE ((CMOCK_MEM_INDEX_TYPE)(~0U))
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Memory API
|
||||
//-------------------------------------------------------
|
||||
@ -30,6 +31,7 @@ CMOCK_MEM_INDEX_TYPE CMock_Guts_MemEndOfChain(CMOCK_MEM_INDEX_TYPE root_index);
|
||||
|
||||
void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index);
|
||||
|
||||
CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesCapacity(void);
|
||||
CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void);
|
||||
CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void);
|
||||
void CMock_Guts_MemFreeAll(void);
|
||||
|
@ -7,6 +7,8 @@
|
||||
#ifndef CMOCK_FRAMEWORK_INTERNALS_H
|
||||
#define CMOCK_FRAMEWORK_INTERNALS_H
|
||||
|
||||
#include "unity.h"
|
||||
|
||||
//These are constants that the generated mocks have access to
|
||||
extern const char* CMockStringOutOfMemory;
|
||||
extern const char* CMockStringCalledMore;
|
||||
|
@ -22,9 +22,10 @@ end
|
||||
class ColourCommandLine
|
||||
def initialize
|
||||
return unless RUBY_PLATFORM =~ /(win|w)32$/
|
||||
|
||||
get_std_handle = Win32API.new('kernel32', 'GetStdHandle', ['L'], 'L')
|
||||
@set_console_txt_attrb =
|
||||
Win32API.new('kernel32', 'SetConsoleTextAttribute', %w(L N), 'I')
|
||||
Win32API.new('kernel32', 'SetConsoleTextAttribute', %w[L N], 'I')
|
||||
@hout = get_std_handle.call(-11)
|
||||
end
|
||||
|
||||
@ -107,7 +108,7 @@ class ColourCommandLine
|
||||
$stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print
|
||||
end
|
||||
end
|
||||
end # ColourCommandLine
|
||||
end
|
||||
|
||||
def colour_puts(role, str)
|
||||
ColourCommandLine.new.out_c(:puts, role, str)
|
||||
|
@ -4,7 +4,7 @@
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt"
|
||||
require_relative 'colour_prompt'
|
||||
|
||||
$colour_output = true
|
||||
|
||||
|
@ -14,6 +14,7 @@ require 'pathname'
|
||||
|
||||
# TEMPLATE_TST
|
||||
TEMPLATE_TST ||= '#include "unity.h"
|
||||
|
||||
%2$s#include "%1$s.h"
|
||||
|
||||
void setUp(void)
|
||||
@ -35,18 +36,16 @@ TEMPLATE_SRC ||= '%2$s#include "%1$s.h"
|
||||
'.freeze
|
||||
|
||||
# TEMPLATE_INC
|
||||
TEMPLATE_INC ||= '#ifndef _%3$s_H
|
||||
#define _%3$s_H
|
||||
TEMPLATE_INC ||= '#ifndef %3$s_H
|
||||
#define %3$s_H
|
||||
%2$s
|
||||
|
||||
#endif // _%3$s_H
|
||||
#endif // %3$s_H
|
||||
'.freeze
|
||||
|
||||
class UnityModuleGenerator
|
||||
############################
|
||||
def initialize(options = nil)
|
||||
here = File.expand_path(File.dirname(__FILE__)) + '/'
|
||||
|
||||
@options = UnityModuleGenerator.default_options
|
||||
case options
|
||||
when NilClass then @options
|
||||
@ -56,9 +55,9 @@ class UnityModuleGenerator
|
||||
end
|
||||
|
||||
# Create default file paths if none were provided
|
||||
@options[:path_src] = here + '../src/' if @options[:path_src].nil?
|
||||
@options[:path_inc] = @options[:path_src] if @options[:path_inc].nil?
|
||||
@options[:path_tst] = here + '../test/' if @options[:path_tst].nil?
|
||||
@options[:path_src] = "#{__dir__}/../src/" if @options[:path_src].nil?
|
||||
@options[:path_inc] = @options[:path_src] if @options[:path_inc].nil?
|
||||
@options[:path_tst] = "#{__dir__}/../test/" if @options[:path_tst].nil?
|
||||
@options[:path_src] += '/' unless @options[:path_src][-1] == 47
|
||||
@options[:path_inc] += '/' unless @options[:path_inc][-1] == 47
|
||||
@options[:path_tst] += '/' unless @options[:path_tst][-1] == 47
|
||||
@ -265,6 +264,7 @@ if $0 == __FILE__
|
||||
when /^-y\"?(.+)\"?/ then options = UnityModuleGenerator.grab_config(Regexp.last_match(1))
|
||||
when /^(\w+)/
|
||||
raise "ERROR: You can't have more than one Module name specified!" unless module_name.nil?
|
||||
|
||||
module_name = arg
|
||||
when /^-(h|-help)/
|
||||
ARGV = [].freeze
|
||||
@ -299,6 +299,7 @@ if $0 == __FILE__
|
||||
end
|
||||
|
||||
raise 'ERROR: You must have a Module name specified! (use option -h for help)' if module_name.nil?
|
||||
|
||||
if destroy
|
||||
UnityModuleGenerator.new(options).destroy(module_name)
|
||||
else
|
||||
|
@ -4,18 +4,25 @@
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
File.expand_path(File.join(File.dirname(__FILE__), 'colour_prompt'))
|
||||
|
||||
class UnityTestRunnerGenerator
|
||||
def initialize(options = nil)
|
||||
@options = UnityTestRunnerGenerator.default_options
|
||||
case options
|
||||
when NilClass then @options
|
||||
when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options))
|
||||
when Hash then @options.merge!(options)
|
||||
else raise 'If you specify arguments, it should be a filename or a hash of options'
|
||||
when NilClass
|
||||
@options
|
||||
when String
|
||||
@options.merge!(UnityTestRunnerGenerator.grab_config(options))
|
||||
when Hash
|
||||
# Check if some of these have been specified
|
||||
@options[:has_setup] = !options[:setup_name].nil?
|
||||
@options[:has_teardown] = !options[:teardown_name].nil?
|
||||
@options[:has_suite_setup] = !options[:suite_setup].nil?
|
||||
@options[:has_suite_teardown] = !options[:suite_teardown].nil?
|
||||
@options.merge!(options)
|
||||
else
|
||||
raise 'If you specify arguments, it should be a filename or a hash of options'
|
||||
end
|
||||
require "#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer"
|
||||
require_relative 'type_sanitizer'
|
||||
end
|
||||
|
||||
def self.default_options
|
||||
@ -29,9 +36,12 @@ class UnityTestRunnerGenerator
|
||||
mock_suffix: '',
|
||||
setup_name: 'setUp',
|
||||
teardown_name: 'tearDown',
|
||||
test_reset_name: 'resetTest',
|
||||
test_verify_name: 'verifyTest',
|
||||
main_name: 'main', # set to :auto to automatically generate each time
|
||||
main_export_decl: '',
|
||||
cmdline_args: false,
|
||||
omit_begin_end: false,
|
||||
use_param_tests: false
|
||||
}
|
||||
end
|
||||
@ -53,12 +63,13 @@ class UnityTestRunnerGenerator
|
||||
# pull required data from source file
|
||||
source = File.read(input_file)
|
||||
source = source.force_encoding('ISO-8859-1').encode('utf-8', replace: nil)
|
||||
tests = find_tests(source)
|
||||
headers = find_includes(source)
|
||||
testfile_includes = (headers[:local] + headers[:system])
|
||||
used_mocks = find_mocks(testfile_includes)
|
||||
testfile_includes = (testfile_includes - used_mocks)
|
||||
tests = find_tests(source)
|
||||
headers = find_includes(source)
|
||||
testfile_includes = (headers[:local] + headers[:system])
|
||||
used_mocks = find_mocks(testfile_includes)
|
||||
testfile_includes = (testfile_includes - used_mocks)
|
||||
testfile_includes.delete_if { |inc| inc =~ /(unity|cmock)/ }
|
||||
find_setup_and_teardown(source)
|
||||
|
||||
# build runner file
|
||||
generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
||||
@ -76,9 +87,13 @@ class UnityTestRunnerGenerator
|
||||
create_header(output, used_mocks, testfile_includes)
|
||||
create_externs(output, tests, used_mocks)
|
||||
create_mock_management(output, used_mocks)
|
||||
create_setup(output)
|
||||
create_teardown(output)
|
||||
create_suite_setup(output)
|
||||
create_suite_teardown(output)
|
||||
create_reset(output, used_mocks)
|
||||
create_reset(output)
|
||||
create_run_test(output)
|
||||
create_args_wrappers(output, tests)
|
||||
create_main(output, input_file, tests, used_mocks)
|
||||
end
|
||||
|
||||
@ -92,27 +107,43 @@ class UnityTestRunnerGenerator
|
||||
def find_tests(source)
|
||||
tests_and_line_numbers = []
|
||||
|
||||
# contains characters which will be substituted from within strings, doing
|
||||
# this prevents these characters from interferring with scrubbers
|
||||
# @ is not a valid C character, so there should be no clashes with files genuinely containing these markers
|
||||
substring_subs = { '{' => '@co@', '}' => '@cc@', ';' => '@ss@', '/' => '@fs@' }
|
||||
substring_re = Regexp.union(substring_subs.keys)
|
||||
substring_unsubs = substring_subs.invert # the inverse map will be used to fix the strings afterwords
|
||||
substring_unsubs['@quote@'] = '\\"'
|
||||
substring_unsubs['@apos@'] = '\\\''
|
||||
substring_unre = Regexp.union(substring_unsubs.keys)
|
||||
source_scrubbed = source.clone
|
||||
source_scrubbed = source_scrubbed.gsub(/"[^"\n]*"/, '') # remove things in strings
|
||||
source_scrubbed = source_scrubbed.gsub(/\/\/.*$/, '') # remove line comments
|
||||
source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
|
||||
lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
|
||||
| (;|\{|\}) /x) # Match ;, {, and } as end of lines
|
||||
source_scrubbed = source_scrubbed.gsub(/\\"/, '@quote@') # hide escaped quotes to allow capture of the full string/char
|
||||
source_scrubbed = source_scrubbed.gsub(/\\'/, '@apos@') # hide escaped apostrophes to allow capture of the full string/char
|
||||
source_scrubbed = source_scrubbed.gsub(/("[^"\n]*")|('[^'\n]*')/) { |s| s.gsub(substring_re, substring_subs) } # temporarily hide problematic characters within strings
|
||||
source_scrubbed = source_scrubbed.gsub(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
||||
source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
|
||||
source_scrubbed = source_scrubbed.gsub(/\/\/.*$/, '') # remove line comments (all that remain)
|
||||
lines = source_scrubbed.split(/(^\s*\#.*$) | (;|\{|\}) /x) # Treat preprocessor directives as a logical line. Match ;, {, and } as end of lines
|
||||
.map { |line| line.gsub(substring_unre, substring_unsubs) } # unhide the problematic characters previously removed
|
||||
|
||||
lines.each_with_index do |line, _index|
|
||||
# find tests
|
||||
next unless line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/
|
||||
next unless line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/m
|
||||
|
||||
arguments = Regexp.last_match(1)
|
||||
name = Regexp.last_match(2)
|
||||
call = Regexp.last_match(3)
|
||||
params = Regexp.last_match(4)
|
||||
args = nil
|
||||
|
||||
if @options[:use_param_tests] && !arguments.empty?
|
||||
args = []
|
||||
arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) { |a| args << a[0] }
|
||||
end
|
||||
|
||||
tests_and_line_numbers << { test: name, args: args, call: call, params: params, line_number: 0 }
|
||||
end
|
||||
|
||||
tests_and_line_numbers.uniq! { |v| v[:test] }
|
||||
|
||||
# determine line numbers and create tests to run
|
||||
@ -121,6 +152,7 @@ class UnityTestRunnerGenerator
|
||||
tests_and_line_numbers.size.times do |i|
|
||||
source_lines[source_index..-1].each_with_index do |line, index|
|
||||
next unless line =~ /\s+#{tests_and_line_numbers[i][:test]}(?:\s|\()/
|
||||
|
||||
source_index += index
|
||||
tests_and_line_numbers[i][:line_number] = source_index + 1
|
||||
break
|
||||
@ -154,21 +186,20 @@ class UnityTestRunnerGenerator
|
||||
mock_headers
|
||||
end
|
||||
|
||||
def find_setup_and_teardown(source)
|
||||
@options[:has_setup] = source =~ /void\s+#{@options[:setup_name]}\s*\(/
|
||||
@options[:has_teardown] = source =~ /void\s+#{@options[:teardown_name]}\s*\(/
|
||||
@options[:has_suite_setup] ||= (source =~ /void\s+suiteSetUp\s*\(/)
|
||||
@options[:has_suite_teardown] ||= (source =~ /void\s+suiteTearDown\s*\(/)
|
||||
end
|
||||
|
||||
def create_header(output, mocks, testfile_includes = [])
|
||||
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
||||
create_runtest(output, mocks)
|
||||
output.puts("\n/*=======Automagically Detected Files To Include=====*/")
|
||||
output.puts('#ifdef __WIN32__')
|
||||
output.puts('#define UNITY_INCLUDE_SETUP_STUBS')
|
||||
output.puts('#endif')
|
||||
output.puts("#include \"#{@options[:framework]}.h\"")
|
||||
output.puts('#include "cmock.h"') unless mocks.empty?
|
||||
output.puts('#ifndef UNITY_EXCLUDE_SETJMP_H')
|
||||
output.puts('#include <setjmp.h>')
|
||||
output.puts("#endif")
|
||||
output.puts('#include <stdio.h>')
|
||||
if @options[:defines] && !@options[:defines].empty?
|
||||
@options[:defines].each { |d| output.puts("#define #{d}") }
|
||||
@options[:defines].each { |d| output.puts("#ifndef #{d}\n#define #{d}\n#endif /* #{d} */") }
|
||||
end
|
||||
if @options[:header_file] && !@options[:header_file].empty?
|
||||
output.puts("#include \"#{File.basename(@options[:header_file])}\"")
|
||||
@ -197,15 +228,15 @@ class UnityTestRunnerGenerator
|
||||
output.puts("\n/*=======External Functions This Runner Calls=====*/")
|
||||
output.puts("extern void #{@options[:setup_name]}(void);")
|
||||
output.puts("extern void #{@options[:teardown_name]}(void);")
|
||||
output.puts("\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif") if @options[:externc]
|
||||
tests.each do |test|
|
||||
output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
|
||||
end
|
||||
output.puts("#ifdef __cplusplus\n}\n#endif") if @options[:externc]
|
||||
output.puts('')
|
||||
end
|
||||
|
||||
def create_mock_management(output, mock_headers)
|
||||
return if mock_headers.empty?
|
||||
|
||||
output.puts("\n/*=======Mock Management=====*/")
|
||||
output.puts('static void CMock_Init(void)')
|
||||
output.puts('{')
|
||||
@ -240,84 +271,78 @@ class UnityTestRunnerGenerator
|
||||
output.puts("}\n")
|
||||
end
|
||||
|
||||
def create_setup(output)
|
||||
return if @options[:has_setup]
|
||||
|
||||
output.puts("\n/*=======Setup (stub)=====*/")
|
||||
output.puts("void #{@options[:setup_name]}(void) {}")
|
||||
end
|
||||
|
||||
def create_teardown(output)
|
||||
return if @options[:has_teardown]
|
||||
|
||||
output.puts("\n/*=======Teardown (stub)=====*/")
|
||||
output.puts("void #{@options[:teardown_name]}(void) {}")
|
||||
end
|
||||
|
||||
def create_suite_setup(output)
|
||||
return if @options[:suite_setup].nil?
|
||||
|
||||
output.puts("\n/*=======Suite Setup=====*/")
|
||||
output.puts('static void suite_setup(void)')
|
||||
output.puts('void suiteSetUp(void)')
|
||||
output.puts('{')
|
||||
if @options[:suite_setup].nil?
|
||||
# New style, call suiteSetUp() if we can use weak symbols
|
||||
output.puts('#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA)')
|
||||
output.puts(' suiteSetUp();')
|
||||
output.puts('#endif')
|
||||
else
|
||||
# Old style, C code embedded in the :suite_setup option
|
||||
output.puts(@options[:suite_setup])
|
||||
end
|
||||
output.puts(@options[:suite_setup])
|
||||
output.puts('}')
|
||||
end
|
||||
|
||||
def create_suite_teardown(output)
|
||||
return if @options[:suite_teardown].nil?
|
||||
|
||||
output.puts("\n/*=======Suite Teardown=====*/")
|
||||
output.puts('static int suite_teardown(int num_failures)')
|
||||
output.puts('int suiteTearDown(int num_failures)')
|
||||
output.puts('{')
|
||||
if @options[:suite_teardown].nil?
|
||||
# New style, call suiteTearDown() if we can use weak symbols
|
||||
output.puts('#if defined(UNITY_WEAK_ATTRIBUTE) || defined(UNITY_WEAK_PRAGMA)')
|
||||
output.puts(' return suiteTearDown(num_failures);')
|
||||
output.puts('#else')
|
||||
output.puts(' return num_failures;')
|
||||
output.puts('#endif')
|
||||
else
|
||||
# Old style, C code embedded in the :suite_teardown option
|
||||
output.puts(@options[:suite_teardown])
|
||||
end
|
||||
output.puts(@options[:suite_teardown])
|
||||
output.puts('}')
|
||||
end
|
||||
|
||||
def create_runtest(output, used_mocks)
|
||||
cexception = @options[:plugins].include? :cexception
|
||||
va_args1 = @options[:use_param_tests] ? ', ...' : ''
|
||||
va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : ''
|
||||
output.puts("\n/*=======Test Runner Used To Run Each Test Below=====*/")
|
||||
output.puts('#define RUN_TEST_NO_ARGS') if @options[:use_param_tests]
|
||||
output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\")
|
||||
output.puts('{ \\')
|
||||
output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
|
||||
output.puts(' Unity.CurrentTestLineNumber = TestLineNum; \\')
|
||||
output.puts(' if (UnityTestMatches()) { \\') if @options[:cmdline_args]
|
||||
output.puts(' Unity.NumberOfTests++; \\')
|
||||
output.puts(' CMock_Init(); \\') unless used_mocks.empty?
|
||||
output.puts(' UNITY_CLR_DETAILS(); \\') unless used_mocks.empty?
|
||||
output.puts(' if (TEST_PROTECT()) \\')
|
||||
output.puts(' { \\')
|
||||
output.puts(' CEXCEPTION_T e; \\') if cexception
|
||||
output.puts(' Try { \\') if cexception
|
||||
output.puts(" #{@options[:setup_name]}(); \\")
|
||||
output.puts(" TestFunc(#{va_args2}); \\")
|
||||
output.puts(' } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \\') if cexception
|
||||
output.puts(' } \\')
|
||||
output.puts(' if (TEST_PROTECT()) \\')
|
||||
output.puts(' { \\')
|
||||
output.puts(" #{@options[:teardown_name]}(); \\")
|
||||
output.puts(' CMock_Verify(); \\') unless used_mocks.empty?
|
||||
output.puts(' } \\')
|
||||
output.puts(' CMock_Destroy(); \\') unless used_mocks.empty?
|
||||
output.puts(' UnityConcludeTest(); \\')
|
||||
output.puts(' } \\') if @options[:cmdline_args]
|
||||
output.puts("}\n")
|
||||
end
|
||||
|
||||
def create_reset(output, used_mocks)
|
||||
output.puts("\n/*=======Test Reset Option=====*/")
|
||||
output.puts('void resetTest(void);')
|
||||
output.puts('void resetTest(void)')
|
||||
def create_reset(output)
|
||||
output.puts("\n/*=======Test Reset Options=====*/")
|
||||
output.puts("void #{@options[:test_reset_name]}(void);")
|
||||
output.puts("void #{@options[:test_reset_name]}(void)")
|
||||
output.puts('{')
|
||||
output.puts(' CMock_Verify();') unless used_mocks.empty?
|
||||
output.puts(' CMock_Destroy();') unless used_mocks.empty?
|
||||
output.puts(" #{@options[:teardown_name]}();")
|
||||
output.puts(' CMock_Init();') unless used_mocks.empty?
|
||||
output.puts(' CMock_Verify();')
|
||||
output.puts(' CMock_Destroy();')
|
||||
output.puts(' CMock_Init();')
|
||||
output.puts(" #{@options[:setup_name]}();")
|
||||
output.puts('}')
|
||||
output.puts("void #{@options[:test_verify_name]}(void);")
|
||||
output.puts("void #{@options[:test_verify_name]}(void)")
|
||||
output.puts('{')
|
||||
output.puts(' CMock_Verify();')
|
||||
output.puts('}')
|
||||
end
|
||||
|
||||
def create_run_test(output)
|
||||
require 'erb'
|
||||
template = ERB.new(File.read(File.join(__dir__, 'run_test.erb')))
|
||||
output.puts(template.result(binding))
|
||||
end
|
||||
|
||||
def create_args_wrappers(output, tests)
|
||||
return unless @options[:use_param_tests]
|
||||
|
||||
output.puts("\n/*=======Parameterized Test Wrappers=====*/")
|
||||
tests.each do |test|
|
||||
next if test[:args].nil? || test[:args].empty?
|
||||
|
||||
test[:args].each.with_index(1) do |args, idx|
|
||||
output.puts("static void runner_args#{idx}_#{test[:test]}(void)")
|
||||
output.puts('{')
|
||||
output.puts(" #{test[:test]}(#{args});")
|
||||
output.puts("}\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create_main(output, filename, tests, used_mocks)
|
||||
@ -336,48 +361,57 @@ class UnityTestRunnerGenerator
|
||||
output.puts(' {')
|
||||
output.puts(" UnityPrint(\"#{filename.gsub('.c', '')}.\");")
|
||||
output.puts(' UNITY_PRINT_EOL();')
|
||||
if @options[:use_param_tests]
|
||||
tests.each do |test|
|
||||
if test[:args].nil? || test[:args].empty?
|
||||
output.puts(" UnityPrint(\" #{test[:test]}(RUN_TEST_NO_ARGS)\");")
|
||||
tests.each do |test|
|
||||
if (!@options[:use_param_tests]) || test[:args].nil? || test[:args].empty?
|
||||
output.puts(" UnityPrint(\" #{test[:test]}\");")
|
||||
output.puts(' UNITY_PRINT_EOL();')
|
||||
else
|
||||
test[:args].each do |args|
|
||||
output.puts(" UnityPrint(\" #{test[:test]}(#{args})\");")
|
||||
output.puts(' UNITY_PRINT_EOL();')
|
||||
else
|
||||
test[:args].each do |args|
|
||||
output.puts(" UnityPrint(\" #{test[:test]}(#{args})\");")
|
||||
output.puts(' UNITY_PRINT_EOL();')
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
tests.each { |test| output.puts(" UnityPrint(\" #{test[:test]}\");\n UNITY_PRINT_EOL();") }
|
||||
end
|
||||
output.puts(' return 0;')
|
||||
output.puts(' return 0;')
|
||||
output.puts(' }')
|
||||
output.puts(' return parse_status;')
|
||||
output.puts(' return parse_status;')
|
||||
output.puts(' }')
|
||||
else
|
||||
main_return = @options[:omit_begin_end] ? 'void' : 'int'
|
||||
if main_name != 'main'
|
||||
output.puts("#{@options[:main_export_decl]} int #{main_name}(void);")
|
||||
output.puts("#{@options[:main_export_decl]} #{main_return} #{main_name}(void);")
|
||||
end
|
||||
output.puts("int #{main_name}(void)")
|
||||
output.puts("#{main_return} #{main_name}(void)")
|
||||
output.puts('{')
|
||||
end
|
||||
output.puts(' suite_setup();')
|
||||
output.puts(" UnityBegin(\"#{filename.gsub(/\\/, '\\\\\\')}\");")
|
||||
if @options[:use_param_tests]
|
||||
tests.each do |test|
|
||||
if test[:args].nil? || test[:args].empty?
|
||||
output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);")
|
||||
else
|
||||
test[:args].each { |args| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});") }
|
||||
output.puts(' suiteSetUp();') if @options[:has_suite_setup]
|
||||
if @options[:omit_begin_end]
|
||||
output.puts(" UnitySetTestFile(\"#{filename.gsub(/\\/, '\\\\\\')}\");")
|
||||
else
|
||||
output.puts(" UnityBegin(\"#{filename.gsub(/\\/, '\\\\\\')}\");")
|
||||
end
|
||||
tests.each do |test|
|
||||
if (!@options[:use_param_tests]) || test[:args].nil? || test[:args].empty?
|
||||
output.puts(" run_test(#{test[:test]}, \"#{test[:test]}\", #{test[:line_number]});")
|
||||
else
|
||||
test[:args].each.with_index(1) do |args, idx|
|
||||
wrapper = "runner_args#{idx}_#{test[:test]}"
|
||||
testname = "#{test[:test]}(#{args})".dump
|
||||
output.puts(" run_test(#{wrapper}, #{testname}, #{test[:line_number]});")
|
||||
end
|
||||
end
|
||||
else
|
||||
tests.each { |test| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]});") }
|
||||
end
|
||||
output.puts
|
||||
output.puts(' CMock_Guts_MemFreeFinal();') unless used_mocks.empty?
|
||||
output.puts(" return suite_teardown(UnityEnd());")
|
||||
if @options[:has_suite_teardown]
|
||||
if @options[:omit_begin_end]
|
||||
output.puts(' (void) suite_teardown(0);')
|
||||
else
|
||||
output.puts(' return suiteTearDown(UnityEnd());')
|
||||
end
|
||||
else
|
||||
output.puts(' return UnityEnd();') if not @options[:omit_begin_end]
|
||||
end
|
||||
output.puts('}')
|
||||
end
|
||||
|
||||
@ -439,13 +473,17 @@ if $0 == __FILE__
|
||||
' *.h - header files are added as #includes in runner',
|
||||
' options:',
|
||||
' -cexception - include cexception support',
|
||||
' -externc - add extern "C" for cpp support',
|
||||
' --setup_name="" - redefine setUp func name to something else',
|
||||
' --teardown_name="" - redefine tearDown func name to something else',
|
||||
' --main_name="" - redefine main func name to something else',
|
||||
' --test_prefix="" - redefine test prefix from default test|spec|should',
|
||||
' --test_reset_name="" - redefine resetTest func name to something else',
|
||||
' --test_verify_name="" - redefine verifyTest func name to something else',
|
||||
' --suite_setup="" - code to execute for setup of entire suite',
|
||||
' --suite_teardown="" - code to execute for teardown of entire suite',
|
||||
' --use_param_tests=1 - enable parameterized tests (disabled by default)',
|
||||
' --omit_begin_end=1 - omit calls to UnityBegin and UnityEnd (disabled by default)',
|
||||
' --header_file="" - path/name of test header file to generate too'].join("\n")
|
||||
exit 1
|
||||
end
|
||||
|
@ -34,9 +34,9 @@ class ParseOutput
|
||||
|
||||
# current suite name and statistics
|
||||
@test_suite = nil
|
||||
@total_tests = 0
|
||||
@test_passed = 0
|
||||
@test_failed = 0
|
||||
@total_tests = 0
|
||||
@test_passed = 0
|
||||
@test_failed = 0
|
||||
@test_ignored = 0
|
||||
end
|
||||
|
||||
@ -210,7 +210,7 @@ class ParseOutput
|
||||
|
||||
# Adjusts the os specific members according to the current path style
|
||||
# (Windows or Unix based)
|
||||
def set_os_specifics(line)
|
||||
def detect_os_specifics(line)
|
||||
if line.include? '\\'
|
||||
# Windows X:\Y\Z
|
||||
@class_name_idx = 1
|
||||
@ -254,43 +254,42 @@ class ParseOutput
|
||||
# TEST(<test_group, <test_file>) PASS
|
||||
#
|
||||
# Note: Where path is different on Unix vs Windows devices (Windows leads with a drive letter)!
|
||||
set_os_specifics(line)
|
||||
detect_os_specifics(line)
|
||||
line_array = line.split(':')
|
||||
|
||||
# If we were able to split the line then we can look to see if any of our target words
|
||||
# were found. Case is important.
|
||||
if (line_array.size >= 4) || (line.start_with? 'TEST(') || (line.start_with? 'IGNORE_TEST(')
|
||||
next unless (line_array.size >= 4) || (line.start_with? 'TEST(') || (line.start_with? 'IGNORE_TEST(')
|
||||
|
||||
# check if the output is fixture output (with verbose flag "-v")
|
||||
if (line.start_with? 'TEST(') || (line.start_with? 'IGNORE_TEST(')
|
||||
line_array = prepare_fixture_line(line)
|
||||
if line.include? ' PASS'
|
||||
test_passed_unity_fixture(line_array)
|
||||
@test_passed += 1
|
||||
elsif line.include? 'FAIL'
|
||||
test_failed_unity_fixture(line_array)
|
||||
@test_failed += 1
|
||||
elsif line.include? 'IGNORE'
|
||||
test_ignored_unity_fixture(line_array)
|
||||
@test_ignored += 1
|
||||
end
|
||||
# normal output / fixture output (without verbose "-v")
|
||||
elsif line.include? ':PASS'
|
||||
test_passed(line_array)
|
||||
# check if the output is fixture output (with verbose flag "-v")
|
||||
if (line.start_with? 'TEST(') || (line.start_with? 'IGNORE_TEST(')
|
||||
line_array = prepare_fixture_line(line)
|
||||
if line.include? ' PASS'
|
||||
test_passed_unity_fixture(line_array)
|
||||
@test_passed += 1
|
||||
elsif line.include? ':FAIL'
|
||||
test_failed(line_array)
|
||||
elsif line.include? 'FAIL'
|
||||
test_failed_unity_fixture(line_array)
|
||||
@test_failed += 1
|
||||
elsif line.include? ':IGNORE:'
|
||||
test_ignored(line_array)
|
||||
@test_ignored += 1
|
||||
elsif line.include? ':IGNORE'
|
||||
line_array.push('No reason given')
|
||||
test_ignored(line_array)
|
||||
elsif line.include? 'IGNORE'
|
||||
test_ignored_unity_fixture(line_array)
|
||||
@test_ignored += 1
|
||||
end
|
||||
@total_tests = @test_passed + @test_failed + @test_ignored
|
||||
# normal output / fixture output (without verbose "-v")
|
||||
elsif line.include? ':PASS'
|
||||
test_passed(line_array)
|
||||
@test_passed += 1
|
||||
elsif line.include? ':FAIL'
|
||||
test_failed(line_array)
|
||||
@test_failed += 1
|
||||
elsif line.include? ':IGNORE:'
|
||||
test_ignored(line_array)
|
||||
@test_ignored += 1
|
||||
elsif line.include? ':IGNORE'
|
||||
line_array.push('No reason given')
|
||||
test_ignored(line_array)
|
||||
@test_ignored += 1
|
||||
end
|
||||
@total_tests = @test_passed + @test_failed + @test_ignored
|
||||
end
|
||||
puts ''
|
||||
puts '=================== SUMMARY ====================='
|
||||
|
@ -61,8 +61,8 @@ class ArgvParser
|
||||
|
||||
opts.parse!(args)
|
||||
options
|
||||
end # parse()
|
||||
end # class OptparseExample
|
||||
end
|
||||
end
|
||||
|
||||
class UnityToJUnit
|
||||
include FileUtils::Verbose
|
||||
@ -152,11 +152,8 @@ class UnityToJUnit
|
||||
|
||||
def parse_test_summary(summary)
|
||||
raise "Couldn't parse test results: #{summary}" unless summary.find { |v| v =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ }
|
||||
[Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, Regexp.last_match(3).to_i]
|
||||
end
|
||||
|
||||
def here
|
||||
File.expand_path(File.dirname(__FILE__))
|
||||
[Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, Regexp.last_match(3).to_i]
|
||||
end
|
||||
|
||||
private
|
||||
@ -221,9 +218,9 @@ class UnityToJUnit
|
||||
def write_suites_footer(stream)
|
||||
stream.puts '</testsuites>'
|
||||
end
|
||||
end # UnityToJUnit
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
if $0 == __FILE__
|
||||
# parse out the command options
|
||||
options = ArgvParser.parse(ARGV)
|
||||
|
||||
@ -234,7 +231,9 @@ if __FILE__ == $0
|
||||
targets = "#{options.results_dir.tr('\\', '/')}**/*.test*"
|
||||
|
||||
results = Dir[targets]
|
||||
|
||||
raise "No *.testpass, *.testfail, or *.testresults files found in '#{targets}'" if results.empty?
|
||||
|
||||
utj.targets = results
|
||||
|
||||
# set the root path
|
||||
|
@ -11,8 +11,8 @@ module RakefileHelpers
|
||||
def initialize(all_files = false)
|
||||
@all_files = all_files
|
||||
|
||||
return false unless @all_files
|
||||
return false unless File.exist?('test_file_filter.yml')
|
||||
return unless @all_files
|
||||
return unless File.exist?('test_file_filter.yml')
|
||||
|
||||
filters = YAML.load_file('test_file_filter.yml')
|
||||
@all_files = filters[:all_files]
|
||||
|
@ -121,7 +121,7 @@ if __name__ == '__main__':
|
||||
targets_dir = sys.argv[1]
|
||||
else:
|
||||
targets_dir = './'
|
||||
targets = list(map(lambda x: x.replace('\\', '/'), glob(targets_dir + '*.test*')))
|
||||
targets = list(map(lambda x: x.replace('\\', '/'), glob(targets_dir + '**/*.test*', recursive=True)))
|
||||
if len(targets) == 0:
|
||||
raise Exception("No *.testpass or *.testfail files found in '%s'" % targets_dir)
|
||||
uts.set_targets(targets)
|
||||
|
@ -99,11 +99,8 @@ class UnityTestSummary
|
||||
|
||||
def parse_test_summary(summary)
|
||||
raise "Couldn't parse test results: #{summary}" unless summary.find { |v| v =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ }
|
||||
[Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, Regexp.last_match(3).to_i]
|
||||
end
|
||||
|
||||
def here
|
||||
File.expand_path(File.dirname(__FILE__))
|
||||
[Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, Regexp.last_match(3).to_i]
|
||||
end
|
||||
end
|
||||
|
||||
@ -121,7 +118,9 @@ if $0 == __FILE__
|
||||
args[0] ||= './'
|
||||
targets = "#{ARGV[0].tr('\\', '/')}**/*.test*"
|
||||
results = Dir[targets]
|
||||
|
||||
raise "No *.testpass, *.testfail, or *.testresults files found in '#{targets}'" if results.empty?
|
||||
|
||||
uts.targets = results
|
||||
|
||||
# set the root path
|
||||
|
791
test/vendor/ceedling/vendor/unity/src/unity.c
vendored
791
test/vendor/ceedling/vendor/unity/src/unity.c
vendored
File diff suppressed because it is too large
Load Diff
172
test/vendor/ceedling/vendor/unity/src/unity.h
vendored
172
test/vendor/ceedling/vendor/unity/src/unity.h
vendored
@ -1,6 +1,6 @@
|
||||
/* ==========================================
|
||||
Unity Project - A Test Framework for C
|
||||
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
Copyright (c) 2007-19 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
@ -8,6 +8,11 @@
|
||||
#define UNITY_FRAMEWORK_H
|
||||
#define UNITY
|
||||
|
||||
#define UNITY_VERSION_MAJOR 2
|
||||
#define UNITY_VERSION_MINOR 5
|
||||
#define UNITY_VERSION_BUILD 0
|
||||
#define UNITY_VERSION ((UNITY_VERSION_MAJOR << 16) | (UNITY_VERSION_MINOR << 8) | UNITY_VERSION_BUILD)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
@ -19,38 +24,33 @@ extern "C"
|
||||
* Test Setup / Teardown
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
/* These functions are intended to be called before and after each test. */
|
||||
/* These functions are intended to be called before and after each test.
|
||||
* If using unity directly, these will need to be provided for each test
|
||||
* executable built. If you are using the test runner generator and/or
|
||||
* Ceedling, these are optional. */
|
||||
void setUp(void);
|
||||
void tearDown(void);
|
||||
|
||||
/* These functions are intended to be called at the beginning and end of an
|
||||
* entire test suite. suiteTearDown() is passed the number of tests that
|
||||
* failed, and its return value becomes the exit code of main(). */
|
||||
* failed, and its return value becomes the exit code of main(). If using
|
||||
* Unity directly, you're in charge of calling these if they are desired.
|
||||
* If using Ceedling or the test runner generator, these will be called
|
||||
* automatically if they exist. */
|
||||
void suiteSetUp(void);
|
||||
int suiteTearDown(int num_failures);
|
||||
|
||||
/* If the compiler supports it, the following block provides stub
|
||||
* implementations of the above functions as weak symbols. Note that on
|
||||
* some platforms (MinGW for example), weak function implementations need
|
||||
* to be in the same translation unit they are called from. This can be
|
||||
* achieved by defining UNITY_INCLUDE_SETUP_STUBS before including unity.h. */
|
||||
#ifdef UNITY_INCLUDE_SETUP_STUBS
|
||||
#ifdef UNITY_WEAK_ATTRIBUTE
|
||||
UNITY_WEAK_ATTRIBUTE void setUp(void) { }
|
||||
UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
|
||||
UNITY_WEAK_ATTRIBUTE void suiteSetUp(void) { }
|
||||
UNITY_WEAK_ATTRIBUTE int suiteTearDown(int num_failures) { return num_failures; }
|
||||
#elif defined(UNITY_WEAK_PRAGMA)
|
||||
#pragma weak setUp
|
||||
void setUp(void) { }
|
||||
#pragma weak tearDown
|
||||
void tearDown(void) { }
|
||||
#pragma weak suiteSetUp
|
||||
void suiteSetUp(void) { }
|
||||
#pragma weak suiteTearDown
|
||||
int suiteTearDown(int num_failures) { return num_failures; }
|
||||
#endif
|
||||
#endif
|
||||
/*-------------------------------------------------------
|
||||
* Test Reset and Verify
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
/* These functions are intended to be called before during tests in order
|
||||
* to support complex test loops, etc. Both are NOT built into Unity. Instead
|
||||
* the test runner generator will create them. resetTest will run teardown and
|
||||
* setup again, verifying any end-of-test needs between. verifyTest will only
|
||||
* run the verification. */
|
||||
void resetTest(void);
|
||||
void verifyTest(void);
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Configuration Options
|
||||
@ -102,11 +102,13 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL)
|
||||
#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, (message))
|
||||
#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL)
|
||||
#define TEST_MESSAGE(message) UnityMessage((message), __LINE__)
|
||||
#define TEST_ONLY()
|
||||
|
||||
/* It is not necessary for you to call PASS. A PASS condition is assumed if nothing fails.
|
||||
* This method allows you to abort a test immediately with a PASS state, ignoring the remainder of the test. */
|
||||
#define TEST_PASS() TEST_ABORT()
|
||||
#define TEST_PASS_MESSAGE(message) do { UnityMessage((message), __LINE__); TEST_ABORT(); } while(0)
|
||||
|
||||
/* This macro does nothing, but it is useful for build tools (like Ceedling) to make use of this to figure out
|
||||
* which files should be linked to in order to perform a test. Use it like TEST_FILE("sandwiches.c") */
|
||||
@ -130,18 +132,18 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
|
||||
#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_size_t(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_CHAR(expected, actual) UNITY_TEST_ASSERT_EQUAL_CHAR((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(-1), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(0), (actual), __LINE__, NULL)
|
||||
@ -160,10 +162,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_GREATER_THAN_UINT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_THAN_UINT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_THAN_UINT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_THAN_size_t(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX8((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_THAN_HEX64(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_HEX64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_THAN_CHAR(threshold, actual) UNITY_TEST_ASSERT_GREATER_THAN_CHAR((threshold), (actual), __LINE__, NULL)
|
||||
|
||||
#define TEST_ASSERT_LESS_THAN(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_INT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, NULL)
|
||||
@ -176,10 +180,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_LESS_THAN_UINT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_UINT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_UINT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_size_t(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_HEX8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX8((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_HEX16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_HEX32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_HEX64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_HEX64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_THAN_CHAR(threshold, actual) UNITY_TEST_ASSERT_SMALLER_THAN_CHAR((threshold), (actual), __LINE__, NULL)
|
||||
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||
@ -192,10 +198,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT16(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT32(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT64(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_size_t(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX8(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX16(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX32(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX64(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_CHAR(threshold, actual) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR((threshold), (actual), __LINE__, NULL)
|
||||
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||
@ -208,10 +216,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_UINT16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_UINT32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_UINT64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_size_t(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX8(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX16(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX32(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_CHAR(threshold, actual) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR((threshold), (actual), __LINE__, NULL)
|
||||
|
||||
/* Integer Ranges (of all sizes) */
|
||||
#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
@ -224,11 +234,33 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_UINT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT16_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT64_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_size_t_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_CHAR_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_CHAR_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
|
||||
/* Integer Array Ranges (of all sizes) */
|
||||
#define TEST_ASSERT_INT_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_INT8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_INT16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_INT32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_INT64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_UINT64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_size_t_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX8_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX16_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX32_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_HEX64_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
#define TEST_ASSERT_CHAR_ARRAY_WITHIN(delta, expected, actual, num_elements) UNITY_TEST_ASSERT_CHAR_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, NULL)
|
||||
|
||||
|
||||
/* Structs and Strings */
|
||||
#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL)
|
||||
@ -247,6 +279,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_size_t_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
@ -255,6 +288,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EQUAL_CHAR_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
|
||||
/* Arrays Compared To Single Value */
|
||||
#define TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_INT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
@ -267,6 +301,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EACH_EQUAL_UINT16(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT16((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_UINT32(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT64((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_size_t(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_HEX(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_HEX8(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX8((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_HEX16(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_HEX16((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
@ -275,6 +310,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EACH_EQUAL_PTR(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_PTR((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_STRING(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_STRING((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_MEMORY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY((expected), (actual), (len), (num_elements), __LINE__, NULL)
|
||||
#define TEST_ASSERT_EACH_EQUAL_CHAR(expected, actual, num_elements) UNITY_TEST_ASSERT_EACH_EQUAL_CHAR((expected), (actual), (num_elements), __LINE__, NULL)
|
||||
|
||||
/* Floating Point (If Enabled) */
|
||||
#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN((delta), (expected), (actual), __LINE__, NULL)
|
||||
@ -304,6 +340,28 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, NULL)
|
||||
|
||||
/* Shorthand */
|
||||
#ifdef UNITY_SHORTHAND_AS_OLD
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_INT
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_MEM
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_MEMORY((&expected), (&actual), sizeof(expected), __LINE__, NULL)
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_RAW
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) == (actual)), __LINE__, " Expected Equal")
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_NONE
|
||||
#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Test Asserts (with additional messages)
|
||||
*-------------------------------------------------------*/
|
||||
@ -322,13 +380,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_size_t_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, (message))
|
||||
@ -339,6 +396,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(0), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_CHAR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_CHAR((expected), (actual), __LINE__, (message))
|
||||
|
||||
/* Integer Greater Than/ Less Than (of all sizes) */
|
||||
#define TEST_ASSERT_GREATER_THAN_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||
@ -352,10 +410,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_GREATER_THAN_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_THAN_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_THAN_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_THAN_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_UINT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_THAN_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX8((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_THAN_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_THAN_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_THAN_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_HEX64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_THAN_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_THAN_CHAR((threshold), (actual), __LINE__, (message))
|
||||
|
||||
#define TEST_ASSERT_LESS_THAN_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_INT((threshold), (actual), __LINE__, (message))
|
||||
@ -368,10 +428,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_LESS_THAN_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_UINT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX8((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_HEX64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_THAN_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_THAN_CHAR((threshold), (actual), __LINE__, (message))
|
||||
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||
@ -384,10 +446,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_GREATER_OR_EQUAL_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR((threshold), (actual), __LINE__, (message))
|
||||
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_INT_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT((threshold), (actual), __LINE__, (message))
|
||||
@ -400,10 +464,12 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_UINT16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_UINT32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_UINT64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_size_t_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX8_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX16_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX32_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_HEX64_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64((threshold), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_LESS_OR_EQUAL_CHAR_MESSAGE(threshold, actual, message) UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR((threshold), (actual), __LINE__, (message))
|
||||
|
||||
/* Integer Ranges (of all sizes) */
|
||||
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
@ -416,11 +482,33 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_UINT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT16_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT64_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_size_t_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_CHAR_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_CHAR_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
|
||||
/* Integer Array Ranges (of all sizes) */
|
||||
#define TEST_ASSERT_INT_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_INT8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_INT16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_INT32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_size_t_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX8_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX8_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX16_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX16_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX32_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
#define TEST_ASSERT_CHAR_ARRAY_WITHIN_MESSAGE(delta, expected, actual, num_elements, message) UNITY_TEST_ASSERT_CHAR_ARRAY_WITHIN((delta), (expected), (actual), num_elements, __LINE__, (message))
|
||||
|
||||
|
||||
/* Structs and Strings */
|
||||
#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, (message))
|
||||
@ -439,6 +527,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_size_t_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
@ -447,6 +536,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EQUAL_PTR_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((expected), (actual), (len), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EQUAL_CHAR_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY((expected), (actual), (num_elements), __LINE__, (message))
|
||||
|
||||
/* Arrays Compared To Single Value*/
|
||||
#define TEST_ASSERT_EACH_EQUAL_INT_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_INT((expected), (actual), (num_elements), __LINE__, (message))
|
||||
@ -459,6 +549,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EACH_EQUAL_UINT16_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT16((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_UINT32_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT32((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_UINT64_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT64((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_size_t_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_UINT((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_HEX_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX32((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_HEX8_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX8((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_HEX16_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_HEX16((expected), (actual), (num_elements), __LINE__, (message))
|
||||
@ -467,6 +558,7 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_EACH_EQUAL_PTR_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_PTR((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_STRING_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_STRING((expected), (actual), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_MEMORY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY((expected), (actual), (len), (num_elements), __LINE__, (message))
|
||||
#define TEST_ASSERT_EACH_EQUAL_CHAR_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EACH_EQUAL_CHAR((expected), (actual), (num_elements), __LINE__, (message))
|
||||
|
||||
/* Floating Point (If Enabled) */
|
||||
#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((delta), (expected), (actual), __LINE__, (message))
|
||||
@ -496,6 +588,28 @@ int suiteTearDown(int num_failures);
|
||||
#define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, (message))
|
||||
|
||||
/* Shorthand */
|
||||
#ifdef UNITY_SHORTHAND_AS_OLD
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, (message))
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, (message))
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_INT
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message)
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_MEM
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_MEMORY((&expected), (&actual), sizeof(expected), __LINE__, message)
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_RAW
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) == (actual)), __LINE__, message)
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message)
|
||||
#endif
|
||||
#ifdef UNITY_SHORTHAND_AS_NONE
|
||||
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_FAIL(__LINE__, UnityStrErrShorthand)
|
||||
#endif
|
||||
|
||||
/* end of UNITY_FRAMEWORK_H */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ==========================================
|
||||
Unity Project - A Test Framework for C
|
||||
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
Copyright (c) 2007-19 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
@ -19,6 +19,14 @@
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXCLUDE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_INCLUDE_PRINT_FORMATTED
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
/* Unity Attempts to Auto-Detect Integer Types
|
||||
* Attempt 1: UINT_MAX, ULONG_MAX in <limits.h>, or default to 32 bits
|
||||
* Attempt 2: UINTPTR_MAX in <stdint.h>, or default to same size as long
|
||||
@ -32,10 +40,6 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXCLUDE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Guess Widths If Not Specified
|
||||
*-------------------------------------------------------*/
|
||||
@ -43,6 +47,8 @@
|
||||
/* Determine the size of an int, if not already specified.
|
||||
* We cannot use sizeof(int), because it is not yet defined
|
||||
* at this stage in the translation of the C program.
|
||||
* Also sizeof(int) does return the size in addressable units on all platforms,
|
||||
* which may not necessarily be the size in bytes.
|
||||
* Therefore, infer it from UINT_MAX if possible. */
|
||||
#ifndef UNITY_INT_WIDTH
|
||||
#ifdef UINT_MAX
|
||||
@ -114,19 +120,21 @@
|
||||
* 64-bit Support
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
/* Auto-detect 64 Bit Support */
|
||||
#ifndef UNITY_SUPPORT_64
|
||||
#if UNITY_LONG_WIDTH == 64 || UNITY_POINTER_WIDTH == 64
|
||||
#define UNITY_SUPPORT_64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* 64-Bit Support Dependent Configuration */
|
||||
#ifndef UNITY_SUPPORT_64
|
||||
/* No 64-bit Support */
|
||||
typedef UNITY_UINT32 UNITY_UINT;
|
||||
typedef UNITY_INT32 UNITY_INT;
|
||||
typedef UNITY_INT32 UNITY_INT;
|
||||
#define UNITY_MAX_NIBBLES (8) /* Maximum number of nibbles in a UNITY_(U)INT */
|
||||
#else
|
||||
|
||||
/* 64-bit Support */
|
||||
/* 64-bit Support */
|
||||
#if (UNITY_LONG_WIDTH == 32)
|
||||
typedef unsigned long long UNITY_UINT64;
|
||||
typedef signed long long UNITY_INT64;
|
||||
@ -137,8 +145,8 @@
|
||||
#error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported)
|
||||
#endif
|
||||
typedef UNITY_UINT64 UNITY_UINT;
|
||||
typedef UNITY_INT64 UNITY_INT;
|
||||
|
||||
typedef UNITY_INT64 UNITY_INT;
|
||||
#define UNITY_MAX_NIBBLES (16) /* Maximum number of nibbles in a UNITY_(U)INT */
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
@ -146,24 +154,24 @@
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
#if (UNITY_POINTER_WIDTH == 32)
|
||||
#define UNITY_PTR_TO_INT UNITY_INT32
|
||||
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32
|
||||
#define UNITY_PTR_TO_INT UNITY_INT32
|
||||
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32
|
||||
#elif (UNITY_POINTER_WIDTH == 64)
|
||||
#define UNITY_PTR_TO_INT UNITY_INT64
|
||||
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64
|
||||
#define UNITY_PTR_TO_INT UNITY_INT64
|
||||
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64
|
||||
#elif (UNITY_POINTER_WIDTH == 16)
|
||||
#define UNITY_PTR_TO_INT UNITY_INT16
|
||||
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16
|
||||
#define UNITY_PTR_TO_INT UNITY_INT16
|
||||
#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16
|
||||
#else
|
||||
#error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported)
|
||||
#error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported)
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_PTR_ATTRIBUTE
|
||||
#define UNITY_PTR_ATTRIBUTE
|
||||
#define UNITY_PTR_ATTRIBUTE
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_INTERNAL_PTR
|
||||
#define UNITY_INTERNAL_PTR UNITY_PTR_ATTRIBUTE const void*
|
||||
#define UNITY_INTERNAL_PTR UNITY_PTR_ATTRIBUTE const void*
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
@ -289,42 +297,67 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
|
||||
#define UNITY_OUTPUT_COMPLETE()
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXEC_TIME_RESET
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
#define UNITY_EXEC_TIME_RESET()\
|
||||
Unity.CurrentTestStartTime = 0;\
|
||||
Unity.CurrentTestStopTime = 0;
|
||||
#else
|
||||
#define UNITY_EXEC_TIME_RESET()
|
||||
#endif
|
||||
#if !defined(UNITY_EXEC_TIME_START) && \
|
||||
!defined(UNITY_EXEC_TIME_STOP) && \
|
||||
!defined(UNITY_PRINT_EXEC_TIME) && \
|
||||
!defined(UNITY_TIME_TYPE)
|
||||
/* If none any of these macros are defined then try to provide a default implementation */
|
||||
|
||||
#if defined(UNITY_CLOCK_MS)
|
||||
/* This is a simple way to get a default implementation on platforms that support getting a millisecond counter */
|
||||
#define UNITY_TIME_TYPE UNITY_UINT
|
||||
#define UNITY_EXEC_TIME_START() Unity.CurrentTestStartTime = UNITY_CLOCK_MS()
|
||||
#define UNITY_EXEC_TIME_STOP() Unity.CurrentTestStopTime = UNITY_CLOCK_MS()
|
||||
#define UNITY_PRINT_EXEC_TIME() { \
|
||||
UNITY_UINT execTimeMs = (Unity.CurrentTestStopTime - Unity.CurrentTestStartTime); \
|
||||
UnityPrint(" ("); \
|
||||
UnityPrintNumberUnsigned(execTimeMs); \
|
||||
UnityPrint(" ms)"); \
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
#include <time.h>
|
||||
#define UNITY_TIME_TYPE clock_t
|
||||
#define UNITY_GET_TIME(t) t = (clock_t)((clock() * 1000) / CLOCKS_PER_SEC)
|
||||
#define UNITY_EXEC_TIME_START() UNITY_GET_TIME(Unity.CurrentTestStartTime)
|
||||
#define UNITY_EXEC_TIME_STOP() UNITY_GET_TIME(Unity.CurrentTestStopTime)
|
||||
#define UNITY_PRINT_EXEC_TIME() { \
|
||||
UNITY_UINT execTimeMs = (Unity.CurrentTestStopTime - Unity.CurrentTestStartTime); \
|
||||
UnityPrint(" ("); \
|
||||
UnityPrintNumberUnsigned(execTimeMs); \
|
||||
UnityPrint(" ms)"); \
|
||||
}
|
||||
#elif defined(__unix__)
|
||||
#include <time.h>
|
||||
#define UNITY_TIME_TYPE struct timespec
|
||||
#define UNITY_GET_TIME(t) clock_gettime(CLOCK_MONOTONIC, &t)
|
||||
#define UNITY_EXEC_TIME_START() UNITY_GET_TIME(Unity.CurrentTestStartTime)
|
||||
#define UNITY_EXEC_TIME_STOP() UNITY_GET_TIME(Unity.CurrentTestStopTime)
|
||||
#define UNITY_PRINT_EXEC_TIME() { \
|
||||
UNITY_UINT execTimeMs = ((Unity.CurrentTestStopTime.tv_sec - Unity.CurrentTestStartTime.tv_sec) * 1000L); \
|
||||
execTimeMs += ((Unity.CurrentTestStopTime.tv_nsec - Unity.CurrentTestStartTime.tv_nsec) / 1000000L); \
|
||||
UnityPrint(" ("); \
|
||||
UnityPrintNumberUnsigned(execTimeMs); \
|
||||
UnityPrint(" ms)"); \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXEC_TIME_START
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
#define UNITY_EXEC_TIME_START() Unity.CurrentTestStartTime = UNITY_CLOCK_MS();
|
||||
#else
|
||||
#define UNITY_EXEC_TIME_START()
|
||||
#endif
|
||||
#define UNITY_EXEC_TIME_START() do{}while(0)
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXEC_TIME_STOP
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
#define UNITY_EXEC_TIME_STOP() Unity.CurrentTestStopTime = UNITY_CLOCK_MS();
|
||||
#else
|
||||
#define UNITY_EXEC_TIME_STOP()
|
||||
#define UNITY_EXEC_TIME_STOP() do{}while(0)
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_TIME_TYPE
|
||||
#define UNITY_TIME_TYPE UNITY_UINT
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_PRINT_EXEC_TIME
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
#define UNITY_PRINT_EXEC_TIME() \
|
||||
UnityPrint(" (");\
|
||||
UNITY_COUNTER_TYPE execTimeMs = (Unity.CurrentTestStopTime - Unity.CurrentTestStartTime);
|
||||
UnityPrintNumberUnsigned(execTimeMs);\
|
||||
UnityPrint(" ms)");
|
||||
#else
|
||||
#define UNITY_PRINT_EXEC_TIME()
|
||||
#endif
|
||||
#define UNITY_PRINT_EXEC_TIME() do{}while(0)
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
@ -339,23 +372,6 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
|
||||
#define UNITY_COUNTER_TYPE UNITY_UINT
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Language Features Available
|
||||
*-------------------------------------------------------*/
|
||||
#if !defined(UNITY_WEAK_ATTRIBUTE) && !defined(UNITY_WEAK_PRAGMA)
|
||||
# if defined(__GNUC__) || defined(__ghs__) /* __GNUC__ includes clang */
|
||||
# if !(defined(__WIN32__) && defined(__clang__)) && !defined(__TMS470__)
|
||||
# define UNITY_WEAK_ATTRIBUTE __attribute__((weak))
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_NO_WEAK
|
||||
# undef UNITY_WEAK_ATTRIBUTE
|
||||
# undef UNITY_WEAK_PRAGMA
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Internal Structs Needed
|
||||
*-------------------------------------------------------*/
|
||||
@ -365,10 +381,11 @@ typedef void (*UnityTestFunction)(void);
|
||||
#define UNITY_DISPLAY_RANGE_INT (0x10)
|
||||
#define UNITY_DISPLAY_RANGE_UINT (0x20)
|
||||
#define UNITY_DISPLAY_RANGE_HEX (0x40)
|
||||
#define UNITY_DISPLAY_RANGE_CHAR (0x80)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UNITY_DISPLAY_STYLE_INT = sizeof(int)+ UNITY_DISPLAY_RANGE_INT,
|
||||
UNITY_DISPLAY_STYLE_INT = (UNITY_INT_WIDTH / 8) + UNITY_DISPLAY_RANGE_INT,
|
||||
UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT,
|
||||
UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT,
|
||||
UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT,
|
||||
@ -376,7 +393,7 @@ UNITY_DISPLAY_STYLE_INT = sizeof(int)+ UNITY_DISPLAY_RANGE_INT,
|
||||
UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT,
|
||||
#endif
|
||||
|
||||
UNITY_DISPLAY_STYLE_UINT = sizeof(unsigned) + UNITY_DISPLAY_RANGE_UINT,
|
||||
UNITY_DISPLAY_STYLE_UINT = (UNITY_INT_WIDTH / 8) + UNITY_DISPLAY_RANGE_UINT,
|
||||
UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT,
|
||||
UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT,
|
||||
UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT,
|
||||
@ -391,16 +408,20 @@ UNITY_DISPLAY_STYLE_UINT = sizeof(unsigned) + UNITY_DISPLAY_RANGE_UINT,
|
||||
UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX,
|
||||
#endif
|
||||
|
||||
UNITY_DISPLAY_STYLE_CHAR = 1 + UNITY_DISPLAY_RANGE_CHAR + UNITY_DISPLAY_RANGE_INT,
|
||||
|
||||
UNITY_DISPLAY_STYLE_UNKNOWN
|
||||
} UNITY_DISPLAY_STYLE_T;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UNITY_EQUAL_TO = 1,
|
||||
UNITY_GREATER_THAN = 2,
|
||||
UNITY_GREATER_OR_EQUAL = 2 + UNITY_EQUAL_TO,
|
||||
UNITY_SMALLER_THAN = 4,
|
||||
UNITY_SMALLER_OR_EQUAL = 4 + UNITY_EQUAL_TO
|
||||
UNITY_WITHIN = 0x0,
|
||||
UNITY_EQUAL_TO = 0x1,
|
||||
UNITY_GREATER_THAN = 0x2,
|
||||
UNITY_GREATER_OR_EQUAL = 0x2 + UNITY_EQUAL_TO,
|
||||
UNITY_SMALLER_THAN = 0x4,
|
||||
UNITY_SMALLER_OR_EQUAL = 0x4 + UNITY_EQUAL_TO,
|
||||
UNITY_UNKNOWN
|
||||
} UNITY_COMPARISON_T;
|
||||
|
||||
#ifndef UNITY_EXCLUDE_FLOAT
|
||||
@ -421,7 +442,8 @@ typedef enum UNITY_FLOAT_TRAIT
|
||||
typedef enum
|
||||
{
|
||||
UNITY_ARRAY_TO_VAL = 0,
|
||||
UNITY_ARRAY_TO_ARRAY
|
||||
UNITY_ARRAY_TO_ARRAY,
|
||||
UNITY_ARRAY_UNKNOWN
|
||||
} UNITY_FLAGS_T;
|
||||
|
||||
struct UNITY_STORAGE_T
|
||||
@ -439,8 +461,8 @@ struct UNITY_STORAGE_T
|
||||
UNITY_COUNTER_TYPE CurrentTestFailed;
|
||||
UNITY_COUNTER_TYPE CurrentTestIgnored;
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
UNITY_COUNTER_TYPE CurrentTestStartTime;
|
||||
UNITY_COUNTER_TYPE CurrentTestStopTime;
|
||||
UNITY_TIME_TYPE CurrentTestStartTime;
|
||||
UNITY_TIME_TYPE CurrentTestStopTime;
|
||||
#endif
|
||||
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||
jmp_buf AbortFrame;
|
||||
@ -455,6 +477,7 @@ extern struct UNITY_STORAGE_T Unity;
|
||||
|
||||
void UnityBegin(const char* filename);
|
||||
int UnityEnd(void);
|
||||
void UnitySetTestFile(const char* filename);
|
||||
void UnityConcludeTest(void);
|
||||
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum);
|
||||
|
||||
@ -485,6 +508,11 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
void UnityPrint(const char* string);
|
||||
|
||||
#ifdef UNITY_INCLUDE_PRINT_FORMATTED
|
||||
void UnityPrintFormatted(const char* format, ...);
|
||||
#endif
|
||||
|
||||
void UnityPrintLen(const char* string, const UNITY_UINT32 length);
|
||||
void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number);
|
||||
void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style);
|
||||
@ -564,9 +592,18 @@ void UnityAssertNumbersWithin(const UNITY_UINT delta,
|
||||
const UNITY_LINE_TYPE lineNumber,
|
||||
const UNITY_DISPLAY_STYLE_T style);
|
||||
|
||||
void UnityFail(const char* msg, const UNITY_LINE_TYPE line);
|
||||
void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
|
||||
UNITY_INTERNAL_PTR expected,
|
||||
UNITY_INTERNAL_PTR actual,
|
||||
const UNITY_UINT32 num_elements,
|
||||
const char* msg,
|
||||
const UNITY_LINE_TYPE lineNumber,
|
||||
const UNITY_DISPLAY_STYLE_T style,
|
||||
const UNITY_FLAGS_T flags);
|
||||
|
||||
void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line);
|
||||
void UnityFail(const char* message, const UNITY_LINE_TYPE line);
|
||||
void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);
|
||||
void UnityMessage(const char* message, const UNITY_LINE_TYPE line);
|
||||
|
||||
#ifndef UNITY_EXCLUDE_FLOAT
|
||||
void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
|
||||
@ -624,9 +661,15 @@ UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num);
|
||||
* Error Strings We Might Need
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
extern const char UnityStrOk[];
|
||||
extern const char UnityStrPass[];
|
||||
extern const char UnityStrFail[];
|
||||
extern const char UnityStrIgnore[];
|
||||
|
||||
extern const char UnityStrErrFloat[];
|
||||
extern const char UnityStrErrDouble[];
|
||||
extern const char UnityStrErr64[];
|
||||
extern const char UnityStrErrShorthand[];
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Test Running Macros
|
||||
@ -640,16 +683,14 @@ extern const char UnityStrErr64[];
|
||||
#define TEST_ABORT() return
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_EXCLUDE_TIME_H
|
||||
#define UNITY_CLOCK_MS() (UNITY_COUNTER_TYPE)((clock() * 1000) / CLOCKS_PER_SEC)
|
||||
#else
|
||||
#define UNITY_CLOCK_MS()
|
||||
#endif
|
||||
|
||||
/* This tricky series of macros gives us an optional line argument to treat it as RUN_TEST(func, num=__LINE__) */
|
||||
#ifndef RUN_TEST
|
||||
#ifdef __STDC_VERSION__
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
#define UNITY_SUPPORT_VARIADIC_MACROS
|
||||
#endif
|
||||
#endif
|
||||
#ifdef UNITY_SUPPORT_VARIADIC_MACROS
|
||||
#define RUN_TEST(...) UnityDefaultTestRun(RUN_TEST_FIRST(__VA_ARGS__), RUN_TEST_SECOND(__VA_ARGS__))
|
||||
#define RUN_TEST_FIRST(...) RUN_TEST_FIRST_HELPER(__VA_ARGS__, throwaway)
|
||||
#define RUN_TEST_FIRST_HELPER(first, ...) (first), #first
|
||||
@ -657,7 +698,6 @@ extern const char UnityStrErr64[];
|
||||
#define RUN_TEST_SECOND_HELPER(first, second, ...) (second)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If we can't do the tricky version, we'll just have to require them to always include the line number */
|
||||
#ifndef RUN_TEST
|
||||
@ -683,6 +723,16 @@ extern const char UnityStrErr64[];
|
||||
#define UNITY_END() UnityEnd()
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_SHORTHAND_AS_INT
|
||||
#ifndef UNITY_SHORTHAND_AS_MEM
|
||||
#ifndef UNITY_SHORTHAND_AS_NONE
|
||||
#ifndef UNITY_SHORTHAND_AS_RAW
|
||||
#define UNITY_SHORTHAND_AS_OLD
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------
|
||||
* Command Line Argument Support
|
||||
*-----------------------------------------------*/
|
||||
@ -718,6 +768,7 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_CHAR(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
|
||||
#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((UNITY_INT)(mask), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||
|
||||
#define UNITY_TEST_ASSERT_GREATER_THAN_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||
@ -731,6 +782,7 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||
#define UNITY_TEST_ASSERT_GREATER_THAN_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
|
||||
|
||||
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||
@ -743,42 +795,60 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_THAN_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
|
||||
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 ) (threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16) (threshold), (UNITY_INT)(UNITY_INT16) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32) (threshold), (UNITY_INT)(UNITY_INT32) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 ) (threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
|
||||
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
|
||||
|
||||
#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||
#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||
#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||
#define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||
#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||
#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin( (delta), (UNITY_INT) (expected), (UNITY_INT) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
|
||||
#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 ) (expected), (UNITY_INT)(UNITY_INT8 ) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
|
||||
#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_INT16) (expected), (UNITY_INT)(UNITY_INT16) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
|
||||
#define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_INT32) (expected), (UNITY_INT)(UNITY_INT32) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
|
||||
#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin( (delta), (UNITY_INT) (expected), (UNITY_INT) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
|
||||
#define UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
|
||||
#define UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
|
||||
#define UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
|
||||
#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
|
||||
#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
|
||||
#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
|
||||
#define UNITY_TEST_ASSERT_CHAR_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 ) (expected), (UNITY_INT)(UNITY_INT8 ) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
|
||||
|
||||
#define UNITY_TEST_ASSERT_INT_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin( (delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_INT8_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT8 )(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_INT16_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT16)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_INT32_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT32)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_UINT_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin( (delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_UINT8_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin( (UNITY_UINT16)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_UINT16_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT16)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_UINT32_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT32)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_HEX8_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT8 )(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_HEX16_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT16)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_HEX32_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT32)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_CHAR_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT8 )(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR, UNITY_ARRAY_TO_ARRAY)
|
||||
|
||||
|
||||
#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((UNITY_PTR_TO_INT)(expected), (UNITY_PTR_TO_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||
@ -799,21 +869,23 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((UNITY_INTERNAL_PTR)(expected), (const char**)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(len), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR, UNITY_ARRAY_TO_ARRAY)
|
||||
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) (expected), sizeof(int)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) (expected), sizeof(unsigned int)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT16)(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT32)(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_PTR(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_PTR_TO_INT) (expected), sizeof(int*)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) (expected), (UNITY_INT_WIDTH / 8)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT) (expected), (UNITY_INT_WIDTH / 8)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT16)(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT32)(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX8(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX16(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT16 )(expected), 2), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX32(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT32 )(expected), 4), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_PTR(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_PTR_TO_INT) (expected), (UNITY_POINTER_WIDTH / 8)), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_STRING(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((UNITY_INTERNAL_PTR)(expected), (const char**)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_MEMORY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(len), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_CHAR(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR, UNITY_ARRAY_TO_VAL)
|
||||
|
||||
#ifdef UNITY_SUPPORT_64
|
||||
#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||
@ -822,9 +894,9 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)expected, 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||
@ -840,6 +912,9 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
|
||||
#define UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT64)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT64)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT64)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
|
||||
#else
|
||||
#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||
@ -862,6 +937,9 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64(threshold, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||
#define UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||
#define UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||
#define UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_EXCLUDE_FLOAT
|
||||
@ -906,10 +984,10 @@ int UnityTestMatches(void);
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
|
||||
#else
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((UNITY_DOUBLE)(delta), (UNITY_DOUBLE)(expected), (UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)line)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((UNITY_DOUBLE)(expected) * (UNITY_DOUBLE)UNITY_DOUBLE_PRECISION, (UNITY_DOUBLE)expected, (UNITY_DOUBLE)actual, (UNITY_LINE_TYPE)(line), message)
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((UNITY_DOUBLE*)(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray(UnityDoubleToPtr(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((UNITY_DOUBLE)(delta), (UNITY_DOUBLE)(expected), (UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line))
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((UNITY_DOUBLE)(expected) * (UNITY_DOUBLE)UNITY_DOUBLE_PRECISION, (UNITY_DOUBLE)(expected), (UNITY_DOUBLE)(actual), (UNITY_LINE_TYPE)(line), (message))
|
||||
#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((UNITY_DOUBLE*)(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
|
||||
#define UNITY_TEST_ASSERT_EACH_EQUAL_DOUBLE(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray(UnityDoubleToPtr(expected), (UNITY_DOUBLE*)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_VAL)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)
|
||||
#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)
|
||||
|
Loading…
x
Reference in New Issue
Block a user