1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

Break on sentences instead of column

This commit is contained in:
wolf99
2021-06-02 22:19:43 +01:00
parent 8b90b51c68
commit 00a1d02835
7 changed files with 514 additions and 620 deletions

View File

@@ -1,29 +1,26 @@
# 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
test groups and gives finer control of your tests over the command line.
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 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
Test Driven Development, or those coming to Unity from CppUTest. We should note that using this
framework glosses over some of the features of Unity, and makes it more difficult
to integrate with other testing tools like Ceedling and CMock.
This framework is primarily supplied for those working through James Grenning's book on Embedded Test Driven Development, or those coming to Unity from CppUTest.
We should note that using this 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
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
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.
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 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
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
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 information.
It's possible to add a custom line at the end of the help message, typically to point to
project-specific or company-specific unit test documentation. Define `UNITY_CUSTOM_HELP_MSG` to
provide a custom message, e.g.:
It's possible to add a custom line at the end of the help message, typically to point to project-specific or company-specific unit test documentation.
Define `UNITY_CUSTOM_HELP_MSG` to provide a custom message, e.g.:
#define UNITY_CUSTOM_HELP_MSG "If any test fails see https://example.com/troubleshooting"

View File

@@ -1,49 +1,42 @@
# 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
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.
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 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
can report a number of false failures. A more advanced runtime tool is required to
track complete system memory handling.
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 can report a number of false failures.
A more advanced runtime tool is required to track complete system memory handling.
## Module API
### `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.
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`
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
simplified mock.
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 simplified mock.
## Configuration
### `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
`pvPortFree`, then you can use these defines to make it so.
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`
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.
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`
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.
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.