Skip to content
Snippets Groups Projects
Unity_notes.md 1.17 KiB
Newer Older
Peter Thedens's avatar
Peter Thedens committed
# Unity Notes

Peter Thedens's avatar
Peter Thedens committed
- When using Unity, be sure to define `UNITY_INCLUDE_CONFIG_H`
Peter Thedens's avatar
Peter Thedens committed
to use the [`unity_config.h`](/Unity/src/unity_config.h). (Details on why are in the
Peter Thedens's avatar
Peter Thedens committed
[Unity Configuration Guide](/Unity/docs/UnityConfigurationGuide.md).)
Peter Thedens's avatar
Peter Thedens committed
  - For the quad directory, this is done at compile-time of the Unity library [_here_](/Unity/src/Makefile#L4)
and at compile-time of the test runner [_here_](/quad/library.mk#L58). Both rely on the flag defined
[_here_](/quad/library.mk#L19).
Peter Thedens's avatar
Peter Thedens committed
- Follow the examples in the [`Unity/examples`](/Unity/examples) for a guide, as well
Peter Thedens's avatar
Peter Thedens committed
as the documentation in [`Unity/docs`](/Unity/docs)
Peter Thedens's avatar
Peter Thedens committed
  - The [Unity Getting Started guide](/Unity/docs/UnityGettingStartedGuide.md) and the
Peter Thedens's avatar
Peter Thedens committed
[Unity Assertions Cheat Sheet Suitable for Printing and Possibly Framing]
Peter Thedens's avatar
Peter Thedens committed
(/Unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf)
Peter Thedens's avatar
Peter Thedens committed
are nice references
  - Generally, the format is to start `main()` with `UNITY_BEGIN()`, followed by calls to
`RUN_TEST(test_function)` where `test_function` is a test to run, ended with
Peter Thedens's avatar
Peter Thedens committed
`return UNITY_END()`. Additionally, each `test_function` should be a `void` and call the
[appropriate asserts](/Unity/docs/UnityAssertionsReference.md).