ceedling 0.28.2 → 0.28.3
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/assets/ceedling +3 -0
- data/assets/ceedling.cmd +1 -0
- data/assets/default_gitignore +5 -0
- data/assets/project_with_guts.yml +1 -0
- data/assets/project_with_guts_gcov.yml +3 -0
- data/assets/test_example_file_verbose.c +12 -0
- data/bin/ceedling +30 -6
- data/docs/CeedlingPacket.md +135 -23
- data/docs/CeedlingPacket.odt +0 -0
- data/examples/blinky/rakefile.rb +2 -1
- data/lib/ceedling/configurator.rb +7 -5
- data/lib/ceedling/configurator_builder.rb +10 -7
- data/lib/ceedling/configurator_plugins.rb +29 -24
- data/lib/ceedling/configurator_setup.rb +0 -1
- data/lib/ceedling/defaults.rb +7 -2
- data/lib/ceedling/dependinator.rb +10 -2
- data/lib/ceedling/file_finder.rb +57 -49
- data/lib/ceedling/file_path_utils.rb +12 -4
- data/lib/ceedling/file_wrapper.rb +4 -0
- data/lib/ceedling/generator.rb +4 -3
- data/lib/ceedling/generator_test_results.rb +15 -13
- data/lib/ceedling/plugin_manager.rb +18 -18
- data/lib/ceedling/plugin_reportinator.rb +3 -2
- data/lib/ceedling/plugin_reportinator_helper.rb +2 -3
- data/lib/ceedling/preprocessinator_extractor.rb +2 -2
- data/lib/ceedling/preprocessinator_includes_handler.rb +5 -0
- data/lib/ceedling/rakefile.rb +1 -0
- data/lib/ceedling/release_invoker_helper.rb +5 -2
- data/lib/ceedling/rules_release.rake +2 -1
- data/lib/ceedling/rules_tests.rake +18 -9
- data/lib/ceedling/rules_tests_deep_dependencies.rake +2 -2
- data/lib/ceedling/task_invoker.rb +15 -3
- data/lib/ceedling/tasks_vendor.rake +3 -3
- data/lib/ceedling/test_invoker.rb +39 -12
- data/lib/ceedling/test_invoker_helper.rb +5 -1
- data/lib/ceedling/tool_executor.rb +8 -4
- data/lib/ceedling/version.rb +1 -1
- data/out.fail +21 -0
- data/plugins/beep/README.md +22 -0
- data/plugins/beep/lib/beep.rb +40 -0
- data/plugins/bullseye/bullseye.rake +43 -36
- data/plugins/bullseye/config/defaults.yml +4 -0
- data/plugins/bullseye/lib/bullseye.rb +27 -5
- data/plugins/command_hooks/lib/command_hooks.rb +3 -0
- data/plugins/gcov/README.md +34 -1
- data/plugins/gcov/config/defaults.yml +3 -3
- data/plugins/gcov/gcov.rake +7 -5
- data/plugins/gcov/lib/gcov.rb +3 -1
- data/plugins/gcov/lib/gcov_constants.rb +2 -0
- data/plugins/junit_tests_report/lib/junit_tests_report.rb +12 -9
- data/plugins/module_generator/lib/module_generator.rb +14 -1
- data/plugins/module_generator/module_generator.rake +21 -4
- data/plugins/raw_output_report/lib/raw_output_report.rb +41 -0
- data/spec/gcov/gcov_deployment_spec.rb +1 -1
- data/spec/gcov/gcov_test_cases_spec.rb +2 -2
- data/spec/generator_test_results_spec.rb +5 -0
- data/spec/preprocessinator_includes_handler_spec.rb +1 -0
- data/spec/spec_system_helper.rb +178 -4
- data/spec/support/test_example.fail +1 -0
- data/spec/support/test_example.pass +1 -0
- data/spec/support/test_example_empty.pass +1 -0
- data/spec/support/test_example_ignore.pass +1 -0
- data/spec/support/test_example_mangled.pass +1 -0
- data/spec/support/test_example_with_time.pass +22 -0
- data/spec/system/deployment_spec.rb +33 -0
- data/vendor/cmock/README.md +4 -3
- data/vendor/cmock/docs/CMock_Summary.md +1 -1
- data/vendor/cmock/lib/cmock_config.rb +4 -0
- data/vendor/cmock/lib/cmock_generator.rb +5 -2
- data/vendor/cmock/lib/cmock_generator_plugin_array.rb +4 -4
- data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +9 -11
- data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +0 -1
- data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +2 -3
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +2 -4
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +0 -2
- data/vendor/cmock/lib/cmock_generator_utils.rb +16 -3
- data/vendor/cmock/lib/cmock_header_parser.rb +59 -34
- data/vendor/cmock/release/build.info +1 -1
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/scripts/create_makefile.rb +17 -2
- data/vendor/cmock/src/cmock.c +13 -7
- data/vendor/cmock/test/test_helper.rb +11 -10
- data/vendor/cmock/test/unit/cmock_config_test.rb +4 -2
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +10 -4
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +20 -12
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +3 -3
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +8 -6
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +27 -10
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +108 -20
- data/vendor/cmock/vendor/c_exception/Gemfile +4 -0
- data/vendor/cmock/vendor/c_exception/Gemfile.lock +12 -0
- data/vendor/cmock/vendor/c_exception/LICENSE.txt +30 -0
- data/vendor/cmock/vendor/c_exception/README.md +162 -0
- data/vendor/cmock/vendor/c_exception/Rakefile +42 -0
- data/vendor/cmock/vendor/c_exception/docs/CException.md +292 -0
- data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -0
- data/vendor/cmock/vendor/c_exception/lib/CException.h +110 -0
- data/vendor/cmock/vendor/c_exception/makefile +24 -0
- data/vendor/cmock/vendor/c_exception/release/build.info +2 -0
- data/vendor/cmock/vendor/c_exception/release/version.info +2 -0
- data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +46 -0
- data/vendor/cmock/vendor/c_exception/test/TestException.c +391 -0
- data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +67 -0
- data/vendor/cmock/vendor/unity/README.md +231 -0
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +118 -0
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +39 -0
- data/vendor/cmock/vendor/unity/auto/generate_config.yml +36 -0
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +308 -0
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +457 -0
- data/vendor/cmock/vendor/unity/auto/parse_output.rb +323 -0
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +252 -0
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +25 -0
- data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +6 -0
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +139 -0
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +136 -0
- data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -0
- data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +779 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +433 -0
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +192 -0
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +260 -0
- data/vendor/cmock/vendor/unity/docs/license.txt +21 -0
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +71 -0
- data/vendor/cmock/vendor/unity/examples/example_1/readme.txt +5 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
- data/vendor/cmock/vendor/unity/examples/example_2/makefile +70 -0
- data/vendor/cmock/vendor/unity/examples/example_2/readme.txt +5 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +43 -0
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +249 -0
- data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +13 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/unity/examples/unity_config.h +247 -0
- data/vendor/cmock/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +48 -0
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
- data/vendor/cmock/vendor/unity/extras/fixture/readme.txt +9 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +436 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +83 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +51 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +47 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +75 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +22 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +543 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +57 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
- data/vendor/cmock/vendor/unity/release/build.info +2 -0
- data/vendor/cmock/vendor/unity/release/version.info +2 -0
- data/vendor/cmock/vendor/unity/src/unity.c +1572 -0
- data/vendor/cmock/vendor/unity/src/unity.h +503 -0
- data/vendor/cmock/vendor/unity/src/unity_internals.h +924 -0
- data/vendor/cmock/vendor/unity/test/Makefile +68 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +61 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +57 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +55 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +15 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +67 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +70 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +58 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +67 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +70 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +71 -0
- data/vendor/cmock/vendor/unity/test/rakefile +125 -0
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +260 -0
- data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +78 -0
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +78 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +49 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +50 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +47 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +47 -0
- data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +101 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +90 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +80 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +95 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -0
- data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -0
- data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -0
- data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -0
- data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +186 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +195 -0
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1252 -0
- data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +113 -0
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +5371 -0
- data/vendor/unity/auto/generate_test_runner.rb +30 -10
- data/vendor/unity/auto/parse_output.rb +212 -109
- data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +9 -10
- data/vendor/unity/docs/UnityAssertionsReference.md +11 -2
- data/vendor/unity/docs/UnityConfigurationGuide.md +90 -55
- data/vendor/unity/docs/UnityGettingStartedGuide.md +6 -5
- data/vendor/unity/docs/UnityHelperScriptsGuide.md +23 -5
- data/vendor/unity/examples/unity_config.h +8 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.c +4 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +2 -2
- data/vendor/unity/release/build.info +1 -1
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +64 -57
- data/vendor/unity/src/unity.h +111 -7
- data/vendor/unity/src/unity_internals.h +173 -73
- data/vendor/unity/test/Makefile +5 -1
- data/vendor/unity/test/testdata/testRunnerGenerator.c +4 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +4 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +4 -1
- data/vendor/unity/test/tests/testparameterized.c +5 -2
- data/vendor/unity/test/tests/testunity.c +34 -0
- metadata +150 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
217
|
|
2
2
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
2.4.
|
|
1
|
+
2.4.6
|
|
2
2
|
|
|
@@ -18,8 +18,9 @@ RUNNERS_DIR = File.join(TEST_BUILD_DIR, 'runners')
|
|
|
18
18
|
MOCKS_DIR = File.join(TEST_BUILD_DIR, 'mocks')
|
|
19
19
|
TEST_BIN_DIR = TEST_BUILD_DIR
|
|
20
20
|
MOCK_PREFIX = ENV.fetch('TEST_MOCK_PREFIX', 'mock_')
|
|
21
|
+
MOCK_SUFFIX = ENV.fetch('TEST_MOCK_SUFFIX', '')
|
|
21
22
|
TEST_MAKEFILE = ENV.fetch('TEST_MAKEFILE', File.join(TEST_BUILD_DIR, 'MakefileTestSupport'))
|
|
22
|
-
MOCK_MATCHER = /#{MOCK_PREFIX}[A-Za-z_][A-Za-z0-9_\-\.]
|
|
23
|
+
MOCK_MATCHER = /#{MOCK_PREFIX}[A-Za-z_][A-Za-z0-9_\-\.]+#{MOCK_SUFFIX}/
|
|
23
24
|
|
|
24
25
|
[TEST_BUILD_DIR, OBJ_DIR, RUNNERS_DIR, MOCKS_DIR, TEST_BIN_DIR].each do |dir|
|
|
25
26
|
FileUtils.mkdir_p dir
|
|
@@ -58,7 +59,21 @@ File.open(TEST_MAKEFILE, "w") do |mkfile|
|
|
|
58
59
|
test_sources = Dir["#{TEST_DIR}/**/test_*.c"]
|
|
59
60
|
test_targets = []
|
|
60
61
|
generator = UnityTestRunnerGenerator.new
|
|
61
|
-
|
|
62
|
+
|
|
63
|
+
# headers that begin with prefix or end with suffix are not included
|
|
64
|
+
all_headers = Dir["#{SRC_DIR}/**/*.h"]
|
|
65
|
+
|
|
66
|
+
def reject_mock_files(file)
|
|
67
|
+
extn = File.extname file
|
|
68
|
+
filename = File.basename file, extn
|
|
69
|
+
if MOCK_SUFFIX.empty?
|
|
70
|
+
return filename.start_with? MOCK_PREFIX
|
|
71
|
+
end
|
|
72
|
+
return (filename.start_with? MOCK_PREFIX or filename.end_with? MOCK_SUFFIX)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
all_headers = all_headers.reject { |f| reject_mock_files(f) }
|
|
76
|
+
|
|
62
77
|
makefile_targets = []
|
|
63
78
|
|
|
64
79
|
test_sources.each do |test|
|
data/vendor/cmock/src/cmock.c
CHANGED
|
@@ -26,7 +26,8 @@ static unsigned char* CMock_Guts_Buffer = NULL;
|
|
|
26
26
|
static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_ALIGN_SIZE;
|
|
27
27
|
static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr;
|
|
28
28
|
#else
|
|
29
|
-
static
|
|
29
|
+
static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferArray[(CMOCK_MEM_SIZE + CMOCK_MEM_INDEX_SIZE - 1) / CMOCK_MEM_INDEX_SIZE];
|
|
30
|
+
#define CMock_Guts_Buffer ((unsigned char*)CMock_Guts_BufferArray)
|
|
30
31
|
static CMOCK_MEM_INDEX_TYPE CMock_Guts_BufferSize = CMOCK_MEM_SIZE + CMOCK_MEM_ALIGN_SIZE;
|
|
31
32
|
static CMOCK_MEM_INDEX_TYPE CMock_Guts_FreePtr;
|
|
32
33
|
#endif
|
|
@@ -48,12 +49,17 @@ CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size)
|
|
|
48
49
|
size = (size + CMOCK_MEM_ALIGN_MASK) & ~CMOCK_MEM_ALIGN_MASK;
|
|
49
50
|
if ((CMock_Guts_BufferSize - CMock_Guts_FreePtr) < size)
|
|
50
51
|
{
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
#ifndef CMOCK_MEM_DYNAMIC
|
|
53
|
+
return CMOCK_GUTS_NONE; // nothing we can do; our static buffer is out of memory
|
|
54
|
+
#else
|
|
55
|
+
// our dynamic buffer does not have enough room; request more via realloc()
|
|
56
|
+
CMOCK_MEM_INDEX_TYPE new_buffersize = CMock_Guts_BufferSize + CMOCK_MEM_SIZE + size;
|
|
57
|
+
unsigned char* new_buffer = realloc(CMock_Guts_Buffer, (size_t)new_buffersize);
|
|
58
|
+
if (new_buffer == NULL)
|
|
59
|
+
return CMOCK_GUTS_NONE; // realloc() failed; out of memory
|
|
60
|
+
CMock_Guts_Buffer = new_buffer;
|
|
61
|
+
CMock_Guts_BufferSize = new_buffersize;
|
|
62
|
+
#endif
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
//determine where we're putting this new block, and init its pointer to be the end of the line
|
|
@@ -24,20 +24,21 @@ end
|
|
|
24
24
|
|
|
25
25
|
def test_return
|
|
26
26
|
{
|
|
27
|
-
:int => {:type => "int",
|
|
28
|
-
:int_ptr => {:type => "int*",
|
|
29
|
-
:void => {:type => "void",
|
|
30
|
-
:string => {:type => "char*", :name => 'cmock_to_return', :ptr? => false, :const? => true, :void? => false, :str => 'const char* cmock_to_return'},
|
|
27
|
+
:int => {:type => "int", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => false, :str => 'int cmock_to_return'},
|
|
28
|
+
:int_ptr => {:type => "int*", :name => 'cmock_to_return', :ptr? => true, :const? => false, :void? => false, :str => 'int* cmock_to_return'},
|
|
29
|
+
:void => {:type => "void", :name => 'cmock_to_return', :ptr? => false, :const? => false, :void? => true, :str => 'void cmock_to_return'},
|
|
30
|
+
:string => {:type => "const char*", :name => 'cmock_to_return', :ptr? => false, :const? => true, :void? => false, :str => 'const char* cmock_to_return'},
|
|
31
31
|
}
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def test_arg
|
|
35
35
|
{
|
|
36
|
-
:int => {:type => "int",
|
|
37
|
-
:int_ptr => {:type => "int*",
|
|
38
|
-
:
|
|
39
|
-
:
|
|
40
|
-
:
|
|
36
|
+
:int => {:type => "int", :name => 'MyInt', :ptr? => false, :const? => false, :const_ptr? => false},
|
|
37
|
+
:int_ptr => {:type => "int*", :name => 'MyIntPtr', :ptr? => true, :const? => false, :const_ptr? => false},
|
|
38
|
+
:const_ptr => {:type => "int*", :name => 'MyConstPtr', :ptr? => true, :const? => false, :const_ptr? => true},
|
|
39
|
+
:double_ptr => {:type => "int const**", :name => 'MyDoublePtr', :ptr? => true, :const? => true, :const_ptr? => false},
|
|
40
|
+
:mytype => {:type => "MY_TYPE", :name => 'MyMyType', :ptr? => false, :const? => true, :const_ptr? => false},
|
|
41
|
+
:mytype_ptr => {:type => "MY_TYPE*", :name => 'MyMyTypePtr', :ptr? => true, :const? => false, :const_ptr? => false},
|
|
42
|
+
:string => {:type => "const char*", :name => 'MyStr', :ptr? => false, :const? => true, :const_ptr? => false},
|
|
41
43
|
}
|
|
42
44
|
end
|
|
43
|
-
|
|
@@ -14,7 +14,8 @@ describe CMockConfig, "Verify CMockConfig Module" do
|
|
|
14
14
|
it "use default settings when no parameters are specified" do
|
|
15
15
|
config = CMockConfig.new
|
|
16
16
|
assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path)
|
|
17
|
-
|
|
17
|
+
assert_nil(CMockConfig::CMockDefaultOptions[:includes])
|
|
18
|
+
assert_nil(config.includes)
|
|
18
19
|
assert_equal(CMockConfig::CMockDefaultOptions[:attributes], config.attributes)
|
|
19
20
|
assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins)
|
|
20
21
|
assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs)
|
|
@@ -35,7 +36,8 @@ describe CMockConfig, "Verify CMockConfig Module" do
|
|
|
35
36
|
test_plugins = [:soda, :pizza]
|
|
36
37
|
config = CMockConfig.new("#{File.expand_path(File.dirname(__FILE__))}/cmock_config_test.yml")
|
|
37
38
|
assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path)
|
|
38
|
-
|
|
39
|
+
assert_nil(CMockConfig::CMockDefaultOptions[:includes])
|
|
40
|
+
assert_nil(config.includes)
|
|
39
41
|
assert_equal(test_plugins, config.plugins)
|
|
40
42
|
assert_equal(:include, config.treat_externs)
|
|
41
43
|
end
|
|
@@ -87,7 +87,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
87
87
|
@config.expect :weak, ""
|
|
88
88
|
orig_filename = "PoutPoutFish.h"
|
|
89
89
|
define_name = "MOCKPOUTPOUTFISH_H"
|
|
90
|
-
mock_name = "MockPoutPoutFish"
|
|
91
90
|
output = []
|
|
92
91
|
expected = [
|
|
93
92
|
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
|
@@ -100,7 +99,9 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
100
99
|
"\n",
|
|
101
100
|
"/* Ignore the following warnings, since we are copying code */\n",
|
|
102
101
|
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n",
|
|
102
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n",
|
|
103
103
|
"#pragma GCC diagnostic push\n",
|
|
104
|
+
"#endif\n",
|
|
104
105
|
"#if !defined(__clang__)\n",
|
|
105
106
|
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
|
|
106
107
|
"#endif\n",
|
|
@@ -141,7 +142,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
141
142
|
@config.expect :weak, ""
|
|
142
143
|
orig_filename = "Pout-Pout Fish.h"
|
|
143
144
|
define_name = "MOCKPOUT_POUT_FISH_H"
|
|
144
|
-
mock_name = "MockPout_Pout_Fish"
|
|
145
145
|
output = []
|
|
146
146
|
expected = [
|
|
147
147
|
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
|
@@ -154,7 +154,9 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
154
154
|
"\n",
|
|
155
155
|
"/* Ignore the following warnings, since we are copying code */\n",
|
|
156
156
|
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n",
|
|
157
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n",
|
|
157
158
|
"#pragma GCC diagnostic push\n",
|
|
159
|
+
"#endif\n",
|
|
158
160
|
"#if !defined(__clang__)\n",
|
|
159
161
|
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
|
|
160
162
|
"#endif\n",
|
|
@@ -178,7 +180,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
178
180
|
@config.expect :weak, ""
|
|
179
181
|
orig_filename = "PoutPoutFish.h"
|
|
180
182
|
define_name = "MOCKPOUTPOUTFISH_H"
|
|
181
|
-
mock_name = "MockPoutPoutFish"
|
|
182
183
|
output = []
|
|
183
184
|
expected = [
|
|
184
185
|
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
|
@@ -190,7 +191,9 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
190
191
|
"\n",
|
|
191
192
|
"/* Ignore the following warnings, since we are copying code */\n",
|
|
192
193
|
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n",
|
|
194
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n",
|
|
193
195
|
"#pragma GCC diagnostic push\n",
|
|
196
|
+
"#endif\n",
|
|
194
197
|
"#if !defined(__clang__)\n",
|
|
195
198
|
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
|
|
196
199
|
"#endif\n",
|
|
@@ -214,7 +217,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
214
217
|
@config.expect :weak, ""
|
|
215
218
|
orig_filename = "PoutPoutFish.h"
|
|
216
219
|
define_name = "MOCKPOUTPOUTFISH_H"
|
|
217
|
-
mock_name = "MockPoutPoutFish"
|
|
218
220
|
output = []
|
|
219
221
|
expected = [
|
|
220
222
|
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
|
@@ -227,7 +229,9 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
227
229
|
"\n",
|
|
228
230
|
"/* Ignore the following warnings, since we are copying code */\n",
|
|
229
231
|
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n",
|
|
232
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n",
|
|
230
233
|
"#pragma GCC diagnostic push\n",
|
|
234
|
+
"#endif\n",
|
|
231
235
|
"#if !defined(__clang__)\n",
|
|
232
236
|
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
|
|
233
237
|
"#endif\n",
|
|
@@ -281,8 +285,10 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|
|
281
285
|
output = []
|
|
282
286
|
expected = ["\n",
|
|
283
287
|
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n",
|
|
288
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n",
|
|
284
289
|
"#pragma GCC diagnostic pop\n",
|
|
285
290
|
"#endif\n",
|
|
291
|
+
"#endif\n",
|
|
286
292
|
"\n",
|
|
287
293
|
"#endif\n"
|
|
288
294
|
]
|
|
@@ -6,21 +6,29 @@
|
|
|
6
6
|
|
|
7
7
|
require File.expand_path(File.dirname(__FILE__)) + "/../test_helper"
|
|
8
8
|
require File.expand_path(File.dirname(__FILE__)) + '/../../lib/cmock_generator_plugin_array'
|
|
9
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../../lib/cmock_generator_utils'
|
|
10
|
+
|
|
11
|
+
class UtilsStub
|
|
12
|
+
def helpers
|
|
13
|
+
{}
|
|
14
|
+
end
|
|
15
|
+
def arg_type_with_const(arg)
|
|
16
|
+
CMockGeneratorUtils.arg_type_with_const(arg)
|
|
17
|
+
end
|
|
18
|
+
def code_add_base_expectation(func)
|
|
19
|
+
"mock_retval_0"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
9
22
|
|
|
10
23
|
describe CMockGeneratorPluginArray, "Verify CMockPGeneratorluginArray Module" do
|
|
11
24
|
before do
|
|
12
|
-
create_mocks :utils
|
|
13
|
-
|
|
14
25
|
#no strict ordering
|
|
15
26
|
@config = create_stub(
|
|
16
27
|
:when_ptr => :compare_data,
|
|
17
28
|
:enforce_strict_ordering => false,
|
|
18
29
|
:respond_to? => true )
|
|
19
30
|
|
|
20
|
-
@utils =
|
|
21
|
-
:helpers => {},
|
|
22
|
-
:code_add_base_expectation => "mock_retval_0"
|
|
23
|
-
)
|
|
31
|
+
@utils = UtilsStub.new
|
|
24
32
|
|
|
25
33
|
@cmock_generator_plugin_array = CMockGeneratorPluginArray.new(@config, @utils)
|
|
26
34
|
end
|
|
@@ -29,8 +37,8 @@ describe CMockGeneratorPluginArray, "Verify CMockPGeneratorluginArray Module" do
|
|
|
29
37
|
end
|
|
30
38
|
|
|
31
39
|
it "have set up internal priority" do
|
|
32
|
-
|
|
33
|
-
assert_equal(8,
|
|
40
|
+
assert_nil(@cmock_generator_plugin_array.unity_helper)
|
|
41
|
+
assert_equal(8, @cmock_generator_plugin_array.priority)
|
|
34
42
|
end
|
|
35
43
|
|
|
36
44
|
it "not include any additional include files" do
|
|
@@ -88,10 +96,10 @@ describe CMockGeneratorPluginArray, "Verify CMockPGeneratorluginArray Module" do
|
|
|
88
96
|
|
|
89
97
|
it "add another mock function declaration for functions of style 'const char* func(const int* tofu)'" do
|
|
90
98
|
function = {:name => "Pine",
|
|
91
|
-
:args => [{ :type
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
:args => [{ :type => "const int*",
|
|
100
|
+
:name => "tofu",
|
|
101
|
+
:ptr? => true,
|
|
102
|
+
:const? => true,
|
|
95
103
|
}],
|
|
96
104
|
:return => test_return[:string],
|
|
97
105
|
:contains_ptr? => true }
|
|
@@ -26,8 +26,8 @@ describe CMockGeneratorPluginExpect, "Verify CMockGeneratorPluginExpect Module W
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it "have set up internal priority on init" do
|
|
29
|
-
|
|
30
|
-
assert_equal(5,
|
|
29
|
+
assert_nil(@cmock_generator_plugin_expect.unity_helper)
|
|
30
|
+
assert_equal(5, @cmock_generator_plugin_expect.priority)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it "not include any additional include files" do
|
|
@@ -26,8 +26,8 @@ describe CMockGeneratorPluginExpect, "Verify CMockGeneratorPluginExpect Module w
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it "have set up internal priority on init" do
|
|
29
|
-
|
|
30
|
-
assert_equal(5,
|
|
29
|
+
assert_nil(@cmock_generator_plugin_expect.unity_helper)
|
|
30
|
+
assert_equal(5, @cmock_generator_plugin_expect.priority)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it "not include any additional include files" do
|
|
@@ -21,9 +21,9 @@ describe CMockGeneratorPluginIgnoreArg, "Verify CMockGeneratorPluginIgnoreArg Mo
|
|
|
21
21
|
:name => "chicken",
|
|
22
22
|
:ptr? => false,
|
|
23
23
|
},
|
|
24
|
-
{ :type
|
|
25
|
-
:name
|
|
26
|
-
:ptr?
|
|
24
|
+
{ :type => "const int*",
|
|
25
|
+
:name => "beef",
|
|
26
|
+
:ptr? => true,
|
|
27
27
|
:const? => true,
|
|
28
28
|
},
|
|
29
29
|
{ :type => "int*",
|
|
@@ -27,9 +27,9 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh
|
|
|
27
27
|
:name => "chicken",
|
|
28
28
|
:ptr? => false,
|
|
29
29
|
},
|
|
30
|
-
{ :type
|
|
31
|
-
:name
|
|
32
|
-
:ptr?
|
|
30
|
+
{ :type => "const int*",
|
|
31
|
+
:name => "beef",
|
|
32
|
+
:ptr? => true,
|
|
33
33
|
:const? => true,
|
|
34
34
|
},
|
|
35
35
|
{ :type => "int*",
|
|
@@ -52,7 +52,7 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh
|
|
|
52
52
|
|
|
53
53
|
def complex_func_expect
|
|
54
54
|
@utils.expect :ptr_or_str?, false, ['int']
|
|
55
|
-
@utils.expect :ptr_or_str?, true, ['int*']
|
|
55
|
+
@utils.expect :ptr_or_str?, true, ['const int*']
|
|
56
56
|
@utils.expect :ptr_or_str?, true, ['int*']
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -124,11 +124,13 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh
|
|
|
124
124
|
expected =
|
|
125
125
|
" if (cmock_call_instance->ReturnThruPtr_tofu_Used)\n" +
|
|
126
126
|
" {\n" +
|
|
127
|
-
"
|
|
127
|
+
" UNITY_TEST_ASSERT_NOT_NULL(tofu, cmock_line, CMockStringPtrIsNULL);\n" +
|
|
128
|
+
" memcpy((void*)tofu, (void*)cmock_call_instance->ReturnThruPtr_tofu_Val,\n" +
|
|
128
129
|
" cmock_call_instance->ReturnThruPtr_tofu_Size);\n" +
|
|
129
|
-
" }\n"
|
|
130
|
+
" }\n"
|
|
130
131
|
|
|
131
132
|
returned = @cmock_generator_plugin_return_thru_ptr.mock_implementation(@complex_func).join("")
|
|
133
|
+
assert_equal(expected, returned)
|
|
132
134
|
end
|
|
133
135
|
|
|
134
136
|
end
|
|
@@ -20,7 +20,7 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
|
|
20
20
|
@config.expect :plugins, []
|
|
21
21
|
@config.expect :plugins, []
|
|
22
22
|
@config.expect :plugins, []
|
|
23
|
-
@config.expect :treat_as, {'int' => 'INT','short' => 'INT16','long' => 'INT','char' => 'INT8','char*' => 'STRING'}
|
|
23
|
+
@config.expect :treat_as, {'int' => 'INT','short' => 'INT16','long' => 'INT','char' => 'INT8','const char*' => 'STRING'}
|
|
24
24
|
@cmock_generator_utils_simple = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper})
|
|
25
25
|
|
|
26
26
|
@config.expect :when_ptr, :smart
|
|
@@ -31,7 +31,7 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
|
|
31
31
|
@config.expect :plugins, [:array, :cexception, :return_thru_ptr, :ignore_arg, :ignore]
|
|
32
32
|
@config.expect :plugins, [:array, :cexception, :return_thru_ptr, :ignore_arg, :ignore]
|
|
33
33
|
@config.expect :plugins, [:array, :cexception, :return_thru_ptr, :ignore_arg, :ignore]
|
|
34
|
-
@config.expect :treat_as, {'int' => 'INT','short' => 'INT16','long' => 'INT','char' => 'INT8','uint32_t' => 'HEX32','char*' => 'STRING'}
|
|
34
|
+
@config.expect :treat_as, {'int' => 'INT','short' => 'INT16','long' => 'INT','char' => 'INT8','uint32_t' => 'HEX32','const char*' => 'STRING'}
|
|
35
35
|
@cmock_generator_utils_complex = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper, :A=>1, :B=>2})
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -99,8 +99,8 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
|
|
99
99
|
arg1 = { :name => "Orange", :const? => false, :type => 'int', :ptr? => false }
|
|
100
100
|
expected1 = " cmock_call_instance->Expected_Orange = Orange;\n"
|
|
101
101
|
|
|
102
|
-
arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? =>
|
|
103
|
-
expected2 = " cmock_call_instance->Expected_Lemon =
|
|
102
|
+
arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => false }
|
|
103
|
+
expected2 = " cmock_call_instance->Expected_Lemon = Lemon;\n"
|
|
104
104
|
|
|
105
105
|
arg3 = { :name => "Kiwi", :const? => false, :type => 'KIWI_T*', :ptr? => true }
|
|
106
106
|
expected3 = " cmock_call_instance->Expected_Kiwi = Kiwi;\n"
|
|
@@ -119,8 +119,8 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
|
|
119
119
|
expected1 = " cmock_call_instance->Expected_Orange = Orange;\n" +
|
|
120
120
|
" cmock_call_instance->IgnoreArg_Orange = 0;\n"
|
|
121
121
|
|
|
122
|
-
arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? =>
|
|
123
|
-
expected2 = " cmock_call_instance->Expected_Lemon =
|
|
122
|
+
arg2 = { :name => "Lemon", :const? => true, :type => 'const char*', :ptr? => false }
|
|
123
|
+
expected2 = " cmock_call_instance->Expected_Lemon = Lemon;\n" +
|
|
124
124
|
" cmock_call_instance->Expected_Lemon_Depth = Lemon_Depth;\n" +
|
|
125
125
|
" cmock_call_instance->IgnoreArg_Lemon = 0;\n"
|
|
126
126
|
|
|
@@ -154,7 +154,7 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
|
|
154
154
|
expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, stuff)\n{\n" +
|
|
155
155
|
" cmock_call_instance->Expected_MyIntPtr = MyIntPtr;\n" +
|
|
156
156
|
" memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" +
|
|
157
|
-
" cmock_call_instance->Expected_MyStr =
|
|
157
|
+
" cmock_call_instance->Expected_MyStr = MyStr;\n" +
|
|
158
158
|
"}\n\n"
|
|
159
159
|
assert_equal(expected, @cmock_generator_utils_simple.code_add_argument_loader(function))
|
|
160
160
|
end
|
|
@@ -171,12 +171,29 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
|
|
171
171
|
" cmock_call_instance->ReturnThruPtr_MyIntPtr_Used = 0;\n" +
|
|
172
172
|
" memcpy(&cmock_call_instance->Expected_MyMyType, &MyMyType, sizeof(MY_TYPE));\n" +
|
|
173
173
|
" cmock_call_instance->IgnoreArg_MyMyType = 0;\n" +
|
|
174
|
-
" cmock_call_instance->Expected_MyStr =
|
|
174
|
+
" cmock_call_instance->Expected_MyStr = MyStr;\n" +
|
|
175
175
|
" cmock_call_instance->IgnoreArg_MyStr = 0;\n" +
|
|
176
176
|
"}\n\n"
|
|
177
177
|
assert_equal(expected, @cmock_generator_utils_complex.code_add_argument_loader(function))
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
+
it 'create an argument loader when the function has pointer arguments supporting arrays' do
|
|
181
|
+
function = { :name => "Melon",
|
|
182
|
+
:args_string => "stuff",
|
|
183
|
+
:args => [test_arg[:const_ptr], test_arg[:double_ptr]]
|
|
184
|
+
}
|
|
185
|
+
expected = "void CMockExpectParameters_Melon(CMOCK_Melon_CALL_INSTANCE* cmock_call_instance, int* const MyConstPtr, int MyConstPtr_Depth, int const** MyDoublePtr, int MyDoublePtr_Depth)\n{\n" +
|
|
186
|
+
" cmock_call_instance->Expected_MyConstPtr = MyConstPtr;\n" +
|
|
187
|
+
" cmock_call_instance->Expected_MyConstPtr_Depth = MyConstPtr_Depth;\n" +
|
|
188
|
+
" cmock_call_instance->IgnoreArg_MyConstPtr = 0;\n" +
|
|
189
|
+
" cmock_call_instance->ReturnThruPtr_MyConstPtr_Used = 0;\n" +
|
|
190
|
+
" cmock_call_instance->Expected_MyDoublePtr = MyDoublePtr;\n" +
|
|
191
|
+
" cmock_call_instance->Expected_MyDoublePtr_Depth = MyDoublePtr_Depth;\n" +
|
|
192
|
+
" cmock_call_instance->IgnoreArg_MyDoublePtr = 0;\n" +
|
|
193
|
+
"}\n\n"
|
|
194
|
+
assert_equal(expected, @cmock_generator_utils_complex.code_add_argument_loader(function))
|
|
195
|
+
end
|
|
196
|
+
|
|
180
197
|
it "not call argument loader if there are no arguments to actually use for this function" do
|
|
181
198
|
function = { :name => "Pineapple", :args_string => "void" }
|
|
182
199
|
|
|
@@ -231,7 +248,7 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
|
|
231
248
|
" UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, CMockStringMismatch);\n" +
|
|
232
249
|
" }\n"
|
|
233
250
|
@unity_helper.expect :nil?, false
|
|
234
|
-
@unity_helper.expect :get_helper, ['UNITY_TEST_ASSERT_EQUAL_STRING',''], ['char*']
|
|
251
|
+
@unity_helper.expect :get_helper, ['UNITY_TEST_ASSERT_EQUAL_STRING',''], ['const char*']
|
|
235
252
|
assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg))
|
|
236
253
|
end
|
|
237
254
|
|
|
@@ -311,7 +328,7 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
|
|
311
328
|
" UNITY_TEST_ASSERT_EQUAL_STRING(cmock_call_instance->Expected_MyStr, MyStr, cmock_line, CMockStringMismatch);\n" +
|
|
312
329
|
" }\n"
|
|
313
330
|
@unity_helper.expect :nil?, false
|
|
314
|
-
@unity_helper.expect :get_helper, ['UNITY_TEST_ASSERT_EQUAL_STRING',''], ['char*']
|
|
331
|
+
@unity_helper.expect :get_helper, ['UNITY_TEST_ASSERT_EQUAL_STRING',''], ['const char*']
|
|
315
332
|
assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg))
|
|
316
333
|
end
|
|
317
334
|
|
|
@@ -805,32 +805,57 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
|
|
805
805
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
806
806
|
end
|
|
807
807
|
|
|
808
|
-
it "should properly handle const before
|
|
809
|
-
|
|
808
|
+
it "should properly handle const before return type" do
|
|
810
809
|
sources = [
|
|
811
810
|
"const int * PorkRoast(void);\n",
|
|
812
|
-
"int const * PorkRoast(void);\n",
|
|
813
811
|
"const int* PorkRoast(void);\n",
|
|
812
|
+
"const int *PorkRoast(void);\n"
|
|
813
|
+
]
|
|
814
|
+
|
|
815
|
+
expected = [{ :var_arg => nil,
|
|
816
|
+
:name => "PorkRoast",
|
|
817
|
+
:return => { :type => "const int*",
|
|
818
|
+
:name => 'cmock_to_return',
|
|
819
|
+
:ptr? => true,
|
|
820
|
+
:const? => true,
|
|
821
|
+
:const_ptr? => false,
|
|
822
|
+
:str => "const int* cmock_to_return",
|
|
823
|
+
:void? => false
|
|
824
|
+
},
|
|
825
|
+
:modifier => "",
|
|
826
|
+
:contains_ptr? => false,
|
|
827
|
+
:args => [],
|
|
828
|
+
:args_string => "void",
|
|
829
|
+
:args_call => ""
|
|
830
|
+
}]
|
|
831
|
+
|
|
832
|
+
sources.each do |source|
|
|
833
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
834
|
+
end
|
|
835
|
+
end
|
|
836
|
+
|
|
837
|
+
it "should properly handle const before return type" do
|
|
838
|
+
sources = [
|
|
839
|
+
"int const * PorkRoast(void);\n",
|
|
814
840
|
"int const* PorkRoast(void);\n",
|
|
815
|
-
"const int *PorkRoast(void);\n",
|
|
816
841
|
"int const *PorkRoast(void);\n"
|
|
817
842
|
]
|
|
818
843
|
|
|
819
|
-
expected = [{ :var_arg=>nil,
|
|
820
|
-
:name=>"PorkRoast",
|
|
821
|
-
:return=> { :type
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
:modifier=>"
|
|
844
|
+
expected = [{ :var_arg => nil,
|
|
845
|
+
:name => "PorkRoast",
|
|
846
|
+
:return => { :type => "int const*",
|
|
847
|
+
:name => 'cmock_to_return',
|
|
848
|
+
:ptr? => true,
|
|
849
|
+
:const? => true,
|
|
850
|
+
:const_ptr? => false,
|
|
851
|
+
:str => "int const* cmock_to_return",
|
|
852
|
+
:void? => false
|
|
853
|
+
},
|
|
854
|
+
:modifier => "",
|
|
830
855
|
:contains_ptr? => false,
|
|
831
|
-
:args=>[],
|
|
832
|
-
:args_string=>"void",
|
|
833
|
-
:args_call=>""
|
|
856
|
+
:args => [],
|
|
857
|
+
:args_string => "void",
|
|
858
|
+
:args_call => ""
|
|
834
859
|
}]
|
|
835
860
|
|
|
836
861
|
sources.each do |source|
|
|
@@ -861,6 +886,69 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
|
|
861
886
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
862
887
|
end
|
|
863
888
|
|
|
889
|
+
it "properly parse const and pointer argument types with no arg names" do
|
|
890
|
+
|
|
891
|
+
source = "void foo(int const*, int*const, const int*, const int*const, int const*const, int*, int, const int);\n"
|
|
892
|
+
|
|
893
|
+
expected = [{ :name => "foo",
|
|
894
|
+
:modifier => "",
|
|
895
|
+
:return => { :type => "void",
|
|
896
|
+
:name => "cmock_to_return",
|
|
897
|
+
:str => "void cmock_to_return",
|
|
898
|
+
:void? => true,
|
|
899
|
+
:ptr? => false,
|
|
900
|
+
:const? => false,
|
|
901
|
+
:const_ptr? => false
|
|
902
|
+
},
|
|
903
|
+
:var_arg => nil,
|
|
904
|
+
:args_string => "int const* cmock_arg1, int* const cmock_arg2, const int* cmock_arg3, const int* const cmock_arg4, " +
|
|
905
|
+
"int const* const cmock_arg5, int* cmock_arg6, int cmock_arg7, const int cmock_arg8",
|
|
906
|
+
:args => [{ :type=>"int const*", :name => "cmock_arg1", :ptr? => true, :const? => true, :const_ptr? => false },
|
|
907
|
+
{ :type=>"int*", :name => "cmock_arg2", :ptr? => true, :const? => false, :const_ptr? => true },
|
|
908
|
+
{ :type=>"const int*", :name => "cmock_arg3", :ptr? => true, :const? => true, :const_ptr? => false },
|
|
909
|
+
{ :type=>"const int*", :name => "cmock_arg4", :ptr? => true, :const? => true, :const_ptr? => true },
|
|
910
|
+
{ :type=>"int const*", :name => "cmock_arg5", :ptr? => true, :const? => true, :const_ptr? => true },
|
|
911
|
+
{ :type=>"int*", :name => "cmock_arg6", :ptr? => true, :const? => false, :const_ptr? => false },
|
|
912
|
+
{ :type=>"int", :name => "cmock_arg7", :ptr? => false, :const? => false, :const_ptr? => false },
|
|
913
|
+
{ :type=>"int", :name => "cmock_arg8", :ptr? => false, :const? => true, :const_ptr? => false }],
|
|
914
|
+
:args_call => "cmock_arg1, cmock_arg2, cmock_arg3, cmock_arg4, cmock_arg5, cmock_arg6, cmock_arg7, cmock_arg8",
|
|
915
|
+
:contains_ptr? => true
|
|
916
|
+
}]
|
|
917
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
918
|
+
end
|
|
919
|
+
|
|
920
|
+
it "properly parse const and pointer argument types with arg names" do
|
|
921
|
+
|
|
922
|
+
source = "void bar(int const* param1, int*const param2, const int* param3, const int*const param4,\n" +
|
|
923
|
+
" int const*const param5, int*param6, int param7, const int param8);\n"
|
|
924
|
+
|
|
925
|
+
expected = [{ :name => "bar",
|
|
926
|
+
:modifier => "",
|
|
927
|
+
:return => { :type => "void",
|
|
928
|
+
:name => "cmock_to_return",
|
|
929
|
+
:str => "void cmock_to_return",
|
|
930
|
+
:void? => true,
|
|
931
|
+
:ptr? => false,
|
|
932
|
+
:const? => false,
|
|
933
|
+
:const_ptr? => false
|
|
934
|
+
},
|
|
935
|
+
:var_arg => nil,
|
|
936
|
+
:args_string => "int const* param1, int* const param2, const int* param3, const int* const param4, " +
|
|
937
|
+
"int const* const param5, int* param6, int param7, const int param8",
|
|
938
|
+
:args => [{ :type=>"int const*", :name => "param1", :ptr? => true, :const? => true, :const_ptr? => false },
|
|
939
|
+
{ :type=>"int*", :name => "param2", :ptr? => true, :const? => false, :const_ptr? => true },
|
|
940
|
+
{ :type=>"const int*", :name => "param3", :ptr? => true, :const? => true, :const_ptr? => false },
|
|
941
|
+
{ :type=>"const int*", :name => "param4", :ptr? => true, :const? => true, :const_ptr? => true },
|
|
942
|
+
{ :type=>"int const*", :name => "param5", :ptr? => true, :const? => true, :const_ptr? => true },
|
|
943
|
+
{ :type=>"int*", :name => "param6", :ptr? => true, :const? => false, :const_ptr? => false },
|
|
944
|
+
{ :type=>"int", :name => "param7", :ptr? => false, :const? => false, :const_ptr? => false },
|
|
945
|
+
{ :type=>"int", :name => "param8", :ptr? => false, :const? => true, :const_ptr? => false }],
|
|
946
|
+
:args_call => "param1, param2, param3, param4, param5, param6, param7, param8",
|
|
947
|
+
:contains_ptr? => true
|
|
948
|
+
}]
|
|
949
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
950
|
+
end
|
|
951
|
+
|
|
864
952
|
it "properly detect typedef'd variants of void and use those" do
|
|
865
953
|
|
|
866
954
|
source = "typedef (void) FUNKY_VOID_T;\n" +
|
|
@@ -937,7 +1025,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
|
|
937
1025
|
:name=>"Penny",
|
|
938
1026
|
:modifier=>"",
|
|
939
1027
|
:contains_ptr? => true,
|
|
940
|
-
:args=>[ {:type=>"struct _KeepYourHeadUp_*", :name=>"BillyBuddy", :ptr? => true, :const? => true, :const_ptr? => true} ],
|
|
1028
|
+
:args=>[ {:type=>"struct const _KeepYourHeadUp_*", :name=>"BillyBuddy", :ptr? => true, :const? => true, :const_ptr? => true} ],
|
|
941
1029
|
:args_string=>"struct const _KeepYourHeadUp_* const BillyBuddy",
|
|
942
1030
|
:args_call=>"BillyBuddy"
|
|
943
1031
|
},
|
|
@@ -1440,7 +1528,7 @@ describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
|
|
1440
1528
|
:contains_ptr? => true,
|
|
1441
1529
|
:args=>[ {:type=>"sqlite3_stmt*", :name=>"cmock_arg2", :ptr? => true, :const? => false, :const_ptr? => false},
|
|
1442
1530
|
{:type=>"int", :name=>"cmock_arg3", :ptr? => false, :const? => false, :const_ptr? => false},
|
|
1443
|
-
{:type=>"char*", :name=>"cmock_arg4", :ptr? => false, :const? => true, :const_ptr? => false},
|
|
1531
|
+
{:type=>"const char*", :name=>"cmock_arg4", :ptr? => false, :const? => true, :const_ptr? => false},
|
|
1444
1532
|
{:type=>"int", :name=>"n", :ptr? => false, :const? => false, :const_ptr? => false},
|
|
1445
1533
|
{:type=>"cmock_module_func_ptr1", :name=>"cmock_arg1", :ptr? => false, :const? => false, :const_ptr? => false}
|
|
1446
1534
|
],
|