mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
markdown conformance
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Unity Fixtures
|
||||
|
||||
This Framework is an optional add-on to Unity. By including unity_framework.h in place of unity.h,
|
||||
you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of
|
||||
you may now work with Unity in a manner similar to CppUTest. This framework adds the concepts of
|
||||
test groups and gives finer control of your tests over the command line.
|
||||
|
||||
This framework is primarily supplied for those working through James Grenning's book on Embedded
|
||||
@@ -9,14 +9,14 @@ Test Driven Development, or those coming to Unity from CppUTest. We should note
|
||||
framework glosses over some of the features of Unity, and makes it more difficult
|
||||
to integrate with other testing tools like Ceedling and CMock.
|
||||
|
||||
# Dependency Notification
|
||||
## Dependency Notification
|
||||
|
||||
Fixtures, by default, uses the Memory addon as well. This is to make it simple for those trying to
|
||||
follow along with James' book. Using them together is completely optional. You may choose to use
|
||||
follow along with James' book. Using them together is completely optional. You may choose to use
|
||||
Fixtures without Memory handling by defining `UNITY_FIXTURE_NO_EXTRAS`. It will then stop automatically
|
||||
pulling in extras and leave you to do it as desired.
|
||||
|
||||
# Usage information
|
||||
## Usage information
|
||||
|
||||
By default the test executables produced by Unity Fixtures run all tests once, but the behavior can
|
||||
be configured with command-line flags. Run the test executable with the `--help` flag for more
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
# Unity Memory
|
||||
|
||||
This Framework is an optional add-on to Unity. By including unity.h and then
|
||||
unity_memory.h, you have the added ability to track malloc and free calls. This
|
||||
unity_memory.h, you have the added ability to track malloc and free calls. This
|
||||
addon requires that the stdlib functions be overridden by its own defines. These
|
||||
defines will still malloc / realloc / free etc, but will also track the calls
|
||||
in order to ensure that you don't have any memory leaks in your programs.
|
||||
|
||||
Note that this is only useful in situations where a unit is in charge of both
|
||||
the allocation and deallocation of memory. When it is not symmetric, unit testing
|
||||
the allocation and deallocation of memory. When it is not symmetric, unit testing
|
||||
can report a number of false failures. A more advanced runtime tool is required to
|
||||
track complete system memory handling.
|
||||
|
||||
# Module API
|
||||
## Module API
|
||||
|
||||
## `UnityMalloc_StartTest` and `UnityMalloc_EndTest`
|
||||
### `UnityMalloc_StartTest` and `UnityMalloc_EndTest`
|
||||
|
||||
These must be called at the beginning and end of each test. For simplicity, they can
|
||||
be added to `setUp` and `tearDown` in order to do their job. When using the test
|
||||
runner generator scripts, these will be automatically added to the runner whenever
|
||||
unity_memory.h is included.
|
||||
|
||||
## `UnityMalloc_MakeMallocFailAfterCount`
|
||||
### `UnityMalloc_MakeMallocFailAfterCount`
|
||||
|
||||
This can be called from the tests themselves. Passing this function a number will
|
||||
force the reference counter to start keeping track of malloc calls. During that test,
|
||||
if the number of malloc calls exceeds the number given, malloc will immediately
|
||||
start returning `NULL`. This allows you to test error conditions. Think of it as a
|
||||
if the number of malloc calls exceeds the number given, malloc will immediately
|
||||
start returning `NULL`. This allows you to test error conditions. Think of it as a
|
||||
simplified mock.
|
||||
|
||||
# Configuration
|
||||
## Configuration
|
||||
|
||||
## `UNITY_MALLOC` and `UNITY_FREE`
|
||||
### `UNITY_MALLOC` and `UNITY_FREE`
|
||||
|
||||
By default, this module tries to use the real stdlib `malloc` and `free` internally.
|
||||
If you would prefer it to use something else, like FreeRTOS's `pvPortMalloc` and
|
||||
By default, this module tries to use the real stdlib `malloc` and `free` internally.
|
||||
If you would prefer it to use something else, like FreeRTOS's `pvPortMalloc` and
|
||||
`pvPortFree`, then you can use these defines to make it so.
|
||||
|
||||
## `UNITY_EXCLUDE_STDLIB_MALLOC`
|
||||
### `UNITY_EXCLUDE_STDLIB_MALLOC`
|
||||
|
||||
If you would like this library to ignore stdlib or other heap engines completely, and
|
||||
manage the memory on its own, then define this. All memory will be handled internally
|
||||
(and at likely lower overhead). Note that this is not a very featureful memory manager,
|
||||
but is sufficient for most testing purposes.
|
||||
|
||||
## `UNITY_INTERNAL_HEAP_SIZE_BYTES`
|
||||
### `UNITY_INTERNAL_HEAP_SIZE_BYTES`
|
||||
|
||||
When using the built-in memory manager (see `UNITY_EXCLUDE_STDLIB_MALLOC`) this define
|
||||
allows you to set the heap size this library will use to manage the memory.
|
||||
|
||||
Reference in New Issue
Block a user