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
@@ -2,27 +2,40 @@
|
|
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_plugin_manager'
|
9
|
+
require 'cmock_generator_plugin_expect'
|
10
|
+
require 'cmock_generator_plugin_ignore'
|
11
|
+
require 'cmock_generator_plugin_cexception'
|
12
|
+
|
13
|
+
describe CMockPluginManager, "Verify CMockPluginManager Module" do
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
before do
|
16
|
+
create_mocks :utils, :pluginA, :pluginB
|
17
|
+
@config = create_stub(
|
18
|
+
:respond_to => true,
|
19
|
+
:when_ptr => :compare_data,
|
20
|
+
:enforce_strict_ordering => false,
|
21
|
+
:ignore => :args_and_calls
|
22
|
+
)
|
23
|
+
|
24
|
+
#if (RUBY_VERSION.split('.')[0].to_i >= 2)
|
25
|
+
# @config.define_singleton_method( :plugins ){ @plugins || [] }
|
26
|
+
# @config.define_singleton_method( :plugins= ){ |val| @plugins = val }
|
27
|
+
#else
|
28
|
+
eval "class << @config\ndef plugins\n@plugins||[]\nend\ndef plugins=(val)\n@plugins=val\nend\nend\n"
|
29
|
+
#end
|
17
30
|
end
|
18
31
|
|
19
|
-
|
32
|
+
after do
|
20
33
|
end
|
21
|
-
|
22
|
-
|
23
|
-
@config.
|
24
|
-
@utils.expect
|
25
|
-
|
34
|
+
|
35
|
+
it "return all plugins by default" do
|
36
|
+
@config.plugins = ['cexception','ignore']
|
37
|
+
@utils.expect :helpers, {}
|
38
|
+
|
26
39
|
@cmock_plugins = CMockPluginManager.new(@config, @utils)
|
27
40
|
|
28
41
|
test_plugins = @cmock_plugins.plugins
|
@@ -36,13 +49,12 @@ class CMockPluginManagerTest < Test::Unit::TestCase
|
|
36
49
|
assert_equal(true, contained[:ignore])
|
37
50
|
assert_equal(true, contained[:cexception])
|
38
51
|
end
|
39
|
-
|
40
|
-
|
41
|
-
@
|
42
|
-
|
43
|
-
|
52
|
+
|
53
|
+
it "return restricted plugins based on config" do
|
54
|
+
@utils.expect :helpers, {}
|
55
|
+
|
44
56
|
@cmock_plugins = CMockPluginManager.new(@config, @utils)
|
45
|
-
|
57
|
+
|
46
58
|
test_plugins = @cmock_plugins.plugins
|
47
59
|
contained = { :expect => false, :ignore => false, :cexception => false }
|
48
60
|
test_plugins.each do |plugin|
|
@@ -54,30 +66,28 @@ class CMockPluginManagerTest < Test::Unit::TestCase
|
|
54
66
|
assert_equal(false,contained[:ignore])
|
55
67
|
assert_equal(false,contained[:cexception])
|
56
68
|
end
|
57
|
-
|
58
|
-
|
59
|
-
@
|
60
|
-
@utils.expect.helpers.returns({})
|
69
|
+
|
70
|
+
it "run a desired method over each plugin requested and return the results" do
|
71
|
+
@utils.expect :helpers, {}
|
61
72
|
@cmock_plugins = CMockPluginManager.new(@config, @utils)
|
62
|
-
|
73
|
+
|
74
|
+
@pluginA = create_stub(:test_method => ["This Is An Awesome Test-"])
|
75
|
+
@pluginB = create_stub(:test_method => ["And This is Part 2-","Of An Awesome Test"])
|
63
76
|
@cmock_plugins.plugins = [@pluginA, @pluginB]
|
64
|
-
|
65
|
-
@pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"])
|
66
|
-
|
77
|
+
|
67
78
|
expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test"
|
68
79
|
output = @cmock_plugins.run(:test_method)
|
69
80
|
assert_equal(expected, output)
|
70
81
|
end
|
71
|
-
|
72
|
-
|
73
|
-
@
|
74
|
-
@utils.expect.helpers.returns({})
|
82
|
+
|
83
|
+
it "run a desired method and arg list over each plugin requested and return the results" do
|
84
|
+
@utils.expect :helpers, {}
|
75
85
|
@cmock_plugins = CMockPluginManager.new(@config, @utils)
|
76
|
-
|
86
|
+
|
87
|
+
@pluginA = create_stub(:test_method => ["This Is An Awesome Test-"])
|
88
|
+
@pluginB = create_stub(:test_method => ["And This is Part 2-","Of An Awesome Test"])
|
77
89
|
@cmock_plugins.plugins = [@pluginA, @pluginB]
|
78
|
-
|
79
|
-
@pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"])
|
80
|
-
|
90
|
+
|
81
91
|
expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test"
|
82
92
|
output = @cmock_plugins.run(:test_method, "chickenpotpie")
|
83
93
|
assert_equal(expected, output)
|
@@ -2,50 +2,50 @@
|
|
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_unityhelper_parser'
|
9
9
|
|
10
|
-
|
10
|
+
describe CMockUnityHelperParser, "Verify CMockUnityHelperParser Module" do
|
11
11
|
|
12
|
-
|
12
|
+
before do
|
13
13
|
create_mocks :config
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
after do
|
17
17
|
end
|
18
|
-
|
19
|
-
|
20
|
-
source =
|
18
|
+
|
19
|
+
it "ignore lines that are commented out" do
|
20
|
+
source =
|
21
21
|
" abcd;\n" +
|
22
22
|
"// #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" +
|
23
23
|
"or maybe // #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n\n"
|
24
|
-
@config.
|
25
|
-
@config.
|
26
|
-
@config.
|
24
|
+
@config.expect :plugins, [] #not :array
|
25
|
+
@config.expect :treat_as, {}
|
26
|
+
@config.expect :load_unity_helper, source
|
27
27
|
@parser = CMockUnityHelperParser.new(@config)
|
28
28
|
expected = {}
|
29
|
-
|
29
|
+
|
30
30
|
assert_equal(expected, @parser.c_types)
|
31
31
|
end
|
32
|
-
|
33
|
-
|
34
|
-
source =
|
32
|
+
|
33
|
+
it "ignore stuff in block comments" do
|
34
|
+
source =
|
35
35
|
" abcd; /*\n" +
|
36
36
|
"#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" +
|
37
37
|
"#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n */\n"
|
38
|
-
@config.
|
39
|
-
@config.
|
40
|
-
@config.expect
|
38
|
+
@config.expect :plugins, [] #not :array
|
39
|
+
@config.expect :treat_as, {}
|
40
|
+
@config.expect :load_unity_helper, source
|
41
41
|
@parser = CMockUnityHelperParser.new(@config)
|
42
42
|
expected = {}
|
43
|
-
|
43
|
+
|
44
44
|
assert_equal(expected, @parser.c_types)
|
45
45
|
end
|
46
|
-
|
47
|
-
|
48
|
-
source =
|
46
|
+
|
47
|
+
it "notice equal helpers in the proper form and ignore others" do
|
48
|
+
source =
|
49
49
|
"abcd;\n" +
|
50
50
|
"#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_T(a,b,line,msg) {...};\n" +
|
51
51
|
"abcd;\n" +
|
@@ -53,20 +53,20 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
|
|
53
53
|
"#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL(a,b,c,d) {...};\n" +
|
54
54
|
"#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits(a,b,c,d) {...};\n" +
|
55
55
|
"abcd;\n"
|
56
|
-
@config.
|
57
|
-
@config.
|
58
|
-
@config.expect
|
56
|
+
@config.expect :plugins, [] #not :array
|
57
|
+
@config.expect :treat_as, {}
|
58
|
+
@config.expect :load_unity_helper, source
|
59
59
|
@parser = CMockUnityHelperParser.new(@config)
|
60
60
|
expected = {
|
61
61
|
'TURKEYS_T' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_T",
|
62
62
|
'unsigned_funky_rabbits' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits"
|
63
63
|
}
|
64
|
-
|
64
|
+
|
65
65
|
assert_equal(expected, @parser.c_types)
|
66
66
|
end
|
67
67
|
|
68
|
-
|
69
|
-
source =
|
68
|
+
it "notice equal helpers that contain arrays" do
|
69
|
+
source =
|
70
70
|
"abcd;\n" +
|
71
71
|
"#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY(a,b,c,d,e) {...};\n" +
|
72
72
|
"abcd;\n" +
|
@@ -74,19 +74,19 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
|
|
74
74
|
"#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL_ARRAY(a,b,c,d,e) {...};\n" +
|
75
75
|
"#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY(a,b,c,d,e) {...};\n" +
|
76
76
|
"abcd;\n"
|
77
|
-
@config.
|
78
|
-
@config.
|
79
|
-
@config.expect
|
77
|
+
@config.expect :plugins, [] #not :array
|
78
|
+
@config.expect :treat_as, {}
|
79
|
+
@config.expect :load_unity_helper, source
|
80
80
|
@parser = CMockUnityHelperParser.new(@config)
|
81
81
|
expected = {
|
82
82
|
'TURKEYS*' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY",
|
83
83
|
'unsigned_funky_rabbits*' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY"
|
84
84
|
}
|
85
|
-
|
85
|
+
|
86
86
|
assert_equal(expected, @parser.c_types)
|
87
87
|
end
|
88
88
|
|
89
|
-
|
89
|
+
it "pull in the standard set of helpers and add them to my list" do
|
90
90
|
pairs = {
|
91
91
|
"UINT" => "HEX32",
|
92
92
|
"unsigned long" => "HEX64",
|
@@ -97,15 +97,15 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
|
|
97
97
|
"UINT*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY",
|
98
98
|
"unsigned_long*"=> "UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY",
|
99
99
|
}
|
100
|
-
@config.
|
101
|
-
@config.
|
102
|
-
@config.expect
|
100
|
+
@config.expect :plugins, [] #not :array
|
101
|
+
@config.expect :treat_as, pairs
|
102
|
+
@config.expect :load_unity_helper, nil
|
103
103
|
@parser = CMockUnityHelperParser.new(@config)
|
104
|
-
|
104
|
+
|
105
105
|
assert_equal(expected, @parser.c_types)
|
106
106
|
end
|
107
|
-
|
108
|
-
|
107
|
+
|
108
|
+
it "pull in the user specified set of helpers and add them to my list" do
|
109
109
|
pairs = {
|
110
110
|
"char*" => "STRING",
|
111
111
|
"unsigned int" => "HEX32",
|
@@ -116,18 +116,18 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
|
|
116
116
|
"char**" => "UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY",
|
117
117
|
"unsigned_int*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY",
|
118
118
|
}
|
119
|
-
@config.
|
120
|
-
@config.
|
121
|
-
@config.expect
|
119
|
+
@config.expect :plugins, [] #not :array
|
120
|
+
@config.expect :treat_as, pairs
|
121
|
+
@config.expect :load_unity_helper, nil
|
122
122
|
@parser = CMockUnityHelperParser.new(@config)
|
123
|
-
|
123
|
+
|
124
124
|
assert_equal(expected, @parser.c_types)
|
125
125
|
end
|
126
|
-
|
127
|
-
|
128
|
-
@config.
|
129
|
-
@config.
|
130
|
-
@config.expect
|
126
|
+
|
127
|
+
it "be able to fetch helpers on my list" do
|
128
|
+
@config.expect :plugins, [] #not :array
|
129
|
+
@config.expect :treat_as, {}
|
130
|
+
@config.expect :load_unity_helper, ""
|
131
131
|
@parser = CMockUnityHelperParser.new(@config)
|
132
132
|
@parser.c_types = {
|
133
133
|
'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
|
@@ -135,89 +135,89 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
|
|
135
135
|
'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
|
136
136
|
'LONG_LONG' => "UNITY_TEST_ASSERT_EQUAL_LONG_LONG"
|
137
137
|
}
|
138
|
-
|
138
|
+
|
139
139
|
[["UINT8","UINT8"],
|
140
140
|
["UINT16*","UINT16_ARRAY"],
|
141
141
|
["const SPINACH","SPINACH"],
|
142
142
|
["LONG LONG","LONG_LONG"] ].each do |ctype, exptype|
|
143
|
-
assert_equal(["UNITY_TEST_ASSERT_EQUAL_#{exptype}",''], @parser.get_helper(ctype))
|
143
|
+
assert_equal(["UNITY_TEST_ASSERT_EQUAL_#{exptype}",''], @parser.get_helper(ctype))
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
|
148
|
-
@config.
|
149
|
-
@config.
|
150
|
-
@config.
|
147
|
+
it "return memory comparison when asked to fetch helper of types not on my list" do
|
148
|
+
@config.expect :plugins, [] #not :array
|
149
|
+
@config.expect :treat_as, {}
|
150
|
+
@config.expect :load_unity_helper, ""
|
151
151
|
@parser = CMockUnityHelperParser.new(@config)
|
152
152
|
@parser.c_types = {
|
153
153
|
'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
|
154
154
|
'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",
|
155
155
|
'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
|
156
156
|
}
|
157
|
-
|
157
|
+
|
158
158
|
["UINT32","SPINACH_T","SALAD","PINEAPPLE"].each do |ctype|
|
159
|
-
@config.expect
|
160
|
-
assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY",'&'], @parser.get_helper(ctype))
|
159
|
+
@config.expect :memcmp_if_unknown, true
|
160
|
+
assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY",'&'], @parser.get_helper(ctype))
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
-
|
165
|
-
@config.
|
166
|
-
@config.
|
167
|
-
@config.
|
164
|
+
it "return memory array comparison when asked to fetch helper of types not on my list" do
|
165
|
+
@config.expect :plugins, [:array]
|
166
|
+
@config.expect :treat_as, {}
|
167
|
+
@config.expect :load_unity_helper, ""
|
168
168
|
@parser = CMockUnityHelperParser.new(@config)
|
169
169
|
@parser.c_types = {
|
170
170
|
'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
|
171
171
|
'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",
|
172
172
|
'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
|
173
173
|
}
|
174
|
-
|
174
|
+
|
175
175
|
["UINT32*","SPINACH_T*"].each do |ctype|
|
176
|
-
@config.expect
|
177
|
-
assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY",''], @parser.get_helper(ctype))
|
176
|
+
@config.expect :memcmp_if_unknown, true
|
177
|
+
assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY",''], @parser.get_helper(ctype))
|
178
178
|
end
|
179
179
|
end
|
180
|
-
|
181
|
-
|
182
|
-
@config.
|
183
|
-
@config.
|
184
|
-
@config.expect
|
180
|
+
|
181
|
+
it "return the array handler if we cannot find the normal handler" do
|
182
|
+
@config.expect :plugins, [] #not :array
|
183
|
+
@config.expect :treat_as, {}
|
184
|
+
@config.expect :load_unity_helper, ""
|
185
185
|
@parser = CMockUnityHelperParser.new(@config)
|
186
186
|
@parser.c_types = {
|
187
187
|
'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
|
188
188
|
'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",
|
189
189
|
'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
|
190
190
|
}
|
191
|
-
|
192
|
-
assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",'&'], @parser.get_helper("UINT16"))
|
191
|
+
|
192
|
+
assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",'&'], @parser.get_helper("UINT16"))
|
193
193
|
end
|
194
|
-
|
195
|
-
|
196
|
-
@config.
|
197
|
-
@config.
|
198
|
-
@config.expect
|
194
|
+
|
195
|
+
it "return the normal handler if we cannot find the array handler" do
|
196
|
+
@config.expect :plugins, [] #not :array
|
197
|
+
@config.expect :treat_as, {}
|
198
|
+
@config.expect :load_unity_helper, ""
|
199
199
|
@parser = CMockUnityHelperParser.new(@config)
|
200
200
|
@parser.c_types = {
|
201
201
|
'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
|
202
202
|
'UINT16' => "UNITY_TEST_ASSERT_EQUAL_UINT16",
|
203
203
|
'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
|
204
204
|
}
|
205
|
-
|
206
|
-
assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT8",'*'], @parser.get_helper("UINT8*"))
|
205
|
+
|
206
|
+
assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT8",'*'], @parser.get_helper("UINT8*"))
|
207
207
|
end
|
208
|
-
|
209
|
-
|
210
|
-
@config.
|
211
|
-
@config.
|
212
|
-
@config.expect
|
213
|
-
@config.expect
|
208
|
+
|
209
|
+
it "raise error when asked to fetch helper of type not on my list and not allowed to mem check" do
|
210
|
+
@config.expect :plugins, [] #not :array
|
211
|
+
@config.expect :treat_as, {}
|
212
|
+
@config.expect :load_unity_helper, ""
|
213
|
+
@config.expect :memcmp_if_unknown, false
|
214
214
|
@parser = CMockUnityHelperParser.new(@config)
|
215
215
|
@parser.c_types = {
|
216
216
|
'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
|
217
217
|
'UINT32*' => "UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY",
|
218
218
|
'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
|
219
219
|
}
|
220
|
-
|
221
|
-
|
220
|
+
|
221
|
+
assert_raises (RuntimeError) { @parser.get_helper("UINT16") }
|
222
222
|
end
|
223
223
|
end
|
@@ -17,6 +17,7 @@ class UnityTestRunnerGenerator
|
|
17
17
|
when Hash then @options.merge!(options)
|
18
18
|
else raise "If you specify arguments, it should be a filename or a hash of options"
|
19
19
|
end
|
20
|
+
require "#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer"
|
20
21
|
end
|
21
22
|
|
22
23
|
def self.default_options
|
@@ -190,7 +191,7 @@ class UnityTestRunnerGenerator
|
|
190
191
|
output.puts(" GlobalOrderError = NULL;")
|
191
192
|
end
|
192
193
|
mocks.each do |mock|
|
193
|
-
mock_clean =
|
194
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
194
195
|
output.puts(" #{mock_clean}_Init();")
|
195
196
|
end
|
196
197
|
output.puts("}\n")
|
@@ -198,7 +199,7 @@ class UnityTestRunnerGenerator
|
|
198
199
|
output.puts("static void CMock_Verify(void)")
|
199
200
|
output.puts("{")
|
200
201
|
mocks.each do |mock|
|
201
|
-
mock_clean =
|
202
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
202
203
|
output.puts(" #{mock_clean}_Verify();")
|
203
204
|
end
|
204
205
|
output.puts("}\n")
|
@@ -206,7 +207,7 @@ class UnityTestRunnerGenerator
|
|
206
207
|
output.puts("static void CMock_Destroy(void)")
|
207
208
|
output.puts("{")
|
208
209
|
mocks.each do |mock|
|
209
|
-
mock_clean =
|
210
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
210
211
|
output.puts(" #{mock_clean}_Destroy();")
|
211
212
|
end
|
212
213
|
output.puts("}\n")
|