mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
- Added options for how to handle TEST_ASSERT_EQUAL shorthand
- Tweak a couple style problems with Ruby scripts.
This commit is contained in:
@@ -105,12 +105,12 @@ becomes messageified like thus...
|
||||
TEST_ASSERT_X_MESSAGE( {modifiers}, {expected}, actual, {size/count}, message )
|
||||
|
||||
Notes:
|
||||
- The `_MESSAGE` variants intentionally do not support `printf` style formatting
|
||||
- The `_MESSAGE` variants intentionally do not support `printf` style formatting
|
||||
since many embedded projects don't support or avoid `printf` for various reasons.
|
||||
It is possible to use `sprintf` before the assertion to assemble a complex fail
|
||||
message, if necessary.
|
||||
- If you want to output a counter value within an assertion fail message (e.g. from
|
||||
a loop) , building up an array of results and then using one of the `_ARRAY`
|
||||
- If you want to output a counter value within an assertion fail message (e.g. from
|
||||
a loop) , building up an array of results and then using one of the `_ARRAY`
|
||||
assertions (see below) might be a handy alternative to `sprintf`.
|
||||
|
||||
|
||||
@@ -237,10 +237,6 @@ sizes.
|
||||
|
||||
##### `TEST_ASSERT_EQUAL_INT64 (expected, actual)`
|
||||
|
||||
##### `TEST_ASSERT_EQUAL (expected, actual)`
|
||||
|
||||
##### `TEST_ASSERT_NOT_EQUAL (expected, actual)`
|
||||
|
||||
##### `TEST_ASSERT_EQUAL_UINT (expected, actual)`
|
||||
|
||||
##### `TEST_ASSERT_EQUAL_UINT8 (expected, actual)`
|
||||
|
||||
@@ -420,12 +420,34 @@ _Example:_
|
||||
##### `UNITY_OUTPUT_COLOR`
|
||||
|
||||
If you want to add color using ANSI escape codes you can use this define.
|
||||
t
|
||||
|
||||
_Example:_
|
||||
```C
|
||||
#define UNITY_OUTPUT_COLOR
|
||||
```
|
||||
|
||||
##### `UNITY_SHORTHAND_AS_INT`
|
||||
##### `UNITY_SHORTHAND_AS_MEM`
|
||||
##### `UNITY_SHORTHAND_AS_RAW`
|
||||
##### `UNITY_SHORTHAND_AS_NONE`
|
||||
|
||||
These options give you control of the `TEST_ASSERT_EQUAL` and the
|
||||
`TEST_ASSERT_NOT_EQUAL` shorthand assertions. Historically, Unity treated the
|
||||
former as an alias for an integer comparison. It treated the latter as a direct
|
||||
comparison using `!=`. This assymetry was confusing, but there was much
|
||||
disagreement as to how best to treat this pair of assertions. These four options
|
||||
will allow you to specify how Unity will treat these assertions.
|
||||
|
||||
- AS INT - the values will be cast to integers and directly compared. Arguments
|
||||
that don't cast easily to integers will cause compiler errors.
|
||||
- AS MEM - the address of both values will be taken and the entire object's
|
||||
memory footprint will be compared byte by byte. Directly placing
|
||||
constant numbers like `456` as expected values will cause errors.
|
||||
- AS_RAW - Unity assumes that you can compare the two values using `==` and `!=`
|
||||
and will do so. No details are given about mismatches, because it
|
||||
doesn't really know what type it's dealing with.
|
||||
- AS_NONE - Unity will disallow the use of these shorthand macros altogether,
|
||||
insisting that developers choose a more descriptive option.
|
||||
|
||||
## Getting Into The Guts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user