76 Commits

Author SHA1 Message Date
cc0f58cfbc Create coverage target in Makefile to output statement coverage with gcov 2016-02-29 23:25:39 -06:00
ce6f4737b2 Merge pull request #175 from jsalling/feature/C89-build
Fix C89 warnings about variables at top of scope, enums, variadic macros
2016-02-29 16:59:40 -05:00
3bb51bd740 Fix C89 warnings about variables at top of scope, enums, variadic macros
Add extern UnityFixture in internals header. Add C89 target in Makefile
 clang will show these warnings but can suppress "//" with -Wno-comment.
2016-02-26 20:51:04 -06:00
f8d5f0eee6 Clean up Ignore Test function in Fixture
By removing the call to the Conclude function the code is simplified
  and doesn't depend on global state updates. Tests that are ignored
  after the testBody is called still output the right EOL.
2016-02-25 13:12:22 -06:00
f55bed38a6 Delete function call syntax from Spy detect macros
This fixes #168. See that github.com issue for more discussion.
 Allows the tests to build when putchar() is defined as a macro
  with parenthesis around it, as in the ARM embedded gcc compiler.
2016-02-25 10:41:04 -06:00
862d5d7d3d Rename template for testing to be more fitting 2016-02-24 20:24:14 -06:00
3faa143f21 Fix additional primitive type conversion warnings on Linux
Using gcc 4.8 on Ubuntu 14
2016-02-23 14:46:52 -06:00
2107e7060b Variables used in Fixture tests should be static
Gets rid of warnings about extern with clang's -Weverything
2016-02-17 22:20:56 -06:00
7b0f3cf986 Clean up conversion warnings in Fixture
Turn on -Wconversion in Makefile, fix all warnings
2016-02-17 22:17:05 -06:00
ad14ccf26b Add strict compiler flags to Makefile and a 'clean' target
Comment out -Wconversion for now, since the build would fail
2016-02-09 14:24:00 -06:00
5e7780fd60 Delete unused internals functions for failure, ignore, & test counts.
These wrapper functions should be in Unity core if warranted.
 Use the Unity struct directly for access, or consider macro functions
2016-02-09 10:55:07 -06:00
943fef8a17 Fix printing the test line number for leak detection failures in Fixture
The old failure would print the line in unity_fixture.c, not very useful.
 Now using CurrentTestLineNumber, which is better.
2016-02-09 10:39:22 -06:00
36ee2d2111 Add test for setting max number of pointers in Fixture 2016-02-09 10:36:33 -06:00
822a537d2e Remove opaque typedef from UnityFixture struct, as done in core Unity 2016-02-08 16:53:10 -06:00
6b664fc803 Pass through correct line info on failures in Fixture pointer setting 2016-02-08 16:52:26 -06:00
4c384658e5 Move makefile output to build/ dir for Fixture testing 2016-02-05 21:48:23 -06:00
189085d03a Check for writes to guard space on malloc'd buffers in Fixture
There was already some space reserved as a guard, added check for writes
 before the beginning of the buffer. Did not change the 'overrun' message.
 Underrun buffer writes are likely to be a more rare case.
2016-02-05 21:31:38 -06:00
955b221218 Add configuration option UNITY_EXCLUDE_STDLIB_MALLOC to Fixture
This feature removes the dependency on malloc/free for constrained
  embedded systems without a heap. It uses a static heap inside
  Unity Fixture. Setting UNITY_INTERNAL_HEAP_SIZE_BYTES sizes the heap.
 Add tests for new option, add targets to makefile for running tests.
 UNITY_FIXTURE_MALLOC for Fixture use only, remove from unity_output_Spy.c.
2016-02-01 23:54:06 -06:00
ccb29e80c2 Add NULL safety checks to Fixture allocation functions
Consistent use of one-liners and NULL
2016-01-31 23:15:00 -06:00
e2ad88b9c0 Add checks for NULL return value to Fixture tests and spy
Help failures in the spy by adding filename and message to output
2016-01-31 22:44:45 -06:00
63a0b98faf Remove atoi() dependency, only need stdlib.h in Fixture for malloc
For redefinition of UNITY_FIXTURE_MALLOC/...FREE use both or replace both.
 Clean up whitespace, remaining void*, and comment.
2016-01-30 22:35:59 -06:00
34a30f8e98 Delete dangling function prototype in Fixture internals 2016-01-19 21:47:40 -06:00
a7b60dfc88 Consistent use of * in types in the Fixture, whitespace only 2016-01-19 21:47:32 -06:00
693417847b Remove unnecessary stdio.h dependency and clean up Fixture
Delete unused variables and empty functions
 Make setUp & tearDown (used in Unity core) optionally defined
  if 'weak' linking is present
2016-01-15 22:35:43 -06:00
d1111d92af Merge pull request #152 from jsalling/feature/fixture-ignore-tests-require-spy
Fixture - require spy or else ignore tests
2016-01-07 07:56:47 -05:00
04adb2d2c9 Fix trailing whitespace CRLF, no code changes
Now that the project is using .gitattributes, get rid of CRLF in the repo.
2016-01-06 17:23:43 -06:00
c5bfe0e100 Fixture C99 compliance on tricky macros for Spy & match core Unity version
Add CFLAGS in Fixture Makefile to catch C99 rules with '-pedantic'
2015-12-22 12:40:31 -06:00
5cc5e3473d Add MACROs to check if tests are built using the Output Spy
Ignore tests that need the Spy if we are not building with it
2015-12-21 14:37:23 -06:00
caa3f6663d Add Makefile to fixture/test to make building tests easier
No rake and ruby required to build existing tests
2015-12-18 17:48:35 -06:00
c629e120e1 Fix Leak Detection always passing, but printing a fail message
Don't set CurrentTestFailed = 0 at end, move before last check
 These tests now fail if the output_Spy is not used instead of putchar()
2015-12-16 17:21:09 -06:00
81cf5eb626 Do not add EOL after every ignored test using Unity Fixture
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
2015-12-15 20:57:22 -06:00
1703bd1a5e Reduce stack usage by removing unnecessary call from group runner in Fixture
Defining a group_runner which calls group_runner_runAll() is redundant
2015-12-15 12:05:38 -06:00
f75f489b6e Get rid of magic numbers and strlen call for 'end' string in Fixture
Using sizeof() instead of constant 4, makes code less fragile to change
 Change name of 'guard' in Guard struct to 'guard_space'
2015-12-15 12:05:38 -06:00
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
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
d4353166d2 Replace all hard-coded '\n' with UNITY_PRINT_EOL macro in fixture
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)
2015-11-23 17:09:30 -06:00
1273112a05 MISRA rule 19.10: parentheses around macro params
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.
2015-10-14 17:19:26 -05:00
1affe544d2 unity_fixture: Make unity_free() NULL-safe
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>
2015-10-06 10:44:44 +02:00
98e8590fce Use correct macro for unity_fixture's FAIL.
Output used headers from test runner generator
2015-08-18 08:03:50 -04:00
6f119a8ebd Merge pull request #122 from trianglee/get_tests_counts
Added ability to get number of ignored tests and total number of tests.
2015-07-14 16:45:55 -04:00
8a5e7cce24 Added ability to get number of ignored tests and total number of tests. 2015-07-14 19:49:09 +03:00
9e9adc050c Bug fix - ignored tests were incorrectly counted when not selected for running.
Ignored tests are now correctly skipped if not selected by test name or
by group name.
2015-07-14 19:29:16 +03:00
22b05ad537 Fixes #118: unity_output_Spy should use the platform-agnostic macros for memory. 2015-07-01 11:17:09 -07:00
7737fee444 Fixes #116: Allow overrides of the Unity Fixture's memory functions. This enables custom heap implementations to be used with the Unity Fixture. 2015-06-30 15:32:57 -07:00
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
77af37add0 - catch optional fixtures plugin up to mainline unity (somewhat. like fixing line endings) 2015-06-18 17:16:01 -04:00
975e222aae Move announceTestRun() after UnityBegin() 2015-02-03 00:19:30 +09:00
1c5986bd30 undef defined callc/realloc macros 2015-02-02 23:57:07 +09: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
024af1672c - update rake file for fixture to match other changes. 2014-12-16 14:17:56 -05:00