Commit Graph

324 Commits

Author SHA1 Message Date
mvandervoord
71e77ce6fb Added NOT-EQUAL int variants.
Organized Unit Tests
2020-03-16 18:45:40 -04:00
Jørn Villesen Christensen
3da0b4652c Implement macro TEST_PRINTF: Works like TEST_MESSAGE, but with a format-string.
Depends on UnityPrintFormatted (define UNITY_INCLUDE_PRINT_FORMATTED).
UnityPrintFormatted has been renamed to UnityPrintF due to changes below.

API of UnityPrintFormatted has been changed (hence the rename), but end users
(developers) can use the TEST_PRINTF as an almost-drop-in replacement TEST_PRINTF
is compatible with the old UnityPrintFormatted API (see below).

The behaviour of UnityPrintF has also been changed:
  - Now it prefixes the outout with test location information Output is marked
    as INFO.
  - It adds an EOL.

Both behaviours adopted from other output functions.
2020-02-14 22:43:51 +01:00
mvandervoord
ef0cf704d9 Centralize all testing to the test folder instead of each subproject.
Trigger ALL tests when calling `rake test:all` instead of that being just the core tests.
2019-12-14 22:24:30 -05:00
mvandervoord
e3132cdddd Change the way we ignore the default runner. 2019-12-05 13:51:55 -05:00
mvandervoord
c5c36ab29f Do NOT include the default test runner if a custom runner has been defined.
Cleanup some style issues.
2019-12-05 13:19:43 -05:00
Mark VanderVoord
37a0f7184c Merge pull request #459 from elliot-gawthrop/combined_suite
Option to omit UnityBegin/UnityEnd calls in generate_test_runner
2019-10-30 09:33:18 -04:00
John Lindgren
8072c5c946 Remove exactly duplicated 'else if' branch. 2019-10-29 17:10:45 -04:00
anon
a303e08859 Option to omit UnityBegin/UnityEnd calls in generate_test_runner
By passing --omit_begin_end=1 to generate_test_runner.rb, the script
will now omit calls to UnityBegin and UnityEnd when running tests in a
suite.

This allows multiple suites to be executed in a row, and then have an overall
summary of the tests which were executed across all suites.
2019-10-29 20:32:06 +00:00
John Lindgren
9c82fac380 Update incorrect comment. 2019-10-29 13:21:59 -04:00
mvandervoord
74d47e8afa Add missed casting 2019-10-29 06:34:09 -04:00
mvandervoord
354e2b4da6 Added set of assertions for checking CHAR's and CHAR arrays (not as strings) 2019-10-28 16:54:32 -04:00
mvandervoord
60b23dc8a4 Stopped supported -0 as a float output because (a) it is non-portable, only existing on some architectures and (b) relies on the undefined behavior of 1.0/0.0 2019-10-28 13:43:32 -04:00
mvandervoord
e1dca8fa48 Add options for different output formats 2019-10-28 12:43:11 -04:00
mvandervoord
d16c27b085 - added target for checking ANSI compliance
- fixed ANSI (C89) issues, including #418
2019-10-25 10:17:12 -04:00
Mark VanderVoord
46263fc148 Get the 2's compliment of the unsigned int number when printing results without relying on problematic recasting of a negated int. (see #439) 2019-09-10 15:52:37 -04:00
Aurelien Labrosse
3ac73efe62 optimisation(AVR): Store static string in AVR EEPROM
* This can save a lot of program memory and allow to run test on ATTiny
2019-07-09 09:58:48 +02:00
Mark VanderVoord
3e82c0a96f sigh. wrong comment style 2019-07-06 11:07:00 -04:00
Mark VanderVoord
0000f1e6d2 Add TEST_MESSAGE for outputting messages without aborting a test and _MESSAGE variant to TEST_PASS collection. 2019-07-06 11:02:32 -04:00
Mark VanderVoord
45020b0d3b Cleanup issue #417 2019-07-05 19:14:22 -04:00
Mark VanderVoord
bc72eeb211 Merge pull request #425 from farrrb/fix-ti-c55-sizeof
TI C55x compatibility patches - removal of sizeof operator from the interfaces
2019-07-05 15:41:41 -04:00
Mark VanderVoord
f2d826c7c5 - Added options for how to handle TEST_ASSERT_EQUAL shorthand
- Tweak a couple style problems with Ruby scripts.
2019-07-03 15:03:03 -04:00
Fabian Zahn
885ae9638e Introduce patch from "UnityAssertEqualIntArray" for "UnityAssertNumbersArrayWithin" in order to get rid of the sizeof() operator 2019-05-12 09:31:26 +02:00
Mark VanderVoord
d70047881e Merge pull request #377 from elliot-gawthrop/execution-time-embedded
Execution time improvements
2019-05-04 07:53:37 -04:00
Mark VanderVoord
94446cdb5e Merge pull request #404 from farrrb/fix-nibbles-UnityPrintNumberHex
Fixed maximum number of nibbles for processor where sizeof() operator…
2019-05-04 07:39:59 -04:00
Mark VanderVoord
2b0d093837 Merge pull request #403 from farrrb/fix-issue-392
Used sizeof operator for pointer increments in UnityAssertEqualIntArray().
2019-05-04 07:39:22 -04:00
Dom Postorivo
9340582797 ARRAY_WITHIN in unity 2019-04-20 14:10:56 -04:00
Dom Postorivo
0bd6bf7b2b Use Pass string from unity.c in unity_fixture.c to garuntee colour behavior 2019-04-13 14:29:06 -04:00
Fabian Zahn
d01e32299e Used sizeof() operator for pointer increments and substituted sizeof() operator for the unsigned int mask calculation to "UNITY_INT_WIDTH / 8" in function "UnityAssertEqualIntArray". 2019-04-07 18:34:25 +02:00
Fabian Zahn
52ff8613a2 Fixed maximum number of nibbles for processor where sizeof() operator doesn't return the size of a type in 8-bit bytes (e.g. the TI C2000 series). 2019-04-07 12:09:00 +02:00
Alexander Brevig
0dafa0b306 use unary minus on the incoming int instead of the casted uint 2019-03-12 00:17:37 +01:00
elliot
076f0fff56 Improvements to the execution time feature
- Running time macros have been made more portable, previously it was not
  possible to override all macros
- Running time macros will be executed by default test runner, and auto test
  runners
- Adds a default execution time implementation for unix. (Previous default
  implementation only worked on Windows)
- For embedded platforms there is a simple method of getting a default
  implementation by defining a single macro UNITY_CLOCK_MS()
- Removed need for UNITY_EXEC_TIME_RESET. This was not being used for the default
  implementations, if anything ever did need reset-like functionality it could
  simply be wrapped up with the start or stop macros for that platform
2019-01-31 22:01:20 +00:00
Fabian Zahn
b723c9f250 Added braces to avoid implementation solely based on operator precedence. 2019-01-30 21:26:35 +01:00
Mark VanderVoord
38c48704c5 Merge pull request #383 from farrrb/feature-printf
Feature printf (Thanks @farrrb !)
2019-01-25 06:09:20 -05:00
Luca Boccassi
5074a3d8b2 Make unity.c compatible with c90
Avoid declaring the loop variable inside the for statement to keep
compatibility with c90:

unity.c:1408: error: for' loop initial declaration used outside C99 mode
2019-01-24 21:44:34 +00:00
Fabian Zahn
4f8656f658 Added some documentation for the helper function. 2019-01-24 19:22:01 +01:00
Fabian Zahn
95ccc6edc1 Changed the compiler switch behaviour for printf (default: disabled).
Macro UNITY_EXCLUDE_PRINT_FORMATTED changed to UNITY_INCLUDE_PRINT_FORMATTED.
Enable printf via "-DUNITY_INCLUDE_PRINT_FORMATTED" compiler option.
2019-01-24 18:42:51 +01:00
Fabian Zahn
5918ee0cdf Merge branch 'master' into feature-printf
# Conflicts:
#	src/unity.c
2019-01-24 18:32:07 +01:00
Mark VanderVoord
f433480f7f Merge pull request #299 from jlindgren90/float-printing
Allow UnityPrintFloat() to print a 7th digit.
2018-11-28 15:27:37 -05:00
John Lindgren
d09f4953ff Fix another signed integer overflow. 2018-11-28 15:17:25 -05:00
John Lindgren
8a77f48634 Fix undefined behavior when printing INT_MIN/INT64_MIN.
Negating the most-negative signed integer results in overflow, which
is undefined behavior.  Fix this by casting to an unsigned type first
(unsigned overflow is well-defined as it uses modular arithmetic).
2018-11-28 14:45:23 -05:00
John Lindgren
39fbd13cae Merge branch 'master' into float-printing 2018-11-28 14:02:41 -05:00
Mark VanderVoord
eab9283a98 Merge pull request #353 from kykrueger/issue-#352-uninitialized-value-warning
Issue #352 uninitialized value warning
2018-11-07 09:22:46 -05:00
Kochise
50ce8a880a Some cleanup 2018-10-31 11:41:44 +01:00
Kochise
96127581a0 Some cleanup 2018-10-31 11:30:13 +01:00
Fabian Zahn
f1100dd19a Added support for %b (bits / binary), %f (float) and %g (double). 2018-10-27 18:21:01 +02:00
Fabian Zahn
b4ab81bbe9 Added first working implementation. 2018-10-27 16:06:38 +02:00
Kyle Krueger
e0d52d1a79 fix uninitialzed value warning 2018-09-12 17:46:11 +02:00
elliot
f0e4571c96 Merge branch 'master' into unit-test-execution-time 2018-07-28 20:01:50 +01:00
Xenoamor
2c5d09bf20 Flush unity output before a potential longjmp
Flush the unity stdout buffer before calling TEST_ABORT().
This is because if TEST_PROTECT() has not previously been called this will cause a segmentation fault and the stdout buffer will fail to print

Although the segmentation fault will still occur, the error that caused it will at least be displayed
2018-07-18 16:34:14 +01:00
Jeremy Hannon
9bada282f4 MISRA 19.10: parentheses around macro params
MISRA 2004 rule 19.10: inside macros, surround each parameter usage with parentheses.
2018-02-10 14:27:03 -06:00