49 Commits

Author SHA1 Message Date
ded22fef63 Make memory handling optional in fixtures 2019-10-30 09:50:22 -04:00
fbded74349 Split memory from fixtures and make it's own addon 2019-10-30 07:52:07 -04:00
15631f1c78 More tweaking to make it happy on both windows and *nix 2019-10-25 11:53:59 -04:00
8d044e60c6 update fixture tests too 2019-10-25 11:41:27 -04:00
d16c27b085 - added target for checking ANSI compliance
- fixed ANSI (C89) issues, including #418
2019-10-25 10:17:12 -04:00
b3de931d69 Add UNITY_OUTPUT_CHAR_HEADER_DECLARATION to fixture tests Makefile defines 2017-08-01 23:36:13 +03:00
53bdb6897f Ability to set size of pointer list, smaller default size 2016-12-23 22:53:24 -06:00
8e31f5d869 Revised internal type naming scheme to better sandbox Unity away from everything else. Sure, short was nice, but not at the expense of naming collisions. 2016-11-29 08:38:51 -05:00
3e30290367 Remove extra newline in verbose output format of fixture 2016-10-10 23:10:40 -05:00
da7e375cf9 Start building Unity & Fixture with C89 flags in continuous integration
Remove stdint.h from the C89 build due to -pedantic warnings from type
  'long long' and constants like UINTPTR_MAX = 18446744073709551615ULL
2016-08-30 19:57:55 -05:00
8beb9715be C89 comment style changes only 2016-08-23 23:10:05 -05:00
92f6d5dd08 Verify the tests for Internal Malloc implementation free all the heap
Make it more clear that each test of the internal heap implementation
  should free in LIFO order. Without this check, memory can be stranded
  but still pass.
2016-08-21 11:53:15 -05:00
d837342b15 Move free() calls before test asserts, add comments to ReallocFail test 2016-08-21 11:45:54 -05:00
03ac71b8c9 Reorder free calls to free all memory
The internal malloc must free in LIFO order
2016-08-21 11:27:47 -05:00
13160e5f1e Update unity_fixture_Test.c
I believe if realloc() returns a pointer to a different location, the old location is freed. However, the pointer 'n1' is not freed if realloc fails to obtain a large enough block of memory and returns NULL. (more details on [StackOverflow](http://stackoverflow.com/a/16676964)).
2016-07-28 17:11:11 -04:00
094c05e904 Update unity_fixture_Test.c
[../Unity-master/extras/fixture/test/unity_fixture_Test.c:530]: (error) Deallocating a deallocated pointer: n1

This solution from Daniel Fischer was helpful in fixing the error because if realloc returns a pointer to a different location, the old location is freed.

Found by https://github.com/bryongloden/cppcheck
2016-07-26 14:40:00 -04:00
e3612e9a10 Update Fixtures too. 2016-05-06 10:55:41 -04:00
94fc68942b 100% code coverage for Unity Fixture
Add tests for uncovered lines
2016-02-29 23:39:03 -06:00
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
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
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
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
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
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
22b05ad537 Fixes #118: unity_output_Spy should use the platform-agnostic macros for memory. 2015-07-01 11:17:09 -07: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
c1379802eb no arguments for UnityPointer_Init 2014-12-03 11:58:08 +06:00
5e401afa83 updating CLI for unity_fixture.h to handle unknown command line arguments (instead of entering an infinite loop) 2013-03-04 14:35:18 -06:00
4817d78de3 Fix: Declare all variables before statements in a function.
Likewise, place all function prototypes before statements.
     These changes support Microsoft Visual Studio 2008 Express Edition,
       which follows C89-style rules.
2013-01-11 12:56:15 -06:00
3d61357343 - updated fixture to match James' suggestions.
git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@124 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
2011-03-09 02:05:05 +00:00
e067b442a3 - updates to fixture in extras (submitted by James Grenning)
git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@111 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
2011-01-04 20:08:32 +00:00
57178b9295 - tweaked parameterized tests to be C99 standards compliant
- fixed a few bugs in fixtures to get it to pass against our standard compilers
- added extern of OUTPUT_CHAR method to keep compilers from complaining

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@107 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
2010-12-01 01:56:24 +00:00
5a6b8c405b - added a tweaked version of James Grenning's unity_fixture to extras
git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@106 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
2010-11-29 22:53:57 +00:00