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.
Updated clang and gcc targets. Fixed spelling of LIMITS, which breaks the
gcc_auto_sizeof.yml build.
Commented -Wunreachable-code, Unity won't build on OSX clang with it,
error in unity.c:769 & 932: 'default: break;' case.
If Unity core is compiled with UNITY_OUTPUT_CHAR = putcharSpy, these tests
will run, otherwise they are ignored and print a message
Includes an implementation of putcharSpy, which allows checking the I/O
from Unity during a test. Follows closely from the Fixture spy
Tricky macros determine if putcharSpy is injected
Revert part of commit 77af37ad, code looked like a temporary change
The behavior is back to the original, printing "....!..." in quiet mode
Added an ignored test to Fixture for visual inspection
'divisor' ranges from 1 to 1e18, representable by a long or unsigned long
'number' becomes negative when cast as signed, so remove the cast and
keep conversion warnings quiet by turning 'divisor' unsigned
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)
The intent of UNITY_WEAK_PRAGMA is that we have weak symbols for setUp
and tearDown in unity.o, so that developers can override these symbols
if needed but the link works right if they are not defined.
In order to do this using #pragma, the pragma and the definition of the
function (not the declaration) need to be present in the same translation
unit (source code file).
Previously, the UNITY_WEAK_PRAGMA code was just declaring the setUp
function, but not defining it, which means that developers had to add an
empty setUp function to their tests in order to link.
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.
At the start of unity_free(), check mem for NULL, and return immediately
if it is, so we don't crash in this case. This mimics the behaviour of
most free() implementations. Closes#135.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>