Commit Graph

117 Commits

Author SHA1 Message Date
jsalling
3faa143f21 Fix additional primitive type conversion warnings on Linux
Using gcc 4.8 on Ubuntu 14
2016-02-23 14:46:52 -06:00
jsalling
c3371664ba Clean up int conversion warnings in core Unity using a 32-bit build
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.
2016-02-12 15:59:46 -06:00
jsalling
4108319007 Fix for overflow issue in UnityAssertNumbersWithin()
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.
2016-01-06 17:41:06 -06:00
Mark VanderVoord
f52538d401 - fix whitespace
- tweak docs
2016-01-04 19:30:38 -05:00
Mark VanderVoord
eac0943f53 Merge pull request #148 from jsalling/master
Fix printing of largest negative number
2016-01-04 18:42:24 -05:00
Matias Devenuta
fe4001f876 Include <stdio.h> (for sprintf) when using UNITY_FLOAT_VERBOSE 2015-12-28 15:04:27 -03:00
jsalling
e966a079a4 Fix printing of largest negative number, MIN 64-bits, -9223372036854775808
'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
2015-12-14 15:15:09 -06:00
Mark VanderVoord
e8662ae1cc - Get these pointers all straightened out! Allow us to override them 2015-12-10 21:47:03 -05:00
Mark VanderVoord
86b0d628fd - Applied details to FAIL messages as well 2015-12-10 18:42:45 -05:00
Mark VanderVoord
28195baaba - Made some tweaks to the way the new detail handling works (to make it look nicer, mostly)
- Fixed a big ugly error in the fancy RUN_TEST handler
2015-12-10 18:12:45 -05:00
Mark VanderVoord
dfbf21c2a3 - Added ability to tack on details to a Unity failure message. 2015-12-10 13:06:41 -05:00
Mark VanderVoord
9aeaee26c9 - Cleaned up UnitPointer_Set (thanks Eric)
- Cleaned up a casting warning error
- Removed a couple semicolons from the end of macros SHAME!
2015-12-07 21:41:44 -05:00
jsalling
de7cf8335e Transform plain macro into a function macro, UNITY_PRINT_EOL()
This helps clarity and is more obvious, it looks like a print function
2015-11-23 21:03:46 -06:00
jsalling
5fc2b092d3 Move UNITY_PRINT_EOL to internals to allow access to it.
Unity fixture needs access to this macro to be consistent.
Add #ifndef wrapper for easier redefinition on systems that use "\r\n".
2015-11-23 14:21:43 -06:00
Mark VanderVoord
c6dc96f387 We're going to use the C99 isinf() and isnan() macros wherever possible now. If your compiler doesn't support this, define UNITY_EXCLUDE_MATH_H and it will go back to the old method 2015-11-13 09:16:42 -05:00
Andy Isaacson
d4b83f180b define setUp and tearDown under UNITY_WEAK_PRAGMA
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.
2015-10-28 18:04:43 -07:00
Alexander Mueller
e3c86b659c Fixes compiler warning about comparison of signed/unsigned 2015-08-03 10:48:17 +02:00
Nimrod Zimerman
4c9e06e356 Use UNITY_PTR_ATTRIBUTE() in one place where it was (accidentally?) not used.
This eliminates a compiler warning for certain compilers.
2015-07-15 11:52:29 +03:00
Andrew Burks
31b1255663 Fixes #3: unity_fixture tests don't build. unity.c and unity_fixture_malloc_overrides.h neglected to include <stddef.h> even though the reference 'size_t' and 'NULL'. 2015-06-30 15:24:39 -07:00
Mark VanderVoord
e40530d59f Merge pull request #112 from ThrowTheSwitch/bugfix/ptr_cast
Avoid warnings when casting pointers in array comparisons (dancing between warnings)
2015-06-20 09:55:40 -04:00
Mark VanderVoord
9b4c5b76d9 Fixed missed prototype 2015-06-19 21:18:34 -04:00
Mark VanderVoord
bc9e12ea1a - Trying a very verbose method of incrementing the pointers
- 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
2015-06-19 15:16:10 -04:00
Mark VanderVoord
08ffed33d4 Merge pull request #108 from eivindt/test-equal-string-len
New asserter: TEST_ASSERT_EQUAL_STRING_LEN
2015-06-19 13:38:10 -04:00
Mark VanderVoord
c3d95e7b0d Merge pull request #109 from laborer2008/master
Reverting of redundant castings, Fixed -Wcast-qual warnings
2015-06-19 13:29:25 -04:00
ThingamaByte, LLC
77af37add0 - catch optional fixtures plugin up to mainline unity (somewhat. like fixing line endings) 2015-06-18 17:16:01 -04:00
Sergey Gusarov
59aed00679 Reverting of redundant casting from 89b003ed0b
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);
                                                                                ^
2015-05-23 02:21:38 +03:00
Eivind Tagseth
61c0b0b75c Added support for TEST_ASSERT_EQUAL_STRING_LEN*
Compares two strings until maximum n bytes (i.e. strncmp()).
2015-04-23 15:39:19 +02:00
Greg Williams
89b003ed0b Removed platform-specific warnings unsupported by GCC 2015-03-12 10:53:44 -04:00
nimrodz
b389c71e71 Added stricter error checks by the compiler, and adapted all impacted code.
Primarily -
* Added "static" to static functions.
* Added proper signature with "void" to functions without arguments.
* Marked unused arguments with "(void)".
* Removed entirely unused static functions.
* Added "const" to preserve const-correctness.
* Added function prototypes for external functions.
2015-01-18 00:39:05 +02:00
Zane D. Purvis
cadee02e79 New macros for controlling use of weak linkage
- `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
2014-12-15 16:18:49 -05:00
Mark VanderVoord
03857da68c Merge pull request #89 from kotofos/warningFixes
Warning fixes (thanks kotofos!)
2014-12-09 09:28:33 -05:00
Zane D. Purvis
a94264b8c0 Print newline after each test, but not before
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).
2014-12-06 16:47:57 -05:00
kotofos
f6bb716220 default case warning 2014-12-03 11:53:16 +06:00
@gageas
1a868f3305 Declare local variables before if statement. 2014-11-10 00:50:09 +09:00
Mark VanderVoord
7aca6288cf Merge pull request #81 from laborer2008/master
Fixed -Wcast-qual gcc warnings
2014-11-02 08:57:59 -05:00
Sergey Gusarov
b492b6d379 Yet another fixes portion for "-Wcast-qual" warning.
But they look a bit different.
2014-11-02 07:19:34 +04:00
Sergey Gusarov
8dffcd8c2a Fixed a lot of single-type gcc warning:
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)?
2014-11-02 07:08:48 +04:00
Mark VanderVoord
4a145c10b3 reworked character strings to be an array type so that storage classes are handled better for picky compilers. 2014-10-26 19:52:17 -04:00
Mark VanderVoord
b5fd6005c2 further tweaks to negative printing 2014-09-02 20:24:11 -04:00
Mark VanderVoord
f48005148f A (hopefully) more universal fix for the signed max negative value printer 2014-09-01 18:20:56 -04:00
Mark VanderVoord
e2d5e1c632 Fixed printability of largest negative value (Thanks SigmaPic!) 2014-09-01 16:44:18 -04:00
Mark VanderVoord
14b074336b reenable results summary.
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.
2014-07-30 22:12:49 -04:00
Mark VanderVoord
bff1fc68cb rearranged project to centralize all self-test stuff under test directory. only pull in includes when required. 2014-07-30 10:14:02 -04:00
Mark VanderVoord
93db16b6dc - add the rest of the WITHIN integer options (why were those missing? laziness?)
- rename the custom FLOAT_TRAIT type because the old name was poor
2014-07-22 13:43:06 -04:00
Mark VanderVoord
a568862a0c centralize strings for easier maintenance. 2014-07-21 18:52:35 -04:00
Mark VanderVoord
9fe750ba89 finish cleaning up floating point support
added macros for IS_DETERMINATE and IS_NOT_DETERMINATE
2014-07-21 16:37:18 -04:00
Mark VanderVoord
a8bd7b5af2 continue to streamline floating point support 2014-07-21 14:38:25 -04:00
Mark VanderVoord
96155881ed - rework to not bother with any of the ever-changing test frameworks in Ruby (sigh) for self-testing
- started working on cleaner floating point support. more coming.
2014-07-21 14:00:53 -04:00
Mark VanderVoord
39cc60ce56 - support "weak" function definitions when available with compiler. 2014-07-08 12:14:26 -04:00
Mark VanderVoord
e83439528b Make life easier for those creating their own runners:
* Add UNITY_BEGIN and UNITY_END macros to simplify usage
* Improve RUN_TEST to make line_num optional where possible
2014-07-01 10:13:45 -04:00