Sha256: a3f580319edaa2a93ce9dd26cd1804e58e1c021edce2e8f609a9004e80111005

Contents?: true

Size: 1.39 KB

Versions: 10

Compression:

Stored size: 1.39 KB

Contents

class CMockGeneratorPluginIgnoreArg
  attr_reader :priority
  attr_accessor :utils

  def initialize(config, utils)
    @utils        = utils
    @priority     = 10
  end

  def instance_typedefs(function)
    lines = ""
    function[:args].each do |arg|
      lines << "  int IgnoreArg_#{arg[:name]};\n"
    end
    lines
  end

  def mock_function_declarations(function)
    lines = ""
    function[:args].each do |arg|
      lines << "#define #{function[:name]}_IgnoreArg_#{arg[:name]}()"
      lines << " #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(__LINE__)\n"
      lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line);\n"
    end
    lines
  end

  def mock_interfaces(function)
    lines = []
    func_name = function[:name]
    function[:args].each do |arg|
      arg_name = arg[:name]
      arg_type = arg[:type]
      lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
      lines << "{\n"
      lines << "  CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " +
        "(CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n"
      lines << "  UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringIgnPreExp);\n"
      lines << "  cmock_call_instance->IgnoreArg_#{arg_name} = 1;\n"
      lines << "}\n\n"
    end
    lines
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ceedling-0.28.2 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.28.1 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.27.0 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.25.0 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.24.0 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.22.0 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.21.0 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.20.3 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.20.2 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb
ceedling-0.19.0 vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb