ceedling 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ceedling.gemspec +1 -1
- data/lib/ceedling/version.rb +2 -2
- data/lib/ceedling/version.rb.erb +1 -2
- data/test_graveyard/unit/busted/generator_test_runner_test.rb +2 -5
- data/vendor/cmock/Gemfile +1 -3
- data/vendor/cmock/Rakefile +10 -17
- data/vendor/cmock/docs/license.txt +18 -30
- data/vendor/cmock/examples/gcc.yml +2 -2
- data/vendor/cmock/examples/iar_v4.yml +3 -3
- data/vendor/cmock/examples/iar_v5.yml +3 -3
- data/vendor/cmock/examples/rakefile_helper.rb +35 -35
- data/vendor/cmock/lib/cmock_generator.rb +17 -5
- data/vendor/cmock/lib/cmock_generator_plugin_array.rb +9 -3
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +1 -1
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +1 -1
- data/vendor/cmock/lib/cmock_header_parser.rb +7 -3
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +1 -2
- data/vendor/cmock/test/c/TestCMockC_Runner.c +1 -1
- data/vendor/cmock/test/system/systest_generator.rb +6 -2
- data/vendor/cmock/test/system/test_compilation/const.h +3 -1
- data/vendor/cmock/test/test_helper.rb +38 -40
- data/vendor/cmock/test/unit/cmock_config_test.rb +26 -29
- data/vendor/cmock/test/unit/cmock_file_writer_test.rb +8 -11
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +82 -80
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +62 -43
- data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +44 -45
- data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +30 -31
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +15 -16
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb +76 -77
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +19 -19
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +17 -18
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +17 -17
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +74 -65
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +103 -76
- data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +46 -36
- data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +85 -85
- data/vendor/unity/auto/generate_test_runner.rb +4 -3
- data/vendor/unity/auto/type_sanitizer.rb +8 -0
- data/vendor/unity/auto/unity_test_summary.py +135 -0
- data/vendor/unity/examples/example_1/makefile +16 -0
- data/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -0
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +0 -13
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +0 -13
- data/vendor/unity/examples/example_2/makefile +20 -1
- data/vendor/unity/examples/example_2/src/ProductionCode2.c +2 -0
- data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +2 -2
- data/vendor/unity/examples/example_3/makefile +16 -0
- data/vendor/unity/examples/example_3/src/ProductionCode2.c +2 -0
- data/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +0 -13
- data/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +0 -13
- data/vendor/unity/extras/fixture/rakefile.rb +14 -3
- data/vendor/unity/extras/fixture/src/unity_fixture.c +21 -11
- data/vendor/unity/extras/fixture/src/unity_fixture.h +8 -4
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +5 -0
- data/vendor/unity/extras/fixture/test/main/AllTests.c +2 -2
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +8 -8
- data/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -2
- data/vendor/unity/extras/fixture/test/unity_output_Spy.h +2 -2
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +26 -19
- data/vendor/unity/src/unity_internals.h +9 -12
- data/vendor/unity/test/targets/gcc_auto_stdint.yml +13 -0
- metadata +4 -5
- data/vendor/cmock/test/spec/cmock_file_writer_spec.rb +0 -45
- data/vendor/cmock/test/spec/cmock_generator_plugin_array_spec.rb +0 -52
- data/vendor/cmock/test/spec/spec_helper.rb +0 -12
| @@ -35,52 +35,46 @@ class MockedPluginHelper | |
| 35 35 | 
             
              end
         | 
| 36 36 | 
             
            end
         | 
| 37 37 |  | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 38 | 
            +
            describe CMockGenerator, "Verify CMockGenerator Module" do
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              before do
         | 
| 40 41 | 
             
                create_mocks :config, :file_writer, :utils, :plugins
         | 
| 41 42 | 
             
                @module_name = "PoutPoutFish"
         | 
| 42 43 |  | 
| 43 44 | 
             
                #no strict handling
         | 
| 44 | 
            -
                @config.expect | 
| 45 | 
            -
                @config.expect | 
| 46 | 
            -
                @config.expect | 
| 47 | 
            -
                @config.expect | 
| 48 | 
            -
                #@config.expect | 
| 49 | 
            -
                @config.expect | 
| 50 | 
            -
                @config.expect | 
| 51 | 
            -
                @config.expect | 
| 45 | 
            +
                @config.expect :mock_prefix, "Mock"
         | 
| 46 | 
            +
                @config.expect :enforce_strict_ordering, nil
         | 
| 47 | 
            +
                @config.expect :framework, :unity
         | 
| 48 | 
            +
                @config.expect :includes, ["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]
         | 
| 49 | 
            +
                #@config.expect :includes_h_pre_orig_header, nil #not called because includes called
         | 
| 50 | 
            +
                @config.expect :includes_h_post_orig_header, nil
         | 
| 51 | 
            +
                @config.expect :includes_c_pre_header, nil
         | 
| 52 | 
            +
                @config.expect :includes_c_post_header, nil
         | 
| 52 53 | 
             
                @cmock_generator = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
         | 
| 53 54 | 
             
                @cmock_generator.module_name = @module_name
         | 
| 54 55 | 
             
                @cmock_generator.mock_name = "Mock#{@module_name}"
         | 
| 55 56 | 
             
                @cmock_generator.clean_mock_name = "Mock#{@module_name}"
         | 
| 56 57 |  | 
| 57 58 | 
             
                #strict handling
         | 
| 58 | 
            -
                @config.expect | 
| 59 | 
            -
                @config.expect | 
| 60 | 
            -
                @config.expect | 
| 61 | 
            -
                @config.expect | 
| 62 | 
            -
                @config.expect | 
| 63 | 
            -
                @config.expect | 
| 64 | 
            -
                @config.expect | 
| 65 | 
            -
                @config.expect | 
| 59 | 
            +
                @config.expect :mock_prefix, "Mock"
         | 
| 60 | 
            +
                @config.expect :enforce_strict_ordering, true
         | 
| 61 | 
            +
                @config.expect :framework, :unity
         | 
| 62 | 
            +
                @config.expect :includes, nil
         | 
| 63 | 
            +
                @config.expect :includes_h_pre_orig_header, nil
         | 
| 64 | 
            +
                @config.expect :includes_h_post_orig_header, nil
         | 
| 65 | 
            +
                @config.expect :includes_c_pre_header, nil
         | 
| 66 | 
            +
                @config.expect :includes_c_post_header, nil
         | 
| 66 67 | 
             
                @cmock_generator_strict = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
         | 
| 67 68 | 
             
                @cmock_generator_strict.module_name = @module_name
         | 
| 68 69 | 
             
                @cmock_generator_strict.mock_name = "Mock#{@module_name}"
         | 
| 69 70 | 
             
                @cmock_generator_strict.clean_mock_name = "Mock#{@module_name}"
         | 
| 70 71 | 
             
              end
         | 
| 71 72 |  | 
| 72 | 
            -
               | 
| 73 | 
            -
              end
         | 
| 74 | 
            -
             | 
| 75 | 
            -
              should "have set up internal accessors correctly on init" do
         | 
| 76 | 
            -
                assert_equal(@config,       @cmock_generator.config)
         | 
| 77 | 
            -
                assert_equal(@file_writer,  @cmock_generator.file_writer)
         | 
| 78 | 
            -
                assert_equal(@utils,        @cmock_generator.utils)
         | 
| 79 | 
            -
                assert_equal(@plugins,      @cmock_generator.plugins)
         | 
| 73 | 
            +
              after do
         | 
| 80 74 | 
             
              end
         | 
| 81 75 |  | 
| 82 | 
            -
               | 
| 83 | 
            -
                @config.expect | 
| 76 | 
            +
              it "create the top of a header file with optional include files from config and include file from plugin" do
         | 
| 77 | 
            +
                @config.expect :mock_prefix, "Mock"
         | 
| 84 78 | 
             
                orig_filename = "PoutPoutFish.h"
         | 
| 85 79 | 
             
                define_name = "MOCKPOUTPOUTFISH_H"
         | 
| 86 80 | 
             
                mock_name = "MockPoutPoutFish"
         | 
| @@ -95,37 +89,39 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 95 89 | 
             
                  "#include \"PluginRequiredHeader.h\"\n",
         | 
| 96 90 | 
             
                  "\n",
         | 
| 97 91 | 
             
                  "/* Ignore the following warnings, since we are copying code */\n",
         | 
| 98 | 
            -
                  "#if  | 
| 92 | 
            +
                  "#if defined(__GNUC__) && !defined(__ICC)\n",
         | 
| 93 | 
            +
                  "#if !defined(__clang__)\n",
         | 
| 99 94 | 
             
                  "#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
         | 
| 100 95 | 
             
                  "#endif\n",
         | 
| 101 96 | 
             
                  "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n",
         | 
| 102 97 | 
             
                  "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n",
         | 
| 98 | 
            +
                  "#endif\n",
         | 
| 103 99 | 
             
                  "\n",
         | 
| 104 100 | 
             
                ]
         | 
| 105 101 |  | 
| 106 | 
            -
                @config.expect | 
| 107 | 
            -
                @plugins.expect | 
| 102 | 
            +
                @config.expect :orig_header_include_fmt, "#include \"%s\""
         | 
| 103 | 
            +
                @plugins.expect :run, "#include \"PluginRequiredHeader.h\"\n", [:include_files]
         | 
| 108 104 |  | 
| 109 105 | 
             
                @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h")
         | 
| 110 106 |  | 
| 111 107 | 
             
                assert_equal(expected, output)
         | 
| 112 108 | 
             
              end
         | 
| 113 109 |  | 
| 114 | 
            -
               | 
| 110 | 
            +
              it "handle dashes and spaces in the module name" do
         | 
| 115 111 | 
             
                #no strict handling
         | 
| 116 | 
            -
                @config.expect | 
| 117 | 
            -
                @config.expect | 
| 118 | 
            -
                @config.expect | 
| 119 | 
            -
                @config.expect | 
| 120 | 
            -
                @config.expect | 
| 121 | 
            -
                @config.expect | 
| 122 | 
            -
                @config.expect | 
| 112 | 
            +
                @config.expect :mock_prefix, "Mock"
         | 
| 113 | 
            +
                @config.expect :enforce_strict_ordering, nil
         | 
| 114 | 
            +
                @config.expect :framework, :unity
         | 
| 115 | 
            +
                @config.expect :includes, ["ConfigRequiredHeader1.h","ConfigRequiredHeader2.h"]
         | 
| 116 | 
            +
                @config.expect :includes_h_post_orig_header, nil
         | 
| 117 | 
            +
                @config.expect :includes_c_pre_header, nil
         | 
| 118 | 
            +
                @config.expect :includes_c_post_header, nil
         | 
| 123 119 | 
             
                @cmock_generator2 = CMockGenerator.new(@config, @file_writer, @utils, @plugins)
         | 
| 124 120 | 
             
                @cmock_generator2.module_name = "Pout-Pout Fish"
         | 
| 125 121 | 
             
                @cmock_generator2.mock_name = "MockPout-Pout Fish"
         | 
| 126 122 | 
             
                @cmock_generator2.clean_mock_name = "MockPout_Pout_Fish"
         | 
| 127 123 |  | 
| 128 | 
            -
                @config.expect | 
| 124 | 
            +
                @config.expect :mock_prefix, "Mock"
         | 
| 129 125 | 
             
                orig_filename = "Pout-Pout Fish.h"
         | 
| 130 126 | 
             
                define_name = "MOCKPOUT_POUT_FISH_H"
         | 
| 131 127 | 
             
                mock_name = "MockPout_Pout_Fish"
         | 
| @@ -140,24 +136,26 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 140 136 | 
             
                  "#include \"PluginRequiredHeader.h\"\n",
         | 
| 141 137 | 
             
                  "\n",
         | 
| 142 138 | 
             
                  "/* Ignore the following warnings, since we are copying code */\n",
         | 
| 143 | 
            -
                  "#if  | 
| 139 | 
            +
                  "#if defined(__GNUC__) && !defined(__ICC)\n",
         | 
| 140 | 
            +
                  "#if !defined(__clang__)\n",
         | 
| 144 141 | 
             
                  "#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
         | 
| 145 142 | 
             
                  "#endif\n",
         | 
| 146 143 | 
             
                  "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n",
         | 
| 147 144 | 
             
                  "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n",
         | 
| 145 | 
            +
                  "#endif\n",
         | 
| 148 146 | 
             
                  "\n",
         | 
| 149 147 | 
             
                ]
         | 
| 150 148 |  | 
| 151 | 
            -
                @config.expect | 
| 152 | 
            -
                @plugins.expect | 
| 149 | 
            +
                @config.expect :orig_header_include_fmt, "#include \"%s\""
         | 
| 150 | 
            +
                @plugins.expect :run, "#include \"PluginRequiredHeader.h\"\n", [:include_files]
         | 
| 153 151 |  | 
| 154 152 | 
             
                @cmock_generator2.create_mock_header_header(output, "MockPout-Pout Fish.h")
         | 
| 155 153 |  | 
| 156 154 | 
             
                assert_equal(expected, output)
         | 
| 157 155 | 
             
              end
         | 
| 158 156 |  | 
| 159 | 
            -
               | 
| 160 | 
            -
                @config.expect | 
| 157 | 
            +
              it "create the top of a header file with optional include files from config" do
         | 
| 158 | 
            +
                @config.expect :mock_prefix, "Mock"
         | 
| 161 159 | 
             
                orig_filename = "PoutPoutFish.h"
         | 
| 162 160 | 
             
                define_name = "MOCKPOUTPOUTFISH_H"
         | 
| 163 161 | 
             
                mock_name = "MockPoutPoutFish"
         | 
| @@ -171,24 +169,26 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 171 169 | 
             
                  "#include \"#{orig_filename}\"\n",
         | 
| 172 170 | 
             
                  "\n",
         | 
| 173 171 | 
             
                  "/* Ignore the following warnings, since we are copying code */\n",
         | 
| 174 | 
            -
                  "#if  | 
| 172 | 
            +
                  "#if defined(__GNUC__) && !defined(__ICC)\n",
         | 
| 173 | 
            +
                  "#if !defined(__clang__)\n",
         | 
| 175 174 | 
             
                  "#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
         | 
| 176 175 | 
             
                  "#endif\n",
         | 
| 177 176 | 
             
                  "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n",
         | 
| 178 177 | 
             
                  "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n",
         | 
| 178 | 
            +
                  "#endif\n",
         | 
| 179 179 | 
             
                  "\n",
         | 
| 180 180 | 
             
                ]
         | 
| 181 181 |  | 
| 182 | 
            -
                @config.expect | 
| 183 | 
            -
                @plugins.expect | 
| 182 | 
            +
                @config.expect :orig_header_include_fmt, "#include \"%s\""
         | 
| 183 | 
            +
                @plugins.expect :run,  '', [:include_files]
         | 
| 184 184 |  | 
| 185 185 | 
             
                @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h")
         | 
| 186 186 |  | 
| 187 187 | 
             
                assert_equal(expected, output)
         | 
| 188 188 | 
             
              end
         | 
| 189 189 |  | 
| 190 | 
            -
               | 
| 191 | 
            -
                @config.expect | 
| 190 | 
            +
              it "create the top of a header file with include file from plugin" do
         | 
| 191 | 
            +
                @config.expect :mock_prefix, "Mock"
         | 
| 192 192 | 
             
                orig_filename = "PoutPoutFish.h"
         | 
| 193 193 | 
             
                define_name = "MOCKPOUTPOUTFISH_H"
         | 
| 194 194 | 
             
                mock_name = "MockPoutPoutFish"
         | 
| @@ -203,23 +203,25 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 203 203 | 
             
                  "#include \"PluginRequiredHeader.h\"\n",
         | 
| 204 204 | 
             
                  "\n",
         | 
| 205 205 | 
             
                  "/* Ignore the following warnings, since we are copying code */\n",
         | 
| 206 | 
            -
                  "#if  | 
| 206 | 
            +
                  "#if defined(__GNUC__) && !defined(__ICC)\n",
         | 
| 207 | 
            +
                  "#if !defined(__clang__)\n",
         | 
| 207 208 | 
             
                  "#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
         | 
| 208 209 | 
             
                  "#endif\n",
         | 
| 209 210 | 
             
                  "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n",
         | 
| 210 211 | 
             
                  "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n",
         | 
| 212 | 
            +
                  "#endif\n",
         | 
| 211 213 | 
             
                  "\n",
         | 
| 212 214 | 
             
                ]
         | 
| 213 215 |  | 
| 214 | 
            -
                @config.expect | 
| 215 | 
            -
                @plugins.expect | 
| 216 | 
            +
                @config.expect :orig_header_include_fmt, "#include \"%s\""
         | 
| 217 | 
            +
                @plugins.expect :run, "#include \"PluginRequiredHeader.h\"\n", [:include_files]
         | 
| 216 218 |  | 
| 217 219 | 
             
                @cmock_generator.create_mock_header_header(output, "MockPoutPoutFish.h")
         | 
| 218 220 |  | 
| 219 221 | 
             
                assert_equal(expected, output)
         | 
| 220 222 | 
             
              end
         | 
| 221 223 |  | 
| 222 | 
            -
               | 
| 224 | 
            +
              it "write typedefs" do
         | 
| 223 225 | 
             
                typedefs = [ 'typedef unsigned char U8;',
         | 
| 224 226 | 
             
                             'typedef char S8;',
         | 
| 225 227 | 
             
                             'typedef unsigned long U32;'
         | 
| @@ -237,7 +239,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 237 239 | 
             
                assert_equal(expected, output.flatten)
         | 
| 238 240 | 
             
              end
         | 
| 239 241 |  | 
| 240 | 
            -
               | 
| 242 | 
            +
              it "create the header file service call declarations" do
         | 
| 241 243 | 
             
                mock_name = "MockPoutPoutFish"
         | 
| 242 244 |  | 
| 243 245 | 
             
                output = []
         | 
| @@ -251,7 +253,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 251 253 | 
             
                assert_equal(expected, output)
         | 
| 252 254 | 
             
              end
         | 
| 253 255 |  | 
| 254 | 
            -
               | 
| 256 | 
            +
              it "append the proper footer to the header file" do
         | 
| 255 257 | 
             
                output = []
         | 
| 256 258 | 
             
                expected = ["\n#endif\n"]
         | 
| 257 259 |  | 
| @@ -260,7 +262,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 260 262 | 
             
                assert_equal(expected, output)
         | 
| 261 263 | 
             
              end
         | 
| 262 264 |  | 
| 263 | 
            -
               | 
| 265 | 
            +
              it "create a proper heading for a source file" do
         | 
| 264 266 | 
             
                output = []
         | 
| 265 267 | 
             
                expected = [ "/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
         | 
| 266 268 | 
             
                             "#include <string.h>\n",
         | 
| @@ -277,7 +279,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 277 279 | 
             
                assert_equal(expected, output)
         | 
| 278 280 | 
             
              end
         | 
| 279 281 |  | 
| 280 | 
            -
               | 
| 282 | 
            +
              it "create the instance structure where it is needed when no functions" do
         | 
| 281 283 | 
             
                output = []
         | 
| 282 284 | 
             
                functions = []
         | 
| 283 285 | 
             
                expected = [ "static struct MockPoutPoutFishInstance\n",
         | 
| @@ -291,7 +293,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 291 293 | 
             
                assert_equal(expected, output.join)
         | 
| 292 294 | 
             
              end
         | 
| 293 295 |  | 
| 294 | 
            -
               | 
| 296 | 
            +
              it "create the instance structure where it is needed when functions required" do
         | 
| 295 297 | 
             
                output = []
         | 
| 296 298 | 
             
                functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] },
         | 
| 297 299 | 
             
                              { :name => "Second", :args => "bool Smarty", :return => test_return[:string] }
         | 
| @@ -310,18 +312,18 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 310 312 | 
             
                             "  CMOCK_MEM_INDEX_TYPE Second_CallInstance;\n",
         | 
| 311 313 | 
             
                             "} Mock;\n\n"
         | 
| 312 314 | 
             
                           ].join
         | 
| 313 | 
            -
                @plugins.expect | 
| 314 | 
            -
                @plugins.expect | 
| 315 | 
            +
                @plugins.expect :run, ["  b1","  b2"],        [:instance_typedefs, functions[0]]
         | 
| 316 | 
            +
                @plugins.expect :run, [],                     [:instance_typedefs, functions[1]]
         | 
| 315 317 |  | 
| 316 | 
            -
                @plugins.expect | 
| 317 | 
            -
                @plugins.expect | 
| 318 | 
            +
                @plugins.expect :run, ["  d1"],               [:instance_structure, functions[0]]
         | 
| 319 | 
            +
                @plugins.expect :run, ["  e1","  e2","  e3"], [:instance_structure, functions[1]]
         | 
| 318 320 |  | 
| 319 321 | 
             
                @cmock_generator.create_instance_structure(output, functions)
         | 
| 320 322 |  | 
| 321 323 | 
             
                assert_equal(expected, output.join)
         | 
| 322 324 | 
             
              end
         | 
| 323 325 |  | 
| 324 | 
            -
               | 
| 326 | 
            +
              it "create extern declarations for source file" do
         | 
| 325 327 | 
             
                output = []
         | 
| 326 328 | 
             
                expected = [ "extern jmp_buf AbortFrame;\n",
         | 
| 327 329 | 
             
                             "\n" ]
         | 
| @@ -331,7 +333,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 331 333 | 
             
                assert_equal(expected, output.flatten)
         | 
| 332 334 | 
             
              end
         | 
| 333 335 |  | 
| 334 | 
            -
               | 
| 336 | 
            +
              it "create extern declarations for source file when using strict ordering" do
         | 
| 335 337 | 
             
                output = []
         | 
| 336 338 | 
             
                expected = [ "extern jmp_buf AbortFrame;\n",
         | 
| 337 339 | 
             
                             "extern int GlobalExpectCount;\n",
         | 
| @@ -343,7 +345,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 343 345 | 
             
                assert_equal(expected, output.flatten)
         | 
| 344 346 | 
             
              end
         | 
| 345 347 |  | 
| 346 | 
            -
               | 
| 348 | 
            +
              it "create mock verify functions in source file when no functions specified" do
         | 
| 347 349 | 
             
                functions = []
         | 
| 348 350 | 
             
                output = []
         | 
| 349 351 | 
             
                expected = "void MockPoutPoutFish_Verify(void)\n{\n}\n\n"
         | 
| @@ -353,7 +355,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 353 355 | 
             
                assert_equal(expected, output.join)
         | 
| 354 356 | 
             
              end
         | 
| 355 357 |  | 
| 356 | 
            -
               | 
| 358 | 
            +
              it "create mock verify functions in source file when extra functions specified" do
         | 
| 357 359 | 
             
                functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] },
         | 
| 358 360 | 
             
                              { :name => "Second", :args => "bool Smarty", :return => test_return[:string] }
         | 
| 359 361 | 
             
                            ]
         | 
| @@ -366,8 +368,8 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 366 368 | 
             
                             "  Dos_Second",
         | 
| 367 369 | 
             
                             "}\n\n"
         | 
| 368 370 | 
             
                           ]
         | 
| 369 | 
            -
                @plugins.expect | 
| 370 | 
            -
                @plugins.expect | 
| 371 | 
            +
                @plugins.expect :run, ["  Uno_First","  Dos_First"],   [:mock_verify, functions[0]]
         | 
| 372 | 
            +
                @plugins.expect :run, ["  Uno_Second","  Dos_Second"], [:mock_verify, functions[1]]
         | 
| 371 373 |  | 
| 372 374 | 
             
                @cmock_generator.ordered = true
         | 
| 373 375 | 
             
                @cmock_generator.create_mock_verify_function(output, functions)
         | 
| @@ -375,7 +377,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 375 377 | 
             
                assert_equal(expected, output.flatten)
         | 
| 376 378 | 
             
              end
         | 
| 377 379 |  | 
| 378 | 
            -
               | 
| 380 | 
            +
              it "create mock init functions in source file" do
         | 
| 379 381 | 
             
                output = []
         | 
| 380 382 | 
             
                expected = [ "void MockPoutPoutFish_Init(void)\n{\n",
         | 
| 381 383 | 
             
                             "  MockPoutPoutFish_Destroy();\n",
         | 
| @@ -387,7 +389,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 387 389 | 
             
                assert_equal(expected.join, output.join)
         | 
| 388 390 | 
             
              end
         | 
| 389 391 |  | 
| 390 | 
            -
               | 
| 392 | 
            +
              it "create mock destroy functions in source file" do
         | 
| 391 393 | 
             
                functions = []
         | 
| 392 394 | 
             
                output = []
         | 
| 393 395 | 
             
                expected = [ "void MockPoutPoutFish_Destroy(void)\n{\n",
         | 
| @@ -401,7 +403,7 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 401 403 | 
             
                assert_equal(expected.join, output.join)
         | 
| 402 404 | 
             
              end
         | 
| 403 405 |  | 
| 404 | 
            -
               | 
| 406 | 
            +
              it "create mock destroy functions in source file when specified with strict ordering" do
         | 
| 405 407 | 
             
                functions = [ { :name => "First", :args => "int Candy", :return => test_return[:int] },
         | 
| 406 408 | 
             
                              { :name => "Second", :args => "bool Smarty", :return => test_return[:string] }
         | 
| 407 409 | 
             
                            ]
         | 
| @@ -414,15 +416,15 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 414 416 | 
             
                             "  GlobalVerifyOrder = 0;\n",
         | 
| 415 417 | 
             
                             "}\n\n"
         | 
| 416 418 | 
             
                           ]
         | 
| 417 | 
            -
                @plugins.expect | 
| 418 | 
            -
                @plugins.expect | 
| 419 | 
            +
                @plugins.expect :run, [],        [:mock_destroy, functions[0]]
         | 
| 420 | 
            +
                @plugins.expect :run, ["  uno"], [:mock_destroy, functions[1]]
         | 
| 419 421 |  | 
| 420 422 | 
             
                @cmock_generator_strict.create_mock_destroy_function(output, functions)
         | 
| 421 423 |  | 
| 422 424 | 
             
                assert_equal(expected.join, output.join)
         | 
| 423 425 | 
             
              end
         | 
| 424 426 |  | 
| 425 | 
            -
               | 
| 427 | 
            +
              it "create mock implementation functions in source file" do
         | 
| 426 428 | 
             
                function = { :modifier => "static",
         | 
| 427 429 | 
             
                             :return => test_return[:int],
         | 
| 428 430 | 
             
                             :args_string => "uint32 sandwiches, const char* named",
         | 
| @@ -445,15 +447,15 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 445 447 | 
             
                             "  return cmock_call_instance->ReturnVal;\n",
         | 
| 446 448 | 
             
                             "}\n\n"
         | 
| 447 449 | 
             
                           ]
         | 
| 448 | 
            -
                @plugins.expect | 
| 449 | 
            -
                @plugins.expect | 
| 450 | 
            +
                @plugins.expect :run, ["  uno"],          [:mock_implementation_precheck, function]
         | 
| 451 | 
            +
                @plugins.expect :run, ["  dos","  tres"], [:mock_implementation, function]
         | 
| 450 452 |  | 
| 451 453 | 
             
                @cmock_generator.create_mock_implementation(output, function)
         | 
| 452 454 |  | 
| 453 455 | 
             
                assert_equal(expected.join, output.join)
         | 
| 454 456 | 
             
              end
         | 
| 455 457 |  | 
| 456 | 
            -
               | 
| 458 | 
            +
              it "create mock implementation functions in source file with different options" do
         | 
| 457 459 | 
             
                function = { :modifier => "",
         | 
| 458 460 | 
             
                             :c_calling_convention => "__stdcall",
         | 
| 459 461 | 
             
                             :return => test_return[:int],
         | 
| @@ -477,8 +479,8 @@ class CMockGeneratorTest < Test::Unit::TestCase | |
| 477 479 | 
             
                             "  return cmock_call_instance->ReturnVal;\n",
         | 
| 478 480 | 
             
                             "}\n\n"
         | 
| 479 481 | 
             
                           ]
         | 
| 480 | 
            -
                @plugins.expect | 
| 481 | 
            -
                @plugins.expect | 
| 482 | 
            +
                @plugins.expect :run, ["  uno"],          [:mock_implementation_precheck, function]
         | 
| 483 | 
            +
                @plugins.expect :run, ["  dos","  tres"], [:mock_implementation, function]
         | 
| 482 484 |  | 
| 483 485 | 
             
                @cmock_generator.create_mock_implementation(output, function)
         | 
| 484 486 |  | 
| @@ -2,104 +2,123 @@ | |
| 2 2 | 
             
            #   CMock Project - Automatic Mock Generation for C
         | 
| 3 3 | 
             
            #   Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
         | 
| 4 4 | 
             
            #   [Released under MIT License. Please refer to license.txt for details]
         | 
| 5 | 
            -
            # ========================================== | 
| 5 | 
            +
            # ==========================================
         | 
| 6 6 |  | 
| 7 7 | 
             
            require File.expand_path(File.dirname(__FILE__)) + "/../test_helper"
         | 
| 8 8 | 
             
            require 'cmock_generator_plugin_array'
         | 
| 9 9 |  | 
| 10 | 
            -
             | 
| 11 | 
            -
               | 
| 12 | 
            -
                create_mocks : | 
| 13 | 
            -
             | 
| 10 | 
            +
            describe CMockGeneratorPluginArray, "Verify CMockPGeneratorluginArray Module" do
         | 
| 11 | 
            +
              before do
         | 
| 12 | 
            +
                create_mocks :utils
         | 
| 13 | 
            +
             | 
| 14 14 | 
             
                #no strict ordering
         | 
| 15 | 
            -
                @config | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 15 | 
            +
                @config = create_stub(
         | 
| 16 | 
            +
                  :when_ptr => :compare_data,
         | 
| 17 | 
            +
                  :enforce_strict_ordering => false,
         | 
| 18 | 
            +
                  :respond_to? => true )
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                @utils = create_stub(
         | 
| 21 | 
            +
                   :helpers => {},
         | 
| 22 | 
            +
                   :code_add_base_expectation => "mock_retval_0"
         | 
| 23 | 
            +
                )
         | 
| 24 | 
            +
             | 
| 19 25 | 
             
                @cmock_generator_plugin_array = CMockGeneratorPluginArray.new(@config, @utils)
         | 
| 20 26 | 
             
              end
         | 
| 21 27 |  | 
| 22 | 
            -
               | 
| 28 | 
            +
              after do
         | 
| 23 29 | 
             
              end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
               | 
| 26 | 
            -
                assert_equal(@config, @cmock_generator_plugin_array.config)
         | 
| 27 | 
            -
                assert_equal(@utils,  @cmock_generator_plugin_array.utils)
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              it "have set up internal priority" do
         | 
| 28 32 | 
             
                assert_equal(nil,     @cmock_generator_plugin_array.unity_helper)
         | 
| 29 33 | 
             
                assert_equal(8,       @cmock_generator_plugin_array.priority)
         | 
| 30 34 | 
             
              end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
               | 
| 35 | 
            +
             | 
| 36 | 
            +
              it "not include any additional include files" do
         | 
| 33 37 | 
             
                assert(!@cmock_generator_plugin_array.respond_to?(:include_files))
         | 
| 34 38 | 
             
              end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
               | 
| 39 | 
            +
             | 
| 40 | 
            +
              it "not add to typedef structure for functions of style 'int* func(void)'" do
         | 
| 37 41 | 
             
                function = {:name => "Oak", :args => [], :return => test_return[:int_ptr]}
         | 
| 38 42 | 
             
                returned = @cmock_generator_plugin_array.instance_typedefs(function)
         | 
| 39 43 | 
             
                assert_equal("", returned)
         | 
| 40 44 | 
             
              end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
               | 
| 45 | 
            +
             | 
| 46 | 
            +
              it "add to tyepdef structure mock needs of functions of style 'void func(int chicken, int* pork)'" do
         | 
| 43 47 | 
             
                function = {:name => "Cedar", :args => [{ :name => "chicken", :type => "int", :ptr? => false}, { :name => "pork", :type => "int*", :ptr? => true}], :return => test_return[:void]}
         | 
| 44 48 | 
             
                expected = "  int Expected_pork_Depth;\n"
         | 
| 45 49 | 
             
                returned = @cmock_generator_plugin_array.instance_typedefs(function)
         | 
| 46 50 | 
             
                assert_equal(expected, returned)
         | 
| 47 51 | 
             
              end
         | 
| 48 | 
            -
             | 
| 49 | 
            -
               | 
| 52 | 
            +
             | 
| 53 | 
            +
              it "not add an additional mock interface for functions not containing pointers" do
         | 
| 50 54 | 
             
                function = {:name => "Maple", :args_string => "int blah", :return  => test_return[:string], :contains_ptr? => false}
         | 
| 51 55 | 
             
                returned = @cmock_generator_plugin_array.mock_function_declarations(function)
         | 
| 52 56 | 
             
                assert_nil(returned)
         | 
| 53 57 | 
             
              end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
               | 
| 56 | 
            -
                function = {:name => "Pine", | 
| 58 | 
            +
             | 
| 59 | 
            +
              it "add another mock function declaration for functions of style 'void func(int* tofu)'" do
         | 
| 60 | 
            +
                function = {:name => "Pine",
         | 
| 57 61 | 
             
                            :args => [{ :type => "int*",
         | 
| 58 62 | 
             
                                       :name => "tofu",
         | 
| 59 63 | 
             
                                       :ptr? => true,
         | 
| 60 64 | 
             
                                     }],
         | 
| 61 | 
            -
                            :return => test_return[:void], | 
| 65 | 
            +
                            :return => test_return[:void],
         | 
| 62 66 | 
             
                            :contains_ptr? => true }
         | 
| 63 | 
            -
             | 
| 67 | 
            +
             | 
| 64 68 | 
             
                expected = "#define #{function[:name]}_ExpectWithArray(tofu, tofu_Depth) #{function[:name]}_CMockExpectWithArray(__LINE__, tofu, tofu_Depth)\n" +
         | 
| 65 69 | 
             
                           "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth);\n"
         | 
| 66 70 | 
             
                returned = @cmock_generator_plugin_array.mock_function_declarations(function)
         | 
| 67 71 | 
             
                assert_equal(expected, returned)
         | 
| 68 72 | 
             
              end
         | 
| 69 | 
            -
             | 
| 70 | 
            -
               | 
| 71 | 
            -
                function = {:name => "Pine", | 
| 73 | 
            +
             | 
| 74 | 
            +
              it "add another mock function declaration for functions of style 'const char* func(int* tofu)'" do
         | 
| 75 | 
            +
                function = {:name => "Pine",
         | 
| 72 76 | 
             
                            :args => [{ :type => "int*",
         | 
| 73 77 | 
             
                                       :name => "tofu",
         | 
| 74 78 | 
             
                                       :ptr? => true,
         | 
| 75 79 | 
             
                                     }],
         | 
| 76 80 | 
             
                            :return => test_return[:string],
         | 
| 77 81 | 
             
                            :contains_ptr? => true }
         | 
| 78 | 
            -
             | 
| 82 | 
            +
             | 
| 79 83 | 
             
                expected = "#define #{function[:name]}_ExpectWithArrayAndReturn(tofu, tofu_Depth, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, tofu, tofu_Depth, cmock_retval)\n" +
         | 
| 80 84 | 
             
                           "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* tofu, int tofu_Depth, const char* cmock_to_return);\n"
         | 
| 81 85 | 
             
                returned = @cmock_generator_plugin_array.mock_function_declarations(function)
         | 
| 82 86 | 
             
                assert_equal(expected, returned)
         | 
| 83 87 | 
             
              end
         | 
| 84 | 
            -
             | 
| 85 | 
            -
               | 
| 88 | 
            +
             | 
| 89 | 
            +
              it "add another mock function declaration for functions of style 'const char* func(const int* tofu)'" do
         | 
| 90 | 
            +
                function = {:name => "Pine",
         | 
| 91 | 
            +
                            :args => [{ :type => "int*",
         | 
| 92 | 
            +
                                       :name => "tofu",
         | 
| 93 | 
            +
                                       :ptr? => true,
         | 
| 94 | 
            +
                                       :const? => true,
         | 
| 95 | 
            +
                                     }],
         | 
| 96 | 
            +
                            :return => test_return[:string],
         | 
| 97 | 
            +
                            :contains_ptr? => true }
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                expected = "#define #{function[:name]}_ExpectWithArrayAndReturn(tofu, tofu_Depth, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, tofu, tofu_Depth, cmock_retval)\n" +
         | 
| 100 | 
            +
                           "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, const int* tofu, int tofu_Depth, const char* cmock_to_return);\n"
         | 
| 101 | 
            +
                returned = @cmock_generator_plugin_array.mock_function_declarations(function)
         | 
| 102 | 
            +
                assert_equal(expected, returned)
         | 
| 103 | 
            +
              end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
              it "not have a mock function implementation" do
         | 
| 86 106 | 
             
                assert(!@cmock_generator_plugin_array.respond_to?(:mock_implementation))
         | 
| 87 107 | 
             
              end
         | 
| 88 108 |  | 
| 89 | 
            -
               | 
| 109 | 
            +
              it "not have a mock interfaces for functions of style 'int* func(void)'" do
         | 
| 90 110 | 
             
                function = {:name => "Pear", :args => [], :args_string => "void", :return => test_return[:int_ptr]}
         | 
| 91 111 | 
             
                returned = @cmock_generator_plugin_array.mock_interfaces(function)
         | 
| 92 112 | 
             
                assert_nil(returned)
         | 
| 93 113 | 
             
              end
         | 
| 94 | 
            -
             | 
| 95 | 
            -
               | 
| 96 | 
            -
                function = {:name => "Lemon", | 
| 97 | 
            -
                            :args => [{ :type => "int*", :name => "pescado", :ptr? => true}, { :type => "int", :name => "pes", :ptr? => false}], | 
| 98 | 
            -
                            :args_string => "int* pescado, int pes", | 
| 99 | 
            -
                            :return  => test_return[:int_ptr], | 
| 114 | 
            +
             | 
| 115 | 
            +
              it "add mock interfaces for functions of style 'int* func(int* pescado, int pes)'" do
         | 
| 116 | 
            +
                function = {:name => "Lemon",
         | 
| 117 | 
            +
                            :args => [{ :type => "int*", :name => "pescado", :ptr? => true}, { :type => "int", :name => "pes", :ptr? => false}],
         | 
| 118 | 
            +
                            :args_string => "int* pescado, int pes",
         | 
| 119 | 
            +
                            :return  => test_return[:int_ptr],
         | 
| 100 120 | 
             
                            :contains_ptr? => true }
         | 
| 101 | 
            -
             | 
| 102 | 
            -
                
         | 
| 121 | 
            +
             | 
| 103 122 | 
             
                expected = ["void Lemon_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, int* pescado, int pescado_Depth, int pes, int* cmock_to_return)\n",
         | 
| 104 123 | 
             
                            "{\n",
         | 
| 105 124 | 
             
                            "mock_retval_0",
         | 
| @@ -110,5 +129,5 @@ class CMockGeneratorPluginArrayTest < Test::Unit::TestCase | |
| 110 129 | 
             
                returned = @cmock_generator_plugin_array.mock_interfaces(function).join
         | 
| 111 130 | 
             
                assert_equal(expected, returned)
         | 
| 112 131 | 
             
              end
         | 
| 113 | 
            -
             | 
| 132 | 
            +
             | 
| 114 133 | 
             
            end
         |