99 Commits

Author SHA1 Message Date
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
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
9b4c5b76d9 Fixed missed prototype 2015-06-19 21:18:34 -04:00
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
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
c3d95e7b0d Merge pull request #109 from laborer2008/master
Reverting of redundant castings, Fixed -Wcast-qual warnings
2015-06-19 13:29:25 -04:00
77af37add0 - catch optional fixtures plugin up to mainline unity (somewhat. like fixing line endings) 2015-06-18 17:16:01 -04:00
59aed00679 Reverting of redundant casting from 89b003ed0bb0ef1d80c072907dff24c7a1a4f004
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
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
89b003ed0b Removed platform-specific warnings unsupported by GCC 2015-03-12 10:53:44 -04:00
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
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
03857da68c Merge pull request #89 from kotofos/warningFixes
Warning fixes (thanks kotofos!)
2014-12-09 09:28:33 -05:00
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
f6bb716220 default case warning 2014-12-03 11:53:16 +06:00
1a868f3305 Declare local variables before if statement. 2014-11-10 00:50:09 +09:00
7aca6288cf Merge pull request #81 from laborer2008/master
Fixed -Wcast-qual gcc warnings
2014-11-02 08:57:59 -05:00
b492b6d379 Yet another fixes portion for "-Wcast-qual" warning.
But they look a bit different.
2014-11-02 07:19:34 +04:00
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
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
b5fd6005c2 further tweaks to negative printing 2014-09-02 20:24:11 -04:00
f48005148f A (hopefully) more universal fix for the signed max negative value printer 2014-09-01 18:20:56 -04:00
e2d5e1c632 Fixed printability of largest negative value (Thanks SigmaPic!) 2014-09-01 16:44:18 -04:00
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
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
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
a568862a0c centralize strings for easier maintenance. 2014-07-21 18:52:35 -04:00
9fe750ba89 finish cleaning up floating point support
added macros for IS_DETERMINATE and IS_NOT_DETERMINATE
2014-07-21 16:37:18 -04:00
a8bd7b5af2 continue to streamline floating point support 2014-07-21 14:38:25 -04:00
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
39cc60ce56 - support "weak" function definitions when available with compiler. 2014-07-08 12:14:26 -04:00
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
fe2c691e9d Clean up many warnings. add clang_strict target to help uncover warnings 2014-05-22 13:43:52 -04:00
f1c778e100 Fixed initialization of data structure by just doing it manually instead of statically (goodbye compiler warnings!) 2014-03-07 15:17:25 -05:00
5fbc23e856 Print an EOL before printing the TestResult while executing the spec
By printing this newline, the filepath of the failing assertion does not get
preceded by the dot which represents a running test.

This gives the advantage, that the complete output of unity can be used as it is
with a makefile in vim. Every error gets displayed in the quickfix and you can
jump appropiately.
2014-02-16 11:13:38 +01:00
3399bba27b - merged in changes by TheGreenDroid to reduce Lint and Compiler warnings 2013-09-22 12:10:42 -04:00
ff1339ca5a - Fixed a gcc warning when -Wall enabled. (Thanks gjcamann) 2013-09-22 10:58:36 -04:00
6dd44f23c9 Allow pointer types to have an attribute
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.
2013-09-17 10:10:43 +01:00
07736afe63 Fix TEST_ASSERT_EQUAL_INT_ARRAY for int sizes other than 32 bits
This patch fixes testEqualIntArrays in the unity test suite on 16-bit
architectures.

TEST_ASSERT_EQUAL_INT_ARRAY calls UnityAssertEqualIntArray with 'style'
set to UNITY_DISPLAY_STYLE_INT.

UNITY_DISPLAY_STYLE_INT is defined as UNITY_DISPLAY_STYLE_AUTO +
UNITY_DISPLAY_STYLE_INT{16,32,64} (depending on the int width).

However, the switch statement in UnityAssertEqualIntArray has special
cases for the width-specific display styles, but these comparisons
are carried out without clearing the UNITY_DISPLAY_STYLE_AUTO flag.
This means that if 'style' is UNITY_DISPLAY_STYLE_INT, and the int
width is, say, 16, bits, the default case will be hit, and elements
compared as if they were 32 bits wide. Unsurprisingly this causes
a failure in the test named above.
2013-06-28 09:34:49 +01:00
af76099975 Merge pull request #32 from alejmrm/missing_defs4uf_ud
Fix missing #define when UNITY_EXCLUDE_FLOAT is used
2013-02-06 17:01:53 -08:00
b8d47ff2a3 report correct (zero-based) index in string array equality mismatch 2013-02-06 09:58:21 -06:00
ef37c6bc60 fix missing #define when UNIT_EXCLUDE_FLOAT is used 2013-02-04 17:03:31 -07:00
f73c5fa606 Fix: - Modify tests to compile under MSVC++ EE 2008
- Change type of floating-point constants to single/double precision
       as appropriate.
2012-11-26 11:29:47 -06:00
c2737fc71c Fix: For floats, make sure all constants are single-precision floating point values.
For doubles, make sure all constants are double-precision.
2012-11-20 14:45:04 -06:00
2ab2fef60a Array comparisons of floating point types fail if any values are NaN or infinite. 2012-10-31 12:34:30 +00:00
b9b18bf547 Added new asserts to check for plus/minus infinity and NaN. 2012-10-30 17:08:43 +00:00
b14819bc79 Expanded NaN and Infinity handling to doubles. 2012-10-30 16:12:50 +00:00
899f2f2fab UnityAssertFloatsWithin now fails any test where either a NaN or Infinite value is passed as expected or actual. 2012-10-30 16:00:00 +00:00
5027763534 Fixed typo in comment. 2012-10-30 09:29:54 +00:00
83148364a5 Fix For Issue #10 - TEST_ASSERT_EQUAL_FLOAT doesn't fail if actual value is a NaN. 2012-10-30 09:00:45 +00:00