Revert the previous commit. Add tests for extended enum cases.
Fix crash due to accessing 'trait_names' array out of bounds.
Adding an extra invalid value to the end of an enum causes '-Wswitch' flag
to warn unless there is a switch default case - also enabled by '-Wall'.
Make subtraction result unsigned, change prototype & casts in internals.
If "actual - expected" overflowed, it wrapped to a negative number,
but would fit in an unsigned type, example is INT_MAX - (-1) = INT_MIN
For correctness, 'delta' should be unsigned too. Passing in a negative
number always passed. The delta can be between INT_MAX & UINT_MAX.
Delete the { ;} braces and semicolon from UNITY_PRINT_EOL to give it expected
behavior: 1) requires a semicolon 2) works in one-liner if-else statements
If you need "\r\n" for EOL, define as the following to get the same behavior:
do{UNITY_OUTPUT_CHAR('\r'); UNITY_OUTPUT_CHAR('\n');}while(0)
Added parentheses around all macro parameters to resolve MISRA 2004
rule 19.10, "in the definition of a function-like macro, each instance
of a parameter shall be enclosed in parenthesis" as tested with the
IAR EW for 8051 compiler, version 9.20.2.
The only questionable change is in "unity_fixture.h" where the nested
macro DECLARE_TEST_CASE in RUN_TEST_CASE prevents surrounding params
"group" and "name" with parentheses.
However, it appears that macro DECLARE_TEST_CASE isn't used elsewhere,
so I eliminated DECLARE_TEST_CASE and put its expansion directly in
RUN_TEST_CASE. Now the following header files pass rule 19.10:
* unity.h
* unity_internals.h
* unity_fixture.h
For my own project, this change to the Unity test framework allows me
to include my unit test code to be tested against MISRA rules as well,
instead of just production code, to help enforce style and team
guidelines.
- `UNITY_WEAK_ATTRIBUTE`, if defined, is placed before declarations of weakly
linked symbols. If not manually defined, it will be automatically set to
`__attribute__((weak))` on GCC and Clang, except for Clang for Win32.
- `UNITY_WEAK_PRAGMA`, if defined, will cause preprocessor to emit
`#pragma weak setUp`, etc. Ignored if `UNITY_WEAK_ATTRIBUTE` is defined.
- `UNITY_NO_WEAK` undefines both of the above resulting in no weakly
linked symbols.
Work around for ThrowTheSwitch/Unity#93
support tests named spec as well.
clean up UnityBegin to make us not have to dig inside it to inject the filename.
Add UNITY_OUTPUT_START() and UNITY_OUTPUT_COMPLETE() for future use.
Microchip's XC16 and friends, when used with dsPICs, require that all pointers
to memory which could possibly be in EDS space by adorned with __eds__, e.g.
__eds__ int* p_int
Adding the macro UNITY_PTR_ATTRIBUTE allows Unity's pointers to be decorated
with whatever ridiculous attributes the compiler requires.
The reason that TEST_ASSERT_xyz_WITHIN_MESSAGE() family of functions
doesn't print any message is because is calling a re-use macro from the
TEST_ASSERT_xyz_WITHIN() family of functions. Due this two functions in
unity.h calls the same function from unity_internals.h, the message is
nullified at this point. The issue is fix by passing _message_ arg to
the 4th argument of *UnityAssertNumbersWithin()* function.