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'.
The clang compiler warns here with -Wunreachable-code
The enum's switch statement covers all cases, so default is unused
Leave the break in the code as a comment, to be more clear
The history is this default case was added in f6bb7162 - compiler warning.
Then the break was added in c6dc96f3.
With a buffer long enough, no truncation should be neccesary to format floats.
Buffer length is user settable by defining UNITY_VERBOSE_NUMBER_MAX_LENGTH,
otherwise a sensible default is used based on desired precision.
See: http://stackoverflow.com/a/7235717
To expose warnings use -Wconversion -m32, and *not* -D UNITY_SUPPORT_64
In 32-bit mode, the variable and parameter are the same width, so sign
conversion is implicit. In 64-bit, implicit conversion is clean.
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.
'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
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.
- casting to a (void*) was giving warnings to some compilers about double casting
- casting from a u8 to u16/32/64 was giving warnings about changing alignment requirements
Double castings look ugly. And if Unity is compiled with -Wcast-qual flag these type castings produce a lot of warnings:
unity/src/unity.c:490:80: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)(void*)ptr_exp, style);
^
- `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
This change makes parsing the results easier for tools like ceedling,
which was choking when a test used stdout and there wasn't an
EOL after "PASS" (ThrowTheSwitch/Ceedling#41).
warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
FYI, "-Wcast-qual" is not a default option.
The main idea: If some function receives "const void*"
why should it operate with "void*" (or something) afterwards (after casting)?
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.