ceedling 0.31.0 → 0.31.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/assets/example_file_call.c +6 -0
  3. data/assets/example_file_call.h +6 -0
  4. data/assets/test_example_file_with_mock.c +13 -0
  5. data/bin/ceedling +2 -2
  6. data/ceedling.gemspec +1 -1
  7. data/lib/ceedling/configurator.rb +7 -2
  8. data/lib/ceedling/configurator_plugins.rb +21 -1
  9. data/lib/ceedling/defaults.rb +1 -0
  10. data/lib/ceedling/preprocessinator_extractor.rb +2 -0
  11. data/lib/ceedling/preprocessinator_includes_handler.rb +24 -24
  12. data/lib/ceedling/version.rb +11 -7
  13. data/plugins/gcov/config/defaults_gcov.rb +118 -0
  14. data/plugins/gcov/lib/gcovr_reportinator.rb +1 -1
  15. data/plugins/gcov/lib/reportgenerator_reportinator.rb +1 -1
  16. data/plugins/junit_tests_report/lib/junit_tests_report.rb +6 -6
  17. data/plugins/module_generator/README.md +16 -2
  18. data/plugins/module_generator/lib/module_generator.rb +1 -0
  19. data/spec/gcov/gcov_deployment_spec.rb +1 -1
  20. data/spec/preprocessinator_includes_handler_spec.rb +38 -8
  21. data/spec/spec_system_helper.rb +19 -0
  22. data/spec/system/deployment_spec.rb +1 -0
  23. data/vendor/cmock/lib/cmock_file_writer.rb +2 -3
  24. data/vendor/cmock/lib/cmock_generator.rb +87 -70
  25. data/vendor/cmock/lib/cmock_header_parser.rb +29 -27
  26. data/vendor/cmock/src/cmock.h +1 -1
  27. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +46 -41
  28. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +46 -40
  29. data/vendor/cmock/vendor/c_exception/README.md +6 -4
  30. data/vendor/cmock/vendor/c_exception/docs/CException.md +2 -2
  31. data/vendor/cmock/vendor/c_exception/lib/CException.h +1 -1
  32. data/vendor/cmock/vendor/c_exception/lib/meson.build +2 -2
  33. data/vendor/cmock/vendor/c_exception/meson.build +36 -2
  34. data/vendor/cmock/vendor/unity/README.md +77 -71
  35. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +1 -1
  36. data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +107 -126
  37. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +149 -193
  38. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +236 -294
  39. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +112 -121
  40. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +82 -115
  41. data/vendor/cmock/vendor/unity/extras/fixture/readme.md +16 -19
  42. data/vendor/cmock/vendor/unity/extras/memory/readme.md +27 -34
  43. data/vendor/cmock/vendor/unity/src/unity.c +1 -1
  44. data/vendor/cmock/vendor/unity/src/unity.h +1 -1
  45. data/vendor/cmock/vendor/unity/src/unity_internals.h +21 -7
  46. data/vendor/unity/README.md +77 -71
  47. data/vendor/unity/auto/generate_test_runner.rb +1 -1
  48. data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +107 -126
  49. data/vendor/unity/docs/UnityAssertionsReference.md +149 -193
  50. data/vendor/unity/docs/UnityConfigurationGuide.md +236 -294
  51. data/vendor/unity/docs/UnityGettingStartedGuide.md +112 -121
  52. data/vendor/unity/docs/UnityHelperScriptsGuide.md +82 -115
  53. data/vendor/unity/extras/fixture/readme.md +16 -19
  54. data/vendor/unity/extras/memory/readme.md +27 -34
  55. data/vendor/unity/src/unity.c +1 -1
  56. data/vendor/unity/src/unity.h +1 -1
  57. data/vendor/unity/src/unity_internals.h +21 -7
  58. metadata +14 -5
  59. data/plugins/gcov/config/defaults.yml +0 -55
@@ -143,7 +143,7 @@ class UnityTestRunnerGenerator
143
143
  arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) { |a| args << a[0] }
144
144
 
145
145
  arguments.scan(/\s*TEST_RANGE\s*\((.*)\)\s*$/).flatten.each do |range_str|
146
- args += range_str.scan(/\[(-?\d+.?\d*), *(-?\d+.?\d*), *(-?\d+.?\d*)\]/).map do |arg_values_str|
146
+ args += range_str.scan(/\[\s*(-?\d+.?\d*),\s*(-?\d+.?\d*),\s*(-?\d+.?\d*)\s*\]/).map do |arg_values_str|
147
147
  arg_values_str.map do |arg_value_str|
148
148
  arg_value_str.include?('.') ? arg_value_str.to_f : arg_value_str.to_i
149
149
  end
@@ -1,136 +1,116 @@
1
1
  # ThrowTheSwitch.org Coding Standard
2
2
 
3
- Hi. Welcome to the coding standard for ThrowTheSwitch.org. For the most part,
4
- we try to follow these standards to unify our contributors' code into a cohesive
5
- unit (puns intended). You might find places where these standards aren't
6
- followed. We're not perfect. Please be polite where you notice these discrepancies
7
- and we'll try to be polite when we notice yours.
3
+ Hi.
4
+ Welcome to the coding standard for ThrowTheSwitch.org.
5
+ For the most part, we try to follow these standards to unify our contributors' code into a cohesive unit (puns intended).
6
+ You might find places where these standards aren't followed.
7
+ We're not perfect. Please be polite where you notice these discrepancies and we'll try to be polite when we notice yours.
8
8
 
9
9
  ;)
10
10
 
11
-
12
11
  ## Why Have A Coding Standard?
13
12
 
14
- Being consistent makes code easier to understand. We've tried to keep
15
- our standard simple because we also believe that we can only expect someone to
16
- follow something that is understandable. Please do your best.
17
-
13
+ Being consistent makes code easier to understand.
14
+ We've tried to keep our standard simple because we also believe that we can only expect someone to follow something that is understandable.
15
+ Please do your best.
18
16
 
19
17
  ## Our Philosophy
20
18
 
21
- Before we get into details on syntax, let's take a moment to talk about our
22
- vision for these tools. We're C developers and embedded software developers.
23
- These tools are great to test any C code, but catering to embedded software has
24
- made us more tolerant of compiler quirks. There are a LOT of quirky compilers
25
- out there. By quirky I mean "doesn't follow standards because they feel like
26
- they have a license to do as they wish."
27
-
28
- Our philosophy is "support every compiler we can". Most often, this means that
29
- we aim for writing C code that is standards compliant (often C89... that seems
30
- to be a sweet spot that is almost always compatible). But it also means these
31
- tools are tolerant of things that aren't common. Some that aren't even
32
- compliant. There are configuration options to override the size of standard
33
- types. There are configuration options to force Unity to not use certain
34
- standard library functions. A lot of Unity is configurable and we have worked
35
- hard to make it not TOO ugly in the process.
36
-
37
- Similarly, our tools that parse C do their best. They aren't full C parsers
38
- (yet) and, even if they were, they would still have to accept non-standard
39
- additions like gcc extensions or specifying `@0x1000` to force a variable to
40
- compile to a particular location. It's just what we do, because we like
41
- everything to Just Work™.
42
-
43
- Speaking of having things Just Work™, that's our second philosophy. By that, we
44
- mean that we do our best to have EVERY configuration option have a logical
45
- default. We believe that if you're working with a simple compiler and target,
46
- you shouldn't need to configure very much... we try to make the tools guess as
47
- much as they can, but give the user the power to override it when it's wrong.
19
+ Before we get into details on syntax, let's take a moment to talk about our vision for these tools.
20
+ We're C developers and embedded software developers.
21
+ These tools are great to test any C code, but catering to embedded software made us more tolerant of compiler quirks.
22
+ There are a LOT of quirky compilers out there.
23
+ By quirky I mean "doesn't follow standards because they feel like they have a license to do as they wish."
24
+
25
+ Our philosophy is "support every compiler we can".
26
+ Most often, this means that we aim for writing C code that is standards compliant (often C89... that seems to be a sweet spot that is almost always compatible).
27
+ But it also means these tools are tolerant of things that aren't common.
28
+ Some that aren't even compliant.
29
+ There are configuration options to override the size of standard types.
30
+ There are configuration options to force Unity to not use certain standard library functions.
31
+ A lot of Unity is configurable and we have worked hard to make it not TOO ugly in the process.
48
32
 
33
+ Similarly, our tools that parse C do their best.
34
+ They aren't full C parsers (yet) and, even if they were, they would still have to accept non-standard additions like gcc extensions or specifying `@0x1000` to force a variable to compile to a particular location.
35
+ It's just what we do, because we like everything to Just Work™.
36
+
37
+ Speaking of having things Just Work™, that's our second philosophy.
38
+ By that, we mean that we do our best to have EVERY configuration option have a logical default.
39
+ We believe that if you're working with a simple compiler and target, you shouldn't need to configure very much... we try to make the tools guess as much as they can, but give the user the power to override it when it's wrong.
49
40
 
50
41
  ## Naming Things
51
42
 
52
- Let's talk about naming things. Programming is all about naming things. We name
53
- files, functions, variables, and so much more. While we're not always going to
54
- find the best name for something, we actually put a bit of effort into
55
- finding *What Something WANTS to be Called*™.
43
+ Let's talk about naming things.
44
+ Programming is all about naming things.
45
+ We name files, functions, variables, and so much more.
46
+ While we're not always going to find the best name for something, we actually put a bit of effort into finding *What Something WANTS to be Called*™.
47
+
48
+ When naming things, we follow this hierarchy, the first being the most important to us (but we do all four when possible):
56
49
 
57
- When naming things, we follow this hierarchy, the first being the
58
- most important to us (but we do all four when possible):
59
50
  1. Readable
60
51
  2. Descriptive
61
52
  3. Consistent
62
53
  4. Memorable
63
54
 
55
+ ### Readable
64
56
 
65
- #### Readable
57
+ We want to read our code.
58
+ This means we like names and flow that are more naturally read.
59
+ We try to avoid double negatives.
60
+ We try to avoid cryptic abbreviations (sticking to ones we feel are common).
66
61
 
67
- We want to read our code. This means we like names and flow that are more
68
- naturally read. We try to avoid double negatives. We try to avoid cryptic
69
- abbreviations (sticking to ones we feel are common).
70
-
71
-
72
- #### Descriptive
62
+ ### Descriptive
73
63
 
74
64
  We like descriptive names for things, especially functions and variables.
75
- Finding the right name for something is an important endeavor. You might notice
76
- from poking around our code that this often results in names that are a little
77
- longer than the average. Guilty. We're okay with a bit more typing if it
78
- means our code is easier to understand.
79
-
80
- There are two exceptions to this rule that we also stick to as religiously as
81
- possible:
82
-
83
- First, while we realize hungarian notation (and similar systems for encoding
84
- type information into variable names) is providing a more descriptive name, we
85
- feel that (for the average developer) it takes away from readability and is to be avoided.
65
+ Finding the right name for something is an important endeavour.
66
+ You might notice from poking around our code that this often results in names that are a little longer than the average.
67
+ Guilty.
68
+ We're okay with a bit more typing if it means our code is easier to understand.
86
69
 
87
- Second, loop counters and other local throw-away variables often have a purpose
88
- which is obvious. There's no need, therefore, to get carried away with complex
89
- naming. We find i, j, and k are better loop counters than loopCounterVar or
90
- whatnot. We only break this rule when we see that more description could improve
91
- understanding of an algorithm.
70
+ There are two exceptions to this rule that we also stick to as religiously as possible:
92
71
 
72
+ First, while we realize hungarian notation (and similar systems for encoding type information into variable names) is providing a more descriptive name, we feel that (for the average developer) it takes away from readability and is to be avoided.
93
73
 
94
- #### Consistent
74
+ Second, loop counters and other local throw-away variables often have a purpose which is obvious.
75
+ There's no need, therefore, to get carried away with complex naming.
76
+ We find i, j, and k are better loop counters than loopCounterVar or whatnot.
77
+ We only break this rule when we see that more description could improve understanding of an algorithm.
95
78
 
96
- We like consistency, but we're not really obsessed with it. We try to name our
97
- configuration macros in a consistent fashion... you'll notice a repeated use of
98
- UNITY_EXCLUDE_BLAH or UNITY_USES_BLAH macros. This helps users avoid having to
99
- remember each macro's details.
79
+ ### Consistent
100
80
 
81
+ We like consistency, but we're not really obsessed with it.
82
+ We try to name our configuration macros in a consistent fashion... you'll notice a repeated use of UNITY_EXCLUDE_BLAH or UNITY_USES_BLAH macros.
83
+ This helps users avoid having to remember each macro's details.
101
84
 
102
- #### Memorable
103
-
104
- Where ever it doesn't violate the above principles, we try to apply memorable
105
- names. Sometimes this means using something that is simply descriptive, but
106
- often we strive for descriptive AND unique... we like quirky names that stand
107
- out in our memory and are easier to search for. Take a look through the file
108
- names in Ceedling and you'll get a good idea of what we are talking about here.
109
- Why use preprocess when you can use preprocessinator? Or what better describes a
110
- module in charge of invoking tasks during releases than release_invoker? Don't
111
- get carried away. The names are still descriptive and fulfill the above
112
- requirements, but they don't feel stale.
85
+ ### Memorable
113
86
 
87
+ Where ever it doesn't violate the above principles, we try to apply memorable names.
88
+ Sometimes this means using something that is simply descriptive, but often we strive for descriptive AND unique... we like quirky names that stand out in our memory and are easier to search for.
89
+ Take a look through the file names in Ceedling and you'll get a good idea of what we are talking about here.
90
+ Why use preprocess when you can use preprocessinator?
91
+ Or what better describes a module in charge of invoking tasks during releases than release_invoker?
92
+ Don't get carried away.
93
+ The names are still descriptive and fulfil the above requirements, but they don't feel stale.
114
94
 
115
95
  ## C and C++ Details
116
96
 
117
- We don't really want to add to the style battles out there. Tabs or spaces?
118
- How many spaces? Where do the braces go? These are age-old questions that will
119
- never be answered... or at least not answered in a way that will make everyone
120
- happy.
121
-
122
- We've decided on our own style preferences. If you'd like to contribute to these
123
- projects (and we hope that you do), then we ask if you do your best to follow
124
- the same. It will only hurt a little. We promise.
97
+ We don't really want to add to the style battles out there.
98
+ Tabs or spaces?
99
+ How many spaces?
100
+ Where do the braces go?
101
+ These are age-old questions that will never be answered... or at least not answered in a way that will make everyone happy.
125
102
 
103
+ We've decided on our own style preferences.
104
+ If you'd like to contribute to these projects (and we hope that you do), then we ask if you do your best to follow the same.
105
+ It will only hurt a little. We promise.
126
106
 
127
- #### Whitespace
107
+ ### Whitespace in C/C++
128
108
 
129
- Our C-style is to use spaces and to use 4 of them per indent level. It's a nice
130
- power-of-2 number that looks decent on a wide-screen. We have no more reason
131
- than that. We break that rule when we have lines that wrap (macros or function
132
- arguments or whatnot). When that happens, we like to indent further to line
133
- things up in nice tidy columns.
109
+ Our C-style is to use spaces and to use 4 of them per indent level.
110
+ It's a nice power-of-2 number that looks decent on a wide-screen.
111
+ We have no more reason than that.
112
+ We break that rule when we have lines that wrap (macros or function arguments or whatnot).
113
+ When that happens, we like to indent further to line things up in nice tidy columns.
134
114
 
135
115
  ```C
136
116
  if (stuff_happened)
@@ -139,8 +119,7 @@ things up in nice tidy columns.
139
119
  }
140
120
  ```
141
121
 
142
-
143
- #### Case
122
+ ### Case in C/C++
144
123
 
145
124
  - Files - all lower case with underscores.
146
125
  - Variables - all lower case with underscores
@@ -149,12 +128,12 @@ things up in nice tidy columns.
149
128
  - Functions - camel cased. Usually named ModuleName_FuncName
150
129
  - Constants and Globals - camel cased.
151
130
 
131
+ ### Braces in C/C++
152
132
 
153
- #### Braces
154
-
155
- The left brace is on the next line after the declaration. The right brace is
156
- directly below that. Everything in between in indented one level. If you're
157
- catching an error and you have a one-line, go ahead and to it on the same line.
133
+ The left brace is on the next line after the declaration.
134
+ The right brace is directly below that.
135
+ Everything in between in indented one level.
136
+ If you're catching an error and you have a one-line, go ahead and to it on the same line.
158
137
 
159
138
  ```C
160
139
  while (blah)
@@ -163,32 +142,32 @@ catching an error and you have a one-line, go ahead and to it on the same line.
163
142
  }
164
143
  ```
165
144
 
145
+ ### Comments in C/C++
166
146
 
167
- #### Comments
168
-
169
- Do you know what we hate? Old-school C block comments. BUT, we're using them
170
- anyway. As we mentioned, our goal is to support every compiler we can,
171
- especially embedded compilers. There are STILL C compilers out there that only
172
- support old-school block comments. So that is what we're using. We apologize. We
173
- think they are ugly too.
174
-
147
+ Do you know what we hate?
148
+ Old-school C block comments.
149
+ BUT, we're using them anyway.
150
+ As we mentioned, our goal is to support every compiler we can, especially embedded compilers.
151
+ There are STILL C compilers out there that only support old-school block comments.
152
+ So that is what we're using.
153
+ We apologize.
154
+ We think they are ugly too.
175
155
 
176
156
  ## Ruby Details
177
157
 
178
- Is there really such thing as a Ruby coding standard? Ruby is such a free form
179
- language, it seems almost sacrilegious to suggest that people should comply to
180
- one method! We'll keep it really brief!
181
-
158
+ Is there really such thing as a Ruby coding standard?
159
+ Ruby is such a free form language, it seems almost sacrilegious to suggest that people should comply to one method!
160
+ We'll keep it really brief!
182
161
 
183
- #### Whitespace
162
+ ### Whitespace in Ruby
184
163
 
185
- Our Ruby style is to use spaces and to use 2 of them per indent level. It's a
186
- nice power-of-2 number that really grooves with Ruby's compact style. We have no
187
- more reason than that. We break that rule when we have lines that wrap. When
188
- that happens, we like to indent further to line things up in nice tidy columns.
164
+ Our Ruby style is to use spaces and to use 2 of them per indent level.
165
+ It's a nice power-of-2 number that really grooves with Ruby's compact style.
166
+ We have no more reason than that.
167
+ We break that rule when we have lines that wrap.
168
+ When that happens, we like to indent further to line things up in nice tidy columns.
189
169
 
190
-
191
- #### Case
170
+ ### Case in Ruby
192
171
 
193
172
  - Files - all lower case with underscores.
194
173
  - Variables - all lower case with underscores
@@ -196,11 +175,13 @@ that happens, we like to indent further to line things up in nice tidy columns.
196
175
  - Functions - all lower case with underscores
197
176
  - Constants - all upper case with underscores
198
177
 
199
-
200
178
  ## Documentation
201
179
 
202
- Egad. Really? We use mark down and we like pdf files because they can be made to
203
- look nice while still being portable. Good enough?
180
+ Egad.
181
+ Really?
182
+ We use markdown and we like PDF files because they can be made to look nice while still being portable.
183
+ Good enough?
204
184
 
185
+ *Find The Latest of This And More at [ThrowTheSwitch.org][]*
205
186
 
206
- *Find The Latest of This And More at [ThrowTheSwitch.org](https://throwtheswitch.org)*
187
+ [ThrowTheSwitch.org]: https://throwtheswitch.org
@@ -16,7 +16,6 @@ source code in, well, test code.
16
16
  - Document types, expected values, and basic behavior in your source code for
17
17
  free.
18
18
 
19
-
20
19
  ### Unity Is Several Things But Mainly It's Assertions
21
20
 
22
21
  One way to think of Unity is simply as a rich collection of assertions you can
@@ -24,7 +23,6 @@ use to establish whether your source code behaves the way you think it does.
24
23
  Unity provides a framework to easily organize and execute those assertions in
25
24
  test code separate from your source code.
26
25
 
27
-
28
26
  ### What's an Assertion?
29
27
 
30
28
  At their core, assertions are an establishment of truth - boolean truth. Was this
@@ -36,7 +34,7 @@ execution and reports an error through some appropriate I/O channel (e.g.
36
34
  stdout, GUI, file, blinky light).
37
35
 
38
36
  Fundamentally, for dynamic verification all you need is a single assertion
39
- mechanism. In fact, that's what the [assert() macro in C's standard library](http://en.wikipedia.org/en/wiki/Assert.h)
37
+ mechanism. In fact, that's what the [assert() macro][] in C's standard library
40
38
  is for. So why not just use it? Well, we can do far better in the reporting
41
39
  department. C's `assert()` is pretty dumb as-is and is particularly poor for
42
40
  handling common data types like arrays, structs, etc. And, without some other
@@ -44,7 +42,6 @@ support, it's far too tempting to litter source code with C's `assert()`'s. It's
44
42
  generally much cleaner, manageable, and more useful to separate test and source
45
43
  code in the way Unity facilitates.
46
44
 
47
-
48
45
  ### Unity's Assertions: Helpful Messages _and_ Free Source Code Documentation
49
46
 
50
47
  Asserting a simple truth condition is valuable, but using the context of the
@@ -60,34 +57,32 @@ tests pass, you have a detailed, up-to-date view of the intent and mechanisms in
60
57
  your source code. And due to a wondrous mystery, well-tested code usually tends
61
58
  to be well designed code.
62
59
 
63
-
64
60
  ## Assertion Conventions and Configurations
65
61
 
66
62
  ### Naming and Parameter Conventions
67
63
 
68
64
  The convention of assertion parameters generally follows this order:
69
65
 
70
- ```
66
+ ```c
71
67
  TEST_ASSERT_X( {modifiers}, {expected}, actual, {size/count} )
72
68
  ```
73
69
 
74
70
  The very simplest assertion possible uses only a single `actual` parameter (e.g.
75
71
  a simple null check).
76
72
 
77
- - `Actual` is the value being tested and unlike the other parameters in an
78
- assertion construction is the only parameter present in all assertion variants.
79
- - `Modifiers` are masks, ranges, bit flag specifiers, floating point deltas.
80
- - `Expected` is your expected value (duh) to compare to an `actual` value; it's
81
- marked as an optional parameter because some assertions only need a single
82
- `actual` parameter (e.g. null check).
83
- - `Size/count` refers to string lengths, number of array elements, etc.
73
+ - `Actual` is the value being tested and unlike the other parameters in an
74
+ assertion construction is the only parameter present in all assertion variants.
75
+ - `Modifiers` are masks, ranges, bit flag specifiers, floating point deltas.
76
+ - `Expected` is your expected value (duh) to compare to an `actual` value; it's
77
+ marked as an optional parameter because some assertions only need a single
78
+ `actual` parameter (e.g. null check).
79
+ - `Size/count` refers to string lengths, number of array elements, etc.
84
80
 
85
81
  Many of Unity's assertions are clear duplications in that the same data type
86
82
  is handled by several assertions. The differences among these are in how failure
87
83
  messages are presented. For instance, a `_HEX` variant of an assertion prints
88
84
  the expected and actual values of that assertion formatted as hexadecimal.
89
85
 
90
-
91
86
  #### TEST_ASSERT_X_MESSAGE Variants
92
87
 
93
88
  _All_ assertions are complemented with a variant that includes a simple string
@@ -100,17 +95,18 @@ the reference list below and add a string as the final parameter.
100
95
 
101
96
  _Example:_
102
97
 
103
- ```
98
+ ```c
104
99
  TEST_ASSERT_X( {modifiers}, {expected}, actual, {size/count} )
105
100
  ```
106
101
 
107
102
  becomes messageified like thus...
108
103
 
109
- ```
104
+ ```c
110
105
  TEST_ASSERT_X_MESSAGE( {modifiers}, {expected}, actual, {size/count}, message )
111
106
  ```
112
107
 
113
108
  Notes:
109
+
114
110
  - The `_MESSAGE` variants intentionally do not support `printf` style formatting
115
111
  since many embedded projects don't support or avoid `printf` for various reasons.
116
112
  It is possible to use `sprintf` before the assertion to assemble a complex fail
@@ -119,7 +115,6 @@ Notes:
119
115
  a loop) , building up an array of results and then using one of the `_ARRAY`
120
116
  assertions (see below) might be a handy alternative to `sprintf`.
121
117
 
122
-
123
118
  #### TEST_ASSERT_X_ARRAY Variants
124
119
 
125
120
  Unity provides a collection of assertions for arrays containing a variety of
@@ -128,22 +123,21 @@ with the `_MESSAGE`variants of Unity's Asserts in that for pretty much any Unity
128
123
  type assertion you can tack on `_ARRAY` and run assertions on an entire block of
129
124
  memory.
130
125
 
131
- ```
126
+ ```c
132
127
  TEST_ASSERT_EQUAL_TYPEX_ARRAY( expected, actual, {size/count} )
133
128
  ```
134
129
 
135
- - `Expected` is an array itself.
136
- - `Size/count` is one or two parameters necessary to establish the number of array
137
- elements and perhaps the length of elements within the array.
130
+ - `Expected` is an array itself.
131
+ - `Size/count` is one or two parameters necessary to establish the number of array
132
+ elements and perhaps the length of elements within the array.
138
133
 
139
134
  Notes:
140
135
 
141
- - The `_MESSAGE` variant convention still applies here to array assertions. The
142
- `_MESSAGE` variants of the `_ARRAY` assertions have names ending with
143
- `_ARRAY_MESSAGE`.
144
- - Assertions for handling arrays of floating point values are grouped with float
145
- and double assertions (see immediately following section).
146
-
136
+ - The `_MESSAGE` variant convention still applies here to array assertions. The
137
+ `_MESSAGE` variants of the `_ARRAY` assertions have names ending with
138
+ `_ARRAY_MESSAGE`.
139
+ - Assertions for handling arrays of floating point values are grouped with float
140
+ and double assertions (see immediately following section).
147
141
 
148
142
  ### TEST_ASSERT_EACH_EQUAL_X Variants
149
143
 
@@ -153,21 +147,20 @@ the Each Equal section below. these are almost on par with the `_MESSAGE`
153
147
  variants of Unity's Asserts in that for pretty much any Unity type assertion you
154
148
  can inject `_EACH_EQUAL` and run assertions on an entire block of memory.
155
149
 
156
- ```
150
+ ```c
157
151
  TEST_ASSERT_EACH_EQUAL_TYPEX( expected, actual, {size/count} )
158
152
  ```
159
153
 
160
- - `Expected` is a single value to compare to.
161
- - `Actual` is an array where each element will be compared to the expected value.
162
- - `Size/count` is one of two parameters necessary to establish the number of array
163
- elements and perhaps the length of elements within the array.
154
+ - `Expected` is a single value to compare to.
155
+ - `Actual` is an array where each element will be compared to the expected value.
156
+ - `Size/count` is one of two parameters necessary to establish the number of array
157
+ elements and perhaps the length of elements within the array.
164
158
 
165
159
  Notes:
166
160
 
167
- - The `_MESSAGE` variant convention still applies here to Each Equal assertions.
168
- - Assertions for handling Each Equal of floating point values are grouped with
169
- float and double assertions (see immediately following section).
170
-
161
+ - The `_MESSAGE` variant convention still applies here to Each Equal assertions.
162
+ - Assertions for handling Each Equal of floating point values are grouped with
163
+ float and double assertions (see immediately following section).
171
164
 
172
165
  ### Configuration
173
166
 
@@ -179,7 +172,6 @@ or disabled in Unity code. This is useful for embedded targets with no floating
179
172
  point math support (i.e. Unity compiles free of errors for fixed point only
180
173
  platforms). See Unity documentation for specifics.
181
174
 
182
-
183
175
  #### Maximum Data Type Width Is Configurable
184
176
 
185
177
  Not all targets support 64 bit wide types or even 32 bit wide types. Define the
@@ -187,14 +179,13 @@ appropriate preprocessor symbols and Unity will omit all operations from
187
179
  compilation that exceed the maximum width of your target. See Unity
188
180
  documentation for specifics.
189
181
 
190
-
191
182
  ## The Assertions in All Their Blessed Glory
192
183
 
193
184
  ### Basic Fail, Pass and Ignore
194
185
 
195
- ##### `TEST_FAIL()`
186
+ #### `TEST_FAIL()`
196
187
 
197
- ##### `TEST_FAIL_MESSAGE("message")`
188
+ #### `TEST_FAIL_MESSAGE("message")`
198
189
 
199
190
  This fella is most often used in special conditions where your test code is
200
191
  performing logic beyond a simple assertion. That is, in practice, `TEST_FAIL()`
@@ -207,25 +198,25 @@ code then verifies as a final step.
207
198
  - Triggering an exception and verifying it (as in Try / Catch / Throw - see the
208
199
  [CException](https://github.com/ThrowTheSwitch/CException) project).
209
200
 
210
- ##### `TEST_PASS()`
201
+ #### `TEST_PASS()`
211
202
 
212
- ##### `TEST_PASS_MESSAGE("message")`
203
+ #### `TEST_PASS_MESSAGE("message")`
213
204
 
214
205
  This will abort the remainder of the test, but count the test as a pass. Under
215
206
  normal circumstances, it is not necessary to include this macro in your tests...
216
207
  a lack of failure will automatically be counted as a `PASS`. It is occasionally
217
208
  useful for tests with `#ifdef`s and such.
218
209
 
219
- ##### `TEST_IGNORE()`
210
+ #### `TEST_IGNORE()`
220
211
 
221
- ##### `TEST_IGNORE_MESSAGE("message")`
212
+ #### `TEST_IGNORE_MESSAGE("message")`
222
213
 
223
214
  Marks a test case (i.e. function meant to contain test assertions) as ignored.
224
215
  Usually this is employed as a breadcrumb to come back and implement a test case.
225
216
  An ignored test case has effects if other assertions are in the enclosing test
226
217
  case (see Unity documentation for more).
227
218
 
228
- ##### `TEST_MESSAGE(message)`
219
+ #### `TEST_MESSAGE(message)`
229
220
 
230
221
  This can be useful for outputting `INFO` messages into the Unity output stream
231
222
  without actually ending the test. Like pass and fail messages, it will be output
@@ -233,27 +224,27 @@ with the filename and line number.
233
224
 
234
225
  ### Boolean
235
226
 
236
- ##### `TEST_ASSERT (condition)`
227
+ #### `TEST_ASSERT (condition)`
237
228
 
238
- ##### `TEST_ASSERT_TRUE (condition)`
229
+ #### `TEST_ASSERT_TRUE (condition)`
239
230
 
240
- ##### `TEST_ASSERT_FALSE (condition)`
231
+ #### `TEST_ASSERT_FALSE (condition)`
241
232
 
242
- ##### `TEST_ASSERT_UNLESS (condition)`
233
+ #### `TEST_ASSERT_UNLESS (condition)`
243
234
 
244
235
  A simple wording variation on `TEST_ASSERT_FALSE`.The semantics of
245
236
  `TEST_ASSERT_UNLESS` aid readability in certain test constructions or
246
237
  conditional statements.
247
238
 
248
- ##### `TEST_ASSERT_NULL (pointer)`
239
+ #### `TEST_ASSERT_NULL (pointer)`
249
240
 
250
- ##### `TEST_ASSERT_NOT_NULL (pointer)`
241
+ #### `TEST_ASSERT_NOT_NULL (pointer)`
251
242
 
252
243
  Verify if a pointer is or is not NULL.
253
244
 
254
- ##### `TEST_ASSERT_EMPTY (pointer)`
245
+ #### `TEST_ASSERT_EMPTY (pointer)`
255
246
 
256
- ##### `TEST_ASSERT_NOT_EMPTY (pointer)`
247
+ #### `TEST_ASSERT_NOT_EMPTY (pointer)`
257
248
 
258
249
  Verify if the first element dereferenced from a pointer is or is not zero. This
259
250
  is particularly useful for checking for empty (or non-empty) null-terminated
@@ -268,26 +259,25 @@ that would break compilation (see Unity documentation for more). Refer to
268
259
  Advanced Asserting later in this document for advice on dealing with other word
269
260
  sizes.
270
261
 
271
- ##### `TEST_ASSERT_EQUAL_INT (expected, actual)`
262
+ #### `TEST_ASSERT_EQUAL_INT (expected, actual)`
272
263
 
273
- ##### `TEST_ASSERT_EQUAL_INT8 (expected, actual)`
264
+ #### `TEST_ASSERT_EQUAL_INT8 (expected, actual)`
274
265
 
275
- ##### `TEST_ASSERT_EQUAL_INT16 (expected, actual)`
266
+ #### `TEST_ASSERT_EQUAL_INT16 (expected, actual)`
276
267
 
277
- ##### `TEST_ASSERT_EQUAL_INT32 (expected, actual)`
268
+ #### `TEST_ASSERT_EQUAL_INT32 (expected, actual)`
278
269
 
279
- ##### `TEST_ASSERT_EQUAL_INT64 (expected, actual)`
270
+ #### `TEST_ASSERT_EQUAL_INT64 (expected, actual)`
280
271
 
281
- ##### `TEST_ASSERT_EQUAL_UINT (expected, actual)`
272
+ #### `TEST_ASSERT_EQUAL_UINT (expected, actual)`
282
273
 
283
- ##### `TEST_ASSERT_EQUAL_UINT8 (expected, actual)`
274
+ #### `TEST_ASSERT_EQUAL_UINT8 (expected, actual)`
284
275
 
285
- ##### `TEST_ASSERT_EQUAL_UINT16 (expected, actual)`
276
+ #### `TEST_ASSERT_EQUAL_UINT16 (expected, actual)`
286
277
 
287
- ##### `TEST_ASSERT_EQUAL_UINT32 (expected, actual)`
288
-
289
- ##### `TEST_ASSERT_EQUAL_UINT64 (expected, actual)`
278
+ #### `TEST_ASSERT_EQUAL_UINT32 (expected, actual)`
290
279
 
280
+ #### `TEST_ASSERT_EQUAL_UINT64 (expected, actual)`
291
281
 
292
282
  ### Unsigned Integers (of all sizes) in Hexadecimal
293
283
 
@@ -295,16 +285,15 @@ All `_HEX` assertions are identical in function to unsigned integer assertions
295
285
  but produce failure messages with the `expected` and `actual` values formatted
296
286
  in hexadecimal. Unity output is big endian.
297
287
 
298
- ##### `TEST_ASSERT_EQUAL_HEX (expected, actual)`
299
-
300
- ##### `TEST_ASSERT_EQUAL_HEX8 (expected, actual)`
288
+ #### `TEST_ASSERT_EQUAL_HEX (expected, actual)`
301
289
 
302
- ##### `TEST_ASSERT_EQUAL_HEX16 (expected, actual)`
290
+ #### `TEST_ASSERT_EQUAL_HEX8 (expected, actual)`
303
291
 
304
- ##### `TEST_ASSERT_EQUAL_HEX32 (expected, actual)`
292
+ #### `TEST_ASSERT_EQUAL_HEX16 (expected, actual)`
305
293
 
306
- ##### `TEST_ASSERT_EQUAL_HEX64 (expected, actual)`
294
+ #### `TEST_ASSERT_EQUAL_HEX32 (expected, actual)`
307
295
 
296
+ #### `TEST_ASSERT_EQUAL_HEX64 (expected, actual)`
308
297
 
309
298
  ### Characters
310
299
 
@@ -312,36 +301,30 @@ While you can use the 8-bit integer assertions to compare `char`, another option
312
301
  to use this specialized assertion which will show printable characters as printables,
313
302
  otherwise showing the HEX escape code for the characters.
314
303
 
315
- ##### `TEST_ASSERT_EQUAL_CHAR (expected, actual)`
316
-
304
+ #### `TEST_ASSERT_EQUAL_CHAR (expected, actual)`
317
305
 
318
306
  ### Masked and Bit-level Assertions
319
307
 
320
308
  Masked and bit-level assertions produce output formatted in hexadecimal. Unity
321
309
  output is big endian.
322
310
 
323
-
324
- ##### `TEST_ASSERT_BITS (mask, expected, actual)`
311
+ #### `TEST_ASSERT_BITS (mask, expected, actual)`
325
312
 
326
313
  Only compares the masked (i.e. high) bits of `expected` and `actual` parameters.
327
314
 
328
-
329
- ##### `TEST_ASSERT_BITS_HIGH (mask, actual)`
315
+ #### `TEST_ASSERT_BITS_HIGH (mask, actual)`
330
316
 
331
317
  Asserts the masked bits of the `actual` parameter are high.
332
318
 
333
-
334
- ##### `TEST_ASSERT_BITS_LOW (mask, actual)`
319
+ #### `TEST_ASSERT_BITS_LOW (mask, actual)`
335
320
 
336
321
  Asserts the masked bits of the `actual` parameter are low.
337
322
 
338
-
339
- ##### `TEST_ASSERT_BIT_HIGH (bit, actual)`
323
+ #### `TEST_ASSERT_BIT_HIGH (bit, actual)`
340
324
 
341
325
  Asserts the specified bit of the `actual` parameter is high.
342
326
 
343
-
344
- ##### `TEST_ASSERT_BIT_LOW (bit, actual)`
327
+ #### `TEST_ASSERT_BIT_LOW (bit, actual)`
345
328
 
346
329
  Asserts the specified bit of the `actual` parameter is low.
347
330
 
@@ -352,16 +335,15 @@ than `threshold` (exclusive). For example, if the threshold value is 0 for the
352
335
  greater than assertion will fail if it is 0 or less. There are assertions for
353
336
  all the various sizes of ints, as for the equality assertions. Some examples:
354
337
 
355
- ##### `TEST_ASSERT_GREATER_THAN_INT8 (threshold, actual)`
338
+ #### `TEST_ASSERT_GREATER_THAN_INT8 (threshold, actual)`
356
339
 
357
- ##### `TEST_ASSERT_GREATER_OR_EQUAL_INT16 (threshold, actual)`
340
+ #### `TEST_ASSERT_GREATER_OR_EQUAL_INT16 (threshold, actual)`
358
341
 
359
- ##### `TEST_ASSERT_LESS_THAN_INT32 (threshold, actual)`
342
+ #### `TEST_ASSERT_LESS_THAN_INT32 (threshold, actual)`
360
343
 
361
- ##### `TEST_ASSERT_LESS_OR_EQUAL_UINT (threshold, actual)`
362
-
363
- ##### `TEST_ASSERT_NOT_EQUAL_UINT8 (threshold, actual)`
344
+ #### `TEST_ASSERT_LESS_OR_EQUAL_UINT (threshold, actual)`
364
345
 
346
+ #### `TEST_ASSERT_NOT_EQUAL_UINT8 (threshold, actual)`
365
347
 
366
348
  ### Integer Ranges (of all sizes)
367
349
 
@@ -370,60 +352,57 @@ These assertions verify that the `expected` parameter is within +/- `delta`
370
352
  and the delta is 3 then the assertion will fail for any value outside the range
371
353
  of 7 - 13.
372
354
 
373
- ##### `TEST_ASSERT_INT_WITHIN (delta, expected, actual)`
355
+ #### `TEST_ASSERT_INT_WITHIN (delta, expected, actual)`
374
356
 
375
- ##### `TEST_ASSERT_INT8_WITHIN (delta, expected, actual)`
357
+ #### `TEST_ASSERT_INT8_WITHIN (delta, expected, actual)`
376
358
 
377
- ##### `TEST_ASSERT_INT16_WITHIN (delta, expected, actual)`
359
+ #### `TEST_ASSERT_INT16_WITHIN (delta, expected, actual)`
378
360
 
379
- ##### `TEST_ASSERT_INT32_WITHIN (delta, expected, actual)`
361
+ #### `TEST_ASSERT_INT32_WITHIN (delta, expected, actual)`
380
362
 
381
- ##### `TEST_ASSERT_INT64_WITHIN (delta, expected, actual)`
363
+ #### `TEST_ASSERT_INT64_WITHIN (delta, expected, actual)`
382
364
 
383
- ##### `TEST_ASSERT_UINT_WITHIN (delta, expected, actual)`
365
+ #### `TEST_ASSERT_UINT_WITHIN (delta, expected, actual)`
384
366
 
385
- ##### `TEST_ASSERT_UINT8_WITHIN (delta, expected, actual)`
367
+ #### `TEST_ASSERT_UINT8_WITHIN (delta, expected, actual)`
386
368
 
387
- ##### `TEST_ASSERT_UINT16_WITHIN (delta, expected, actual)`
369
+ #### `TEST_ASSERT_UINT16_WITHIN (delta, expected, actual)`
388
370
 
389
- ##### `TEST_ASSERT_UINT32_WITHIN (delta, expected, actual)`
371
+ #### `TEST_ASSERT_UINT32_WITHIN (delta, expected, actual)`
390
372
 
391
- ##### `TEST_ASSERT_UINT64_WITHIN (delta, expected, actual)`
373
+ #### `TEST_ASSERT_UINT64_WITHIN (delta, expected, actual)`
392
374
 
393
- ##### `TEST_ASSERT_HEX_WITHIN (delta, expected, actual)`
375
+ #### `TEST_ASSERT_HEX_WITHIN (delta, expected, actual)`
394
376
 
395
- ##### `TEST_ASSERT_HEX8_WITHIN (delta, expected, actual)`
377
+ #### `TEST_ASSERT_HEX8_WITHIN (delta, expected, actual)`
396
378
 
397
- ##### `TEST_ASSERT_HEX16_WITHIN (delta, expected, actual)`
379
+ #### `TEST_ASSERT_HEX16_WITHIN (delta, expected, actual)`
398
380
 
399
- ##### `TEST_ASSERT_HEX32_WITHIN (delta, expected, actual)`
381
+ #### `TEST_ASSERT_HEX32_WITHIN (delta, expected, actual)`
400
382
 
401
- ##### `TEST_ASSERT_HEX64_WITHIN (delta, expected, actual)`
383
+ #### `TEST_ASSERT_HEX64_WITHIN (delta, expected, actual)`
402
384
 
403
- ##### `TEST_ASSERT_CHAR_WITHIN (delta, expected, actual)`
385
+ #### `TEST_ASSERT_CHAR_WITHIN (delta, expected, actual)`
404
386
 
405
387
  ### Structs and Strings
406
388
 
407
- ##### `TEST_ASSERT_EQUAL_PTR (expected, actual)`
389
+ #### `TEST_ASSERT_EQUAL_PTR (expected, actual)`
408
390
 
409
391
  Asserts that the pointers point to the same memory location.
410
392
 
411
-
412
- ##### `TEST_ASSERT_EQUAL_STRING (expected, actual)`
393
+ #### `TEST_ASSERT_EQUAL_STRING (expected, actual)`
413
394
 
414
395
  Asserts that the null terminated (`'\0'`)strings are identical. If strings are
415
396
  of different lengths or any portion of the strings before their terminators
416
397
  differ, the assertion fails. Two NULL strings (i.e. zero length) are considered
417
398
  equivalent.
418
399
 
419
-
420
- ##### `TEST_ASSERT_EQUAL_MEMORY (expected, actual, len)`
400
+ #### `TEST_ASSERT_EQUAL_MEMORY (expected, actual, len)`
421
401
 
422
402
  Asserts that the contents of the memory specified by the `expected` and `actual`
423
403
  pointers is identical. The size of the memory blocks in bytes is specified by
424
404
  the `len` parameter.
425
405
 
426
-
427
406
  ### Arrays
428
407
 
429
408
  `expected` and `actual` parameters are both arrays. `num_elements` specifies the
@@ -438,43 +417,43 @@ For array of strings comparison behavior, see comments for
438
417
  Assertions fail upon the first element in the compared arrays found not to
439
418
  match. Failure messages specify the array index of the failed comparison.
440
419
 
441
- ##### `TEST_ASSERT_EQUAL_INT_ARRAY (expected, actual, num_elements)`
420
+ #### `TEST_ASSERT_EQUAL_INT_ARRAY (expected, actual, num_elements)`
442
421
 
443
- ##### `TEST_ASSERT_EQUAL_INT8_ARRAY (expected, actual, num_elements)`
422
+ #### `TEST_ASSERT_EQUAL_INT8_ARRAY (expected, actual, num_elements)`
444
423
 
445
- ##### `TEST_ASSERT_EQUAL_INT16_ARRAY (expected, actual, num_elements)`
424
+ #### `TEST_ASSERT_EQUAL_INT16_ARRAY (expected, actual, num_elements)`
446
425
 
447
- ##### `TEST_ASSERT_EQUAL_INT32_ARRAY (expected, actual, num_elements)`
426
+ #### `TEST_ASSERT_EQUAL_INT32_ARRAY (expected, actual, num_elements)`
448
427
 
449
- ##### `TEST_ASSERT_EQUAL_INT64_ARRAY (expected, actual, num_elements)`
428
+ #### `TEST_ASSERT_EQUAL_INT64_ARRAY (expected, actual, num_elements)`
450
429
 
451
- ##### `TEST_ASSERT_EQUAL_UINT_ARRAY (expected, actual, num_elements)`
430
+ #### `TEST_ASSERT_EQUAL_UINT_ARRAY (expected, actual, num_elements)`
452
431
 
453
- ##### `TEST_ASSERT_EQUAL_UINT8_ARRAY (expected, actual, num_elements)`
432
+ #### `TEST_ASSERT_EQUAL_UINT8_ARRAY (expected, actual, num_elements)`
454
433
 
455
- ##### `TEST_ASSERT_EQUAL_UINT16_ARRAY (expected, actual, num_elements)`
434
+ #### `TEST_ASSERT_EQUAL_UINT16_ARRAY (expected, actual, num_elements)`
456
435
 
457
- ##### `TEST_ASSERT_EQUAL_UINT32_ARRAY (expected, actual, num_elements)`
436
+ #### `TEST_ASSERT_EQUAL_UINT32_ARRAY (expected, actual, num_elements)`
458
437
 
459
- ##### `TEST_ASSERT_EQUAL_UINT64_ARRAY (expected, actual, num_elements)`
438
+ #### `TEST_ASSERT_EQUAL_UINT64_ARRAY (expected, actual, num_elements)`
460
439
 
461
- ##### `TEST_ASSERT_EQUAL_HEX_ARRAY (expected, actual, num_elements)`
440
+ #### `TEST_ASSERT_EQUAL_HEX_ARRAY (expected, actual, num_elements)`
462
441
 
463
- ##### `TEST_ASSERT_EQUAL_HEX8_ARRAY (expected, actual, num_elements)`
442
+ #### `TEST_ASSERT_EQUAL_HEX8_ARRAY (expected, actual, num_elements)`
464
443
 
465
- ##### `TEST_ASSERT_EQUAL_HEX16_ARRAY (expected, actual, num_elements)`
444
+ #### `TEST_ASSERT_EQUAL_HEX16_ARRAY (expected, actual, num_elements)`
466
445
 
467
- ##### `TEST_ASSERT_EQUAL_HEX32_ARRAY (expected, actual, num_elements)`
446
+ #### `TEST_ASSERT_EQUAL_HEX32_ARRAY (expected, actual, num_elements)`
468
447
 
469
- ##### `TEST_ASSERT_EQUAL_HEX64_ARRAY (expected, actual, num_elements)`
448
+ #### `TEST_ASSERT_EQUAL_HEX64_ARRAY (expected, actual, num_elements)`
470
449
 
471
- ##### `TEST_ASSERT_EQUAL_CHAR_ARRAY (expected, actual, num_elements)`
450
+ #### `TEST_ASSERT_EQUAL_CHAR_ARRAY (expected, actual, num_elements)`
472
451
 
473
- ##### `TEST_ASSERT_EQUAL_PTR_ARRAY (expected, actual, num_elements)`
452
+ #### `TEST_ASSERT_EQUAL_PTR_ARRAY (expected, actual, num_elements)`
474
453
 
475
- ##### `TEST_ASSERT_EQUAL_STRING_ARRAY (expected, actual, num_elements)`
454
+ #### `TEST_ASSERT_EQUAL_STRING_ARRAY (expected, actual, num_elements)`
476
455
 
477
- ##### `TEST_ASSERT_EQUAL_MEMORY_ARRAY (expected, actual, len, num_elements)`
456
+ #### `TEST_ASSERT_EQUAL_MEMORY_ARRAY (expected, actual, len, num_elements)`
478
457
 
479
458
  `len` is the memory in bytes to be compared at each array element.
480
459
 
@@ -485,37 +464,37 @@ These assertions verify that the `expected` array parameter is within +/- `delta
485
464
  \[10, 12\] and the delta is 3 then the assertion will fail for any value
486
465
  outside the range of \[7 - 13, 9 - 15\].
487
466
 
488
- ##### `TEST_ASSERT_INT_ARRAY_WITHIN (delta, expected, actual, num_elements)`
467
+ #### `TEST_ASSERT_INT_ARRAY_WITHIN (delta, expected, actual, num_elements)`
489
468
 
490
- ##### `TEST_ASSERT_INT8_ARRAY_WITHIN (delta, expected, actual, num_elements)`
469
+ #### `TEST_ASSERT_INT8_ARRAY_WITHIN (delta, expected, actual, num_elements)`
491
470
 
492
- ##### `TEST_ASSERT_INT16_ARRAY_WITHIN (delta, expected, actual, num_elements)`
471
+ #### `TEST_ASSERT_INT16_ARRAY_WITHIN (delta, expected, actual, num_elements)`
493
472
 
494
- ##### `TEST_ASSERT_INT32_ARRAY_WITHIN (delta, expected, actual, num_elements)`
473
+ #### `TEST_ASSERT_INT32_ARRAY_WITHIN (delta, expected, actual, num_elements)`
495
474
 
496
- ##### `TEST_ASSERT_INT64_ARRAY_WITHIN (delta, expected, actual, num_elements)`
475
+ #### `TEST_ASSERT_INT64_ARRAY_WITHIN (delta, expected, actual, num_elements)`
497
476
 
498
- ##### `TEST_ASSERT_UINT_ARRAY_WITHIN (delta, expected, actual, num_elements)`
477
+ #### `TEST_ASSERT_UINT_ARRAY_WITHIN (delta, expected, actual, num_elements)`
499
478
 
500
- ##### `TEST_ASSERT_UINT8_ARRAY_WITHIN (delta, expected, actual, num_elements)`
479
+ #### `TEST_ASSERT_UINT8_ARRAY_WITHIN (delta, expected, actual, num_elements)`
501
480
 
502
- ##### `TEST_ASSERT_UINT16_ARRAY_WITHIN (delta, expected, actual, num_elements)`
481
+ #### `TEST_ASSERT_UINT16_ARRAY_WITHIN (delta, expected, actual, num_elements)`
503
482
 
504
- ##### `TEST_ASSERT_UINT32_ARRAY_WITHIN (delta, expected, actual, num_elements)`
483
+ #### `TEST_ASSERT_UINT32_ARRAY_WITHIN (delta, expected, actual, num_elements)`
505
484
 
506
- ##### `TEST_ASSERT_UINT64_ARRAY_WITHIN (delta, expected, actual, num_elements)`
485
+ #### `TEST_ASSERT_UINT64_ARRAY_WITHIN (delta, expected, actual, num_elements)`
507
486
 
508
- ##### `TEST_ASSERT_HEX_ARRAY_WITHIN (delta, expected, actual, num_elements)`
487
+ #### `TEST_ASSERT_HEX_ARRAY_WITHIN (delta, expected, actual, num_elements)`
509
488
 
510
- ##### `TEST_ASSERT_HEX8_ARRAY_WITHIN (delta, expected, actual, num_elements)`
489
+ #### `TEST_ASSERT_HEX8_ARRAY_WITHIN (delta, expected, actual, num_elements)`
511
490
 
512
- ##### `TEST_ASSERT_HEX16_ARRAY_WITHIN (delta, expected, actual, num_elements)`
491
+ #### `TEST_ASSERT_HEX16_ARRAY_WITHIN (delta, expected, actual, num_elements)`
513
492
 
514
- ##### `TEST_ASSERT_HEX32_ARRAY_WITHIN (delta, expected, actual, num_elements)`
493
+ #### `TEST_ASSERT_HEX32_ARRAY_WITHIN (delta, expected, actual, num_elements)`
515
494
 
516
- ##### `TEST_ASSERT_HEX64_ARRAY_WITHIN (delta, expected, actual, num_elements)`
495
+ #### `TEST_ASSERT_HEX64_ARRAY_WITHIN (delta, expected, actual, num_elements)`
517
496
 
518
- ##### `TEST_ASSERT_CHAR_ARRAY_WITHIN (delta, expected, actual, num_elements)`
497
+ #### `TEST_ASSERT_CHAR_ARRAY_WITHIN (delta, expected, actual, num_elements)`
519
498
 
520
499
  ### Each Equal (Arrays to Single Value)
521
500
 
@@ -568,17 +547,15 @@ match. Failure messages specify the array index of the failed comparison.
568
547
 
569
548
  `len` is the memory in bytes to be compared at each array element.
570
549
 
571
-
572
550
  ### Floating Point (If enabled)
573
551
 
574
- ##### `TEST_ASSERT_FLOAT_WITHIN (delta, expected, actual)`
552
+ #### `TEST_ASSERT_FLOAT_WITHIN (delta, expected, actual)`
575
553
 
576
554
  Asserts that the `actual` value is within +/- `delta` of the `expected` value.
577
555
  The nature of floating point representation is such that exact evaluations of
578
556
  equality are not guaranteed.
579
557
 
580
-
581
- ##### `TEST_ASSERT_EQUAL_FLOAT (expected, actual)`
558
+ #### `TEST_ASSERT_EQUAL_FLOAT (expected, actual)`
582
559
 
583
560
  Asserts that the ?actual?value is "close enough to be considered equal" to the
584
561
  `expected` value. If you are curious about the details, refer to the Advanced
@@ -586,74 +563,63 @@ Asserting section for more details on this. Omitting a user-specified delta in a
586
563
  floating point assertion is both a shorthand convenience and a requirement of
587
564
  code generation conventions for CMock.
588
565
 
589
-
590
- ##### `TEST_ASSERT_EQUAL_FLOAT_ARRAY (expected, actual, num_elements)`
566
+ #### `TEST_ASSERT_EQUAL_FLOAT_ARRAY (expected, actual, num_elements)`
591
567
 
592
568
  See Array assertion section for details. Note that individual array element
593
569
  float comparisons are executed using T?EST_ASSERT_EQUAL_FLOAT?.That is, user
594
570
  specified delta comparison values requires a custom-implemented floating point
595
571
  array assertion.
596
572
 
597
-
598
- ##### `TEST_ASSERT_FLOAT_IS_INF (actual)`
573
+ #### `TEST_ASSERT_FLOAT_IS_INF (actual)`
599
574
 
600
575
  Asserts that `actual` parameter is equivalent to positive infinity floating
601
576
  point representation.
602
577
 
603
-
604
- ##### `TEST_ASSERT_FLOAT_IS_NEG_INF (actual)`
578
+ #### `TEST_ASSERT_FLOAT_IS_NEG_INF (actual)`
605
579
 
606
580
  Asserts that `actual` parameter is equivalent to negative infinity floating
607
581
  point representation.
608
582
 
609
-
610
- ##### `TEST_ASSERT_FLOAT_IS_NAN (actual)`
583
+ #### `TEST_ASSERT_FLOAT_IS_NAN (actual)`
611
584
 
612
585
  Asserts that `actual` parameter is a Not A Number floating point representation.
613
586
 
614
-
615
- ##### `TEST_ASSERT_FLOAT_IS_DETERMINATE (actual)`
587
+ #### `TEST_ASSERT_FLOAT_IS_DETERMINATE (actual)`
616
588
 
617
589
  Asserts that ?actual?parameter is a floating point representation usable for
618
590
  mathematical operations. That is, the `actual` parameter is neither positive
619
591
  infinity nor negative infinity nor Not A Number floating point representations.
620
592
 
621
-
622
- ##### `TEST_ASSERT_FLOAT_IS_NOT_INF (actual)`
593
+ #### `TEST_ASSERT_FLOAT_IS_NOT_INF (actual)`
623
594
 
624
595
  Asserts that `actual` parameter is a value other than positive infinity floating
625
596
  point representation.
626
597
 
627
-
628
- ##### `TEST_ASSERT_FLOAT_IS_NOT_NEG_INF (actual)`
598
+ #### `TEST_ASSERT_FLOAT_IS_NOT_NEG_INF (actual)`
629
599
 
630
600
  Asserts that `actual` parameter is a value other than negative infinity floating
631
601
  point representation.
632
602
 
633
-
634
- ##### `TEST_ASSERT_FLOAT_IS_NOT_NAN (actual)`
603
+ #### `TEST_ASSERT_FLOAT_IS_NOT_NAN (actual)`
635
604
 
636
605
  Asserts that `actual` parameter is a value other than Not A Number floating
637
606
  point representation.
638
607
 
639
-
640
- ##### `TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE (actual)`
608
+ #### `TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE (actual)`
641
609
 
642
610
  Asserts that `actual` parameter is not usable for mathematical operations. That
643
611
  is, the `actual` parameter is either positive infinity or negative infinity or
644
612
  Not A Number floating point representations.
645
613
 
646
-
647
614
  ### Double (If enabled)
648
615
 
649
- ##### `TEST_ASSERT_DOUBLE_WITHIN (delta, expected, actual)`
616
+ #### `TEST_ASSERT_DOUBLE_WITHIN (delta, expected, actual)`
650
617
 
651
618
  Asserts that the `actual` value is within +/- `delta` of the `expected` value.
652
619
  The nature of floating point representation is such that exact evaluations of
653
620
  equality are not guaranteed.
654
621
 
655
-
656
- ##### `TEST_ASSERT_EQUAL_DOUBLE (expected, actual)`
622
+ #### `TEST_ASSERT_EQUAL_DOUBLE (expected, actual)`
657
623
 
658
624
  Asserts that the `actual` value is "close enough to be considered equal" to the
659
625
  `expected` value. If you are curious about the details, refer to the Advanced
@@ -661,64 +627,54 @@ Asserting section for more details. Omitting a user-specified delta in a
661
627
  floating point assertion is both a shorthand convenience and a requirement of
662
628
  code generation conventions for CMock.
663
629
 
664
-
665
- ##### `TEST_ASSERT_EQUAL_DOUBLE_ARRAY (expected, actual, num_elements)`
630
+ #### `TEST_ASSERT_EQUAL_DOUBLE_ARRAY (expected, actual, num_elements)`
666
631
 
667
632
  See Array assertion section for details. Note that individual array element
668
633
  double comparisons are executed using `TEST_ASSERT_EQUAL_DOUBLE`.That is, user
669
634
  specified delta comparison values requires a custom implemented double array
670
635
  assertion.
671
636
 
672
-
673
- ##### `TEST_ASSERT_DOUBLE_IS_INF (actual)`
637
+ #### `TEST_ASSERT_DOUBLE_IS_INF (actual)`
674
638
 
675
639
  Asserts that `actual` parameter is equivalent to positive infinity floating
676
640
  point representation.
677
641
 
678
-
679
- ##### `TEST_ASSERT_DOUBLE_IS_NEG_INF (actual)`
642
+ #### `TEST_ASSERT_DOUBLE_IS_NEG_INF (actual)`
680
643
 
681
644
  Asserts that `actual` parameter is equivalent to negative infinity floating point
682
645
  representation.
683
646
 
684
-
685
- ##### `TEST_ASSERT_DOUBLE_IS_NAN (actual)`
647
+ #### `TEST_ASSERT_DOUBLE_IS_NAN (actual)`
686
648
 
687
649
  Asserts that `actual` parameter is a Not A Number floating point representation.
688
650
 
689
-
690
- ##### `TEST_ASSERT_DOUBLE_IS_DETERMINATE (actual)`
651
+ #### `TEST_ASSERT_DOUBLE_IS_DETERMINATE (actual)`
691
652
 
692
653
  Asserts that `actual` parameter is a floating point representation usable for
693
654
  mathematical operations. That is, the ?actual?parameter is neither positive
694
655
  infinity nor negative infinity nor Not A Number floating point representations.
695
656
 
696
-
697
- ##### `TEST_ASSERT_DOUBLE_IS_NOT_INF (actual)`
657
+ #### `TEST_ASSERT_DOUBLE_IS_NOT_INF (actual)`
698
658
 
699
659
  Asserts that `actual` parameter is a value other than positive infinity floating
700
660
  point representation.
701
661
 
702
-
703
- ##### `TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF (actual)`
662
+ #### `TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF (actual)`
704
663
 
705
664
  Asserts that `actual` parameter is a value other than negative infinity floating
706
665
  point representation.
707
666
 
708
-
709
- ##### `TEST_ASSERT_DOUBLE_IS_NOT_NAN (actual)`
667
+ #### `TEST_ASSERT_DOUBLE_IS_NOT_NAN (actual)`
710
668
 
711
669
  Asserts that `actual` parameter is a value other than Not A Number floating
712
670
  point representation.
713
671
 
714
-
715
- ##### `TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE (actual)`
672
+ #### `TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE (actual)`
716
673
 
717
674
  Asserts that `actual` parameter is not usable for mathematical operations. That
718
675
  is, the `actual` parameter is either positive infinity or negative infinity or
719
676
  Not A Number floating point representations.
720
677
 
721
-
722
678
  ## Advanced Asserting: Details On Tricky Assertions
723
679
 
724
680
  This section helps you understand how to deal with some of the trickier
@@ -727,7 +683,6 @@ the under-the-hood details of Unity's assertion mechanisms. If you're one of
727
683
  those people who likes to know what is going on in the background, read on. If
728
684
  not, feel free to ignore the rest of this document until you need it.
729
685
 
730
-
731
686
  ### How do the EQUAL assertions work for FLOAT and DOUBLE?
732
687
 
733
688
  As you may know, directly checking for equality between a pair of floats or a
@@ -768,7 +723,6 @@ assertions less strict, you can change these multipliers to whatever you like by
768
723
  defining UNITY_FLOAT_PRECISION and UNITY_DOUBLE_PRECISION. See Unity
769
724
  documentation for more.
770
725
 
771
-
772
726
  ### How do we deal with targets with non-standard int sizes?
773
727
 
774
728
  It's "fun" that C is a standard where something as fundamental as an integer
@@ -827,5 +781,7 @@ operations, particularly `TEST_ASSERT_INT_WITHIN`.Such assertions might wrap
827
781
  your `int` in the wrong place, and you could experience false failures. You can
828
782
  always back down to a simple `TEST_ASSERT` and do the operations yourself.
829
783
 
784
+ *Find The Latest of This And More at [ThrowTheSwitch.org][]*
830
785
 
831
- *Find The Latest of This And More at [ThrowTheSwitch.org](https://throwtheswitch.org)*
786
+ [assert() macro]: http://en.wikipedia.org/en/wiki/Assert.h
787
+ [ThrowTheSwitch.org]: https://throwtheswitch.org