c_project 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +18 -0
- data/bin/c_project +77 -0
- data/c_project.gemspec +25 -0
- data/lib/c_project/version.rb +3 -0
- data/lib/c_project.rb +5 -0
- data/templates/LICENCE.tt +23 -0
- data/templates/Makefile.tt +74 -0
- data/templates/README.md.tt +15 -0
- data/templates/src/CExceptionConfig.h.tt +8 -0
- data/templates/src/c_project.c.tt +16 -0
- data/templates/src/c_project.h.tt +8 -0
- data/templates/src/main.c.tt +15 -0
- data/templates/test/support/test_helper.c.tt +2 -0
- data/templates/test/support/test_helper.h.tt +13 -0
- data/templates/test/test_c_project.c.tt +41 -0
- data/templates/vendor/cexception/docs/license.txt +30 -0
- data/templates/vendor/cexception/docs/readme.txt +242 -0
- data/templates/vendor/cexception/lib/CException.c +43 -0
- data/templates/vendor/cexception/lib/CException.h +86 -0
- data/templates/vendor/cexception/release/build.info +2 -0
- data/templates/vendor/cexception/release/version.info +2 -0
- data/templates/vendor/commander.c/History.md +27 -0
- data/templates/vendor/commander.c/Makefile +8 -0
- data/templates/vendor/commander.c/Readme.md +103 -0
- data/templates/vendor/commander.c/package.json +9 -0
- data/templates/vendor/commander.c/src/commander.c +250 -0
- data/templates/vendor/commander.c/src/commander.h +88 -0
- data/templates/vendor/commander.c/test.c +34 -0
- data/templates/vendor/unity/.gitignore +1 -0
- data/templates/vendor/unity/auto/colour_prompt.rb +94 -0
- data/templates/vendor/unity/auto/colour_reporter.rb +39 -0
- data/templates/vendor/unity/auto/generate_config.yml +36 -0
- data/templates/vendor/unity/auto/generate_module.rb +202 -0
- data/templates/vendor/unity/auto/generate_test_runner.rb +316 -0
- data/templates/vendor/unity/auto/test_file_filter.rb +23 -0
- data/templates/vendor/unity/auto/unity_test_summary.rb +139 -0
- data/templates/vendor/unity/docs/Unity Summary.txt +216 -0
- data/templates/vendor/unity/docs/license.txt +31 -0
- data/templates/vendor/unity/release/build.info +2 -0
- data/templates/vendor/unity/release/version.info +2 -0
- data/templates/vendor/unity/src/unity.c +1146 -0
- data/templates/vendor/unity/src/unity.h +245 -0
- data/templates/vendor/unity/src/unity_internals.h +546 -0
- metadata +135 -0
@@ -0,0 +1,216 @@
|
|
1
|
+
==============
|
2
|
+
Unity Test API
|
3
|
+
==============
|
4
|
+
|
5
|
+
[Copyright (c) 2007 - 2012 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams]
|
6
|
+
|
7
|
+
-------------
|
8
|
+
Running Tests
|
9
|
+
-------------
|
10
|
+
|
11
|
+
RUN_TEST(func, linenum)
|
12
|
+
|
13
|
+
Each Test is run within the macro RUN_TEST. This macro performs necessary setup before the test is called and handles cleanup and result tabulation afterwards.
|
14
|
+
|
15
|
+
--------------
|
16
|
+
Ignoring Tests
|
17
|
+
--------------
|
18
|
+
|
19
|
+
There are times when a test is incomplete or not valid for some reason. At these times, TEST_IGNORE can be called. Control will immediately be returned to the caller of the test, and no failures will be returned.
|
20
|
+
|
21
|
+
TEST_IGNORE()
|
22
|
+
|
23
|
+
Ignore this test and return immediately
|
24
|
+
|
25
|
+
TEST_IGNORE_MESSAGE (message)
|
26
|
+
|
27
|
+
Ignore this test and return immediately. Output a message stating why the test was ignored.
|
28
|
+
|
29
|
+
--------------
|
30
|
+
Aborting Tests
|
31
|
+
--------------
|
32
|
+
|
33
|
+
There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first (TEST_PROTECT) sets up the feature, and handles emergency abort cases. TEST_ABORT can then be used at any time within the tests to return to the last TEST_PROTECT call.
|
34
|
+
|
35
|
+
TEST_PROTECT()
|
36
|
+
|
37
|
+
Setup and Catch macro
|
38
|
+
|
39
|
+
TEST_ABORT()
|
40
|
+
|
41
|
+
Abort Test macro
|
42
|
+
|
43
|
+
Example:
|
44
|
+
|
45
|
+
main()
|
46
|
+
{
|
47
|
+
if (TEST_PROTECT() == 0)
|
48
|
+
{
|
49
|
+
MyTest();
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
If MyTest calls TEST_ABORT, program control will immediately return to TEST_PROTECT with a non-zero return value.
|
54
|
+
|
55
|
+
|
56
|
+
=======================
|
57
|
+
Unity Assertion Summary
|
58
|
+
=======================
|
59
|
+
|
60
|
+
--------------------
|
61
|
+
Basic Validity Tests
|
62
|
+
--------------------
|
63
|
+
|
64
|
+
TEST_ASSERT_TRUE(condition)
|
65
|
+
|
66
|
+
Evaluates whatever code is in condition and fails if it evaluates to false
|
67
|
+
|
68
|
+
TEST_ASSERT_FALSE(condition)
|
69
|
+
|
70
|
+
Evaluates whatever code is in condition and fails if it evaluates to true
|
71
|
+
|
72
|
+
TEST_ASSERT(condition)
|
73
|
+
|
74
|
+
Another way of calling TEST_ASSERT_TRUE
|
75
|
+
|
76
|
+
TEST_ASSERT_UNLESS(condition)
|
77
|
+
|
78
|
+
Another way of calling TEST_ASSERT_FALSE
|
79
|
+
|
80
|
+
TEST_FAIL()
|
81
|
+
TEST_FAIL_MESSAGE(message)
|
82
|
+
|
83
|
+
This test is automatically marked as a failure. The message is output stating why.
|
84
|
+
|
85
|
+
------------------------------
|
86
|
+
Numerical Assertions: Integers
|
87
|
+
------------------------------
|
88
|
+
|
89
|
+
TEST_ASSERT_EQUAL_INT(expected, actual)
|
90
|
+
TEST_ASSERT_EQUAL_INT8(expected, actual)
|
91
|
+
TEST_ASSERT_EQUAL_INT16(expected, actual)
|
92
|
+
TEST_ASSERT_EQUAL_INT32(expected, actual)
|
93
|
+
TEST_ASSERT_EQUAL_INT64(expected, actual)
|
94
|
+
|
95
|
+
Compare two integers for equality and display errors as signed integers. A cast will be performed
|
96
|
+
to your natural integer size so often this can just be used. When you need to specify the exact size,
|
97
|
+
like when comparing arrays, you can use a specific version:
|
98
|
+
|
99
|
+
TEST_ASSERT_EQUAL_UINT(expected, actual)
|
100
|
+
TEST_ASSERT_EQUAL_UINT8(expected, actual)
|
101
|
+
TEST_ASSERT_EQUAL_UINT16(expected, actual)
|
102
|
+
TEST_ASSERT_EQUAL_UINT32(expected, actual)
|
103
|
+
TEST_ASSERT_EQUAL_UINT64(expected, actual)
|
104
|
+
|
105
|
+
Compare two integers for equality and display errors as unsigned integers. Like INT, there are
|
106
|
+
variants for different sizes also.
|
107
|
+
|
108
|
+
TEST_ASSERT_EQUAL_HEX(expected, actual)
|
109
|
+
TEST_ASSERT_EQUAL_HEX8(expected, actual)
|
110
|
+
TEST_ASSERT_EQUAL_HEX16(expected, actual)
|
111
|
+
TEST_ASSERT_EQUAL_HEX32(expected, actual)
|
112
|
+
TEST_ASSERT_EQUAL_HEX64(expected, actual)
|
113
|
+
|
114
|
+
Compares two integers for equality and display errors as hexadecimal. Like the other integer comparisons,
|
115
|
+
you can specify the size... here the size will also effect how many nibbles are shown (for example, HEX16
|
116
|
+
will show 4 nibbles).
|
117
|
+
|
118
|
+
_ARRAY
|
119
|
+
|
120
|
+
You can append _ARRAY to any of these macros to make an array comparison of that type. Here you will
|
121
|
+
need to care a bit more about the actual size of the value being checked. You will also specify an
|
122
|
+
additional argument which is the number of elements to compare. For example:
|
123
|
+
|
124
|
+
TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements)
|
125
|
+
|
126
|
+
TEST_ASSERT_EQUAL(expected, actual)
|
127
|
+
|
128
|
+
Another way of calling TEST_ASSERT_EQUAL_INT
|
129
|
+
|
130
|
+
TEST_ASSERT_INT_WITHIN(delta, expected, actual)
|
131
|
+
|
132
|
+
Asserts that the actual value is within plus or minus delta of the expected value. This also comes in
|
133
|
+
size specific variants.
|
134
|
+
|
135
|
+
|
136
|
+
-----------------------------
|
137
|
+
Numerical Assertions: Bitwise
|
138
|
+
-----------------------------
|
139
|
+
|
140
|
+
TEST_ASSERT_BITS(mask, expected, actual)
|
141
|
+
|
142
|
+
Use an integer mask to specify which bits should be compared between two other integers. High bits in the mask are compared, low bits ignored.
|
143
|
+
|
144
|
+
TEST_ASSERT_BITS_HIGH(mask, actual)
|
145
|
+
|
146
|
+
Use an integer mask to specify which bits should be inspected to determine if they are all set high. High bits in the mask are compared, low bits ignored.
|
147
|
+
|
148
|
+
TEST_ASSERT_BITS_LOW(mask, actual)
|
149
|
+
|
150
|
+
Use an integer mask to specify which bits should be inspected to determine if they are all set low. High bits in the mask are compared, low bits ignored.
|
151
|
+
|
152
|
+
TEST_ASSERT_BIT_HIGH(bit, actual)
|
153
|
+
|
154
|
+
Test a single bit and verify that it is high. The bit is specified 0-31 for a 32-bit integer.
|
155
|
+
|
156
|
+
TEST_ASSERT_BIT_LOW(bit, actual)
|
157
|
+
|
158
|
+
Test a single bit and verify that it is low. The bit is specified 0-31 for a 32-bit integer.
|
159
|
+
|
160
|
+
----------------------------
|
161
|
+
Numerical Assertions: Floats
|
162
|
+
----------------------------
|
163
|
+
|
164
|
+
TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual)
|
165
|
+
|
166
|
+
Asserts that the actual value is within plus or minus delta of the expected value.
|
167
|
+
|
168
|
+
TEST_ASSERT_EQUAL_FLOAT(expected, actual)
|
169
|
+
TEST_ASSERT_EQUAL_DOUBLE(expected, actual)
|
170
|
+
|
171
|
+
Asserts that two floating point values are "equal" within a small % delta of the expected value.
|
172
|
+
|
173
|
+
-----------------
|
174
|
+
String Assertions
|
175
|
+
-----------------
|
176
|
+
|
177
|
+
TEST_ASSERT_EQUAL_STRING(expected, actual)
|
178
|
+
|
179
|
+
Compare two null-terminate strings. Fail if any character is different or if the lengths are different.
|
180
|
+
|
181
|
+
TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message)
|
182
|
+
|
183
|
+
Compare two null-terminate strings. Fail if any character is different or if the lengths are different. Output a custom message on failure.
|
184
|
+
|
185
|
+
------------------
|
186
|
+
Pointer Assertions
|
187
|
+
------------------
|
188
|
+
|
189
|
+
Most pointer operations can be performed by simply using the integer comparisons above. However, a couple of special cases are added for clarity.
|
190
|
+
|
191
|
+
TEST_ASSERT_NULL(pointer)
|
192
|
+
|
193
|
+
Fails if the pointer is not equal to NULL
|
194
|
+
|
195
|
+
TEST_ASSERT_NOT_NULL(pointer)
|
196
|
+
|
197
|
+
Fails if the pointer is equal to NULL
|
198
|
+
|
199
|
+
|
200
|
+
-----------------
|
201
|
+
Memory Assertions
|
202
|
+
-----------------
|
203
|
+
|
204
|
+
TEST_ASSERT_EQUAL_MEMORY(expected, actual, len)
|
205
|
+
|
206
|
+
Compare two blocks of memory. This is a good generic assertion for types that can't be coerced into acting like
|
207
|
+
standard types... but since it's a memory compare, you have to be careful that your data types are packed.
|
208
|
+
|
209
|
+
--------
|
210
|
+
_MESSAGE
|
211
|
+
--------
|
212
|
+
|
213
|
+
you can append _MESSAGE to any of the macros to make them take an additional argument. This argument
|
214
|
+
is a string that will be printed at the end of the failure strings. This is useful for specifying more
|
215
|
+
information about the problem.
|
216
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
The end-user documentation included with the redistribution, if
|
16
|
+
any, must include the following acknowledgment: "This product
|
17
|
+
includes software developed for the Unity Project, by Mike Karlesky,
|
18
|
+
Mark VanderVoord, and Greg Williams and other contributors", in
|
19
|
+
the same place and form as other third-party acknowledgments.
|
20
|
+
Alternately, this acknowledgment may appear in the software
|
21
|
+
itself, in the same form and location as other such third-party
|
22
|
+
acknowledgments.
|
23
|
+
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
25
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
26
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
27
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
28
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
29
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
30
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
31
|
+
OTHER DEALINGS IN THE SOFTWARE.
|