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

133 Commits

Author SHA1 Message Date
Mark VanderVoord
51d2db98e2 Merge pull request #815 from JamesB192/master
🐛🐧 Try build Unity w/ -DUNITY_EXCLUDE_FLOAT_PRINT
2025-11-12 09:50:31 -05:00
James Browning
747c2ee73f Misadress style CI bot failure, my bad 2025-11-12 05:19:20 -08:00
James Browning
18c4e93767 Try build Unity w/ -UUNITY_EXCLUDE_FLOAT_PRINT 2025-11-12 04:50:06 -08:00
Mark VanderVoord
d89dafa413 Merge pull request #812 from savashn/table-of-contents
[docs] Add table of contents in Unity Assertions Reference
2025-10-27 09:42:53 -04:00
savashn
3240ac9811 add table of contents in docs 2025-10-27 10:06:33 +03:00
Mark VanderVoord
36e9b197ec Merge pull request #806 from RolandMarchand/ansi-c-comments
Convert C++ comments to ANSI C style
2025-09-29 16:16:46 -04:00
Roland Marchand
864b4ea554 Convert C++ comments to ANSI C style 2025-09-25 21:22:51 -04:00
Mark VanderVoord
0d7ea70b55 Merge pull request #798 from ml-physec/fix-details-print
Update detail-stack implementation after #784
2025-08-07 09:51:31 -04:00
ml-physec
25e9af9edd Update detail-stack implementation after #784 2025-08-07 13:52:40 +02:00
Mark VanderVoord
bddb1366a2 Merge pull request #769 from rsmyth-ecmi/MesonConfig
Add some more Meson config options
2025-07-10 13:53:28 -04:00
Mark VanderVoord
04f3d38892 Merge pull request #771 from rsmyth-ecmi/MesonFix
Fix meson pkg-config generation
2025-07-10 13:53:04 -04:00
Mark VanderVoord
3ba2bb9b27 Merge pull request #790 from rsmyth-ecmi/shebangFix
Fix up shebangs in the auto directory
2025-07-10 13:52:27 -04:00
Mark VanderVoord
0bc0fed904 Merge pull request #784 from burakutkuc/fix-assert-uint-overflow
fix: Correct UINT max value handling (thanks @burakutkuc!)
2025-07-10 08:35:42 -04:00
burakutkuc
f96b64f552 fix: fixed error from regression test results; removed the unnecessary int-uint distinction for hex values in the "array within" feature. 2025-07-10 13:35:15 +03:00
Mark VanderVoord
eb79bce1b5 Bump version to encapsulate recent changes. 2025-07-09 17:00:30 -04:00
Mark VanderVoord
fe8d1e9911 Merge pull request #792 from RossSmyth/errors
Fix up some warnings/errors
2025-07-09 15:47:35 -04:00
Ross Smyth
12705bf83f Remove warning without emits 2025-07-09 15:30:01 -04:00
Mark VanderVoord
fa03368cae Merge pull request #775 from ml-physec/more-details
Detail-Stack API
2025-07-09 15:23:44 -04:00
Ross Smyth
4a59f29362 Fix -Wmissing-prototypes errors
This one was a bit tough, but I think this works fine.
2025-07-09 15:20:47 -04:00
Ross Smyth
6decd7aa29 Wno-unused-macros and Wno-padded don't emit anything 2025-07-09 15:17:56 -04:00
Ross Smyth
faaaaa4fca Fix Wmissing-noreturn errors 2025-07-09 15:17:56 -04:00
Ross Smyth
8bac36463d Fix reserved-identifier errors
These are reserved by the standard
2025-07-09 15:17:56 -04:00
Ross Smyth
1638627cb5 Fix -Wextra-semi-stmt error with proper macro hygiene
"empty expression statement has no effect; remove unnecessary ';'"

These macros were not properly wrapped
2025-07-09 15:17:56 -04:00
Ross Smyth
442a060acd Fix clang errors in makefile 2025-07-02 21:13:09 -04:00
Ross Smyth
e4942f1a21 Fix up shebangs in the auto directory 2025-06-25 14:42:53 -04:00
Ross Smyth
4c8dab0edd Fix meson pkg-config generation
The pkg-config file does not include the subdir
in its build flags, so files will fail to find the
Unity headers.
2025-06-25 12:30:26 -04:00
burakutkuc
6a3fc440e3 fix: Add casts in function-like macros for type safety 2025-06-13 16:43:35 +03:00
burakutkuc
ac52c4182a fix: Fail when values are equal but equality is not allowed. Handled HEX asserts as unsigned; applied the same unsigned logic across all integer-based comparisons. 2025-06-13 16:25:22 +03:00
Buccno
bcb0746186 fix: Correct UINT max value handling 2025-06-05 11:00:57 +03:00
Mark VanderVoord
b9d897b5f3 Merge pull request #783 from rstahn/patch-1
Cleanup definition of UNITY_COMPARISON_T in unity_internals.h
2025-05-28 12:05:50 -04:00
Roland Stahn
50c37200b9 Fix definition of UNITY_NOT_EQUAL in unity_internals.h 2025-05-28 10:07:04 +02:00
Roland Stahn
5edda03c78 Cleanup definition of UNITY_COMPARISON_T in unity_internals.h
remove unused values UNITY_WITHIN and UNITY_UNKNOWN
update value UNITY_NOT_EQUAL
2025-05-28 09:55:17 +02:00
Mark VanderVoord
48fbee97f7 Merge pull request #781 from rstahn/patch-1
Extend UNITY_NORETURN mapping for (older) IAR compilers
2025-05-27 10:17:35 -04:00
Roland Stahn
3fb2484313 Add IAR specific mapping for UNITY_NORETURN 2025-05-27 14:33:15 +02:00
Mark VanderVoord
9578ffd885 Merge pull request #778 from yahyayozo/master
[Docs] Fix typos in docs files (Thanks for your help, @yahyayozo ! I appreciate it!)
2025-04-25 21:35:04 -04:00
yahyayozo
69478185a3 [Docs] Fix typos in docs files 2025-04-19 18:54:28 +01:00
ml-physec
bfc785c665 Add example 2025-04-16 19:21:48 +02:00
ml-physec
c359bf37b0 Initial implementation 2025-04-16 19:21:33 +02:00
Mark VanderVoord
23e8edbd64 Merge pull request #714 from jamestiotio/shuffle_tests
Add support for randomizing test execution order
2025-03-31 10:04:14 -04:00
Mark VanderVoord
64e68d9dda Merge pull request #772 from gr33kdude/master
Fix minor typo
2025-03-24 09:14:02 -04:00
Costas Akrivoulis
19da6e196b Fix minor typo 2025-03-23 22:20:34 -07:00
James Raphael Tiovalen
b0bcdb56c1 Add support for randomizing test execution order
This commit reintroduces the option to shuffle the test execution order
into the test runner. This has been tested with the temp_sensor example
project in Ceedling. Unit tests have also been successfully executed.

Signed-off-by: James Raphael Tiovalen <jamestiotio@gmail.com>
2025-03-11 00:10:05 +08:00
Ross Smyth
8badc0e070 Add fixture help message option for UNITY_CUSTOM_HELP_MSG 2025-03-05 16:31:34 -05:00
Ross Smyth
0921c263f4 Allow the memory extra and fixture extra to be enabled seperatly. 2025-03-05 16:22:46 -05:00
Mark VanderVoord
cdf1d0297e Create FUNDING.yml 2025-02-17 09:14:39 -05:00
Mark VanderVoord
ce122c4d8a Merge pull request #762 from koy-rehme-bae/fixtures_command_line_arguments
New command line options for fixtures
2025-01-21 14:43:33 -05:00
Rehme, Koy
df0b5d90b8 Add unit tests for new switches 2025-01-18 17:45:21 -07:00
Koy Rehme
459d53a821 New command line options 2025-01-08 15:38:23 -07:00
Mark VanderVoord
cbcd08fa7d Add release notes and bump version. 2025-01-01 11:53:54 -05:00
Mark VanderVoord
1a29024cc7 It's a New Year 2025-01-01 11:46:30 -05:00
Mark VanderVoord
73237c5d22 Merge pull request #745 from schorg/patch-1
Update unity_config.h
2024-08-24 17:06:36 -04:00
Mark VanderVoord
6531b4eba4 Merge pull request #747 from davidjb/patch-1
Add changelog entry for `NOT` float/double tests
2024-08-22 20:51:26 -04:00
David Beitey
6ebcd6065c Add changelog entry for NOT float/double tests
This is from 244edf6c16, an addition in v2.6.0.
2024-08-23 10:46:32 +10:00
Franz-Josef Grosch
f8be3a5eba Update unity_config.h
Corrected the #define for 64-bit support in example unity_config.h file
2024-08-14 16:40:05 +02:00
Mark VanderVoord
c546414657 - Protect against people not defining UNITY_USE_COMMAND)LINES_ARGS but enabling cmd_lines in test runner generator. (Cherry-pick PR 739)
- Fix UNITY_NORETURN usage (Cherry-pick PR 742)
- Other standards and formatting tweaks.
2024-08-01 16:01:09 -04:00
Mark VanderVoord
18fb33921f add strict match option as '-n' again.
fix style while I'm at it.
2024-06-12 22:59:08 -04:00
Mark VanderVoord
5659085418 Merge pull request #737 from andre-lei/dev/gen-testrunner-use-begin-end-macro
Update generate test runner to leverage custom UNITY_END()
2024-06-10 13:24:37 -04:00
andre-lei
35229fda30 Merge branch 'ThrowTheSwitch:master' into dev/gen-testrunner-use-begin-end-macro 2024-05-03 10:55:46 -07:00
Mark VanderVoord
1d28a99812 Merge pull request #729 from dreamer-coding-555/update_github_action
Updated main.yml
2024-04-30 16:46:17 -04:00
Michael Gene Brockus (Dreamer)
8e4c9b94cb Update main.yml 2024-04-30 14:24:34 -06:00
Mark VanderVoord
25ca536caf Merge pull request #728 from mchernosky/fix-command-line-arg-build
Fix build when UNITY_USE_COMMAND_LINE_ARGS is enabled
2024-04-26 15:01:13 -04:00
mchernosky
5ff17d6542 Label as static internal functions enabled by UNITY_USE_COMMAND_LINE_ARGS to prevent
-Werror=missing-declarations
2024-04-26 12:46:49 -06:00
Mark VanderVoord
530364d8a6 Merge pull request #726 from mrunix00/patch-1
Update the year in README.md
2024-04-26 12:07:34 -04:00
Mr.UNIX
e6f73b6ad0 Update the year in README.md 2024-04-26 16:59:59 +01:00
Mark VanderVoord
e095ac4a29 Merge pull request #723 from sdimovv/patch-2
Remove redundant line casts from `UNITY_TEST_ASSERT_*` macros
2024-04-18 09:31:56 -04:00
sdimovv
9b77170349 Remove redundant line casts from UNITY_TEST_ASSERT_* macros 2024-04-18 14:25:55 +01:00
Mark VanderVoord
c2637c54a0 Merge pull request #721 from sdimovv/patch-1
Cast line_num to allow compilation with `-WConversion`
2024-04-08 17:47:57 -04:00
sdimovv
0ace9d8273 Cast line_num to allow compilation with -WConversion 2024-04-07 02:57:16 +01:00
Mark VanderVoord
3cbe49900a Don't call assertions until after we've concluded test framework tinkering in core test (#718) 2024-03-31 18:12:31 -04:00
andre-lei
c3a3843f4c Merge branch 'ThrowTheSwitch:master' into dev/gen-testrunner-use-begin-end-macro 2024-03-20 16:00:13 -07:00
Mark VanderVoord
c444b63bfd Merge pull request #719 from fellerts/shebang
Fix shebang placement
2024-03-20 09:28:57 -04:00
Fredrik Ellertsen
f1d953a651 Fix shebang placement
671f8d2 introduced a license header to auto/extract_version.py before the
shebang, causing builds to fail like this:
  ../subprojects/unity/meson.build:7:0: ERROR: Failed running '/path/to/extract_version.py', binary or interpreter not executable.
2024-03-20 12:47:02 +01:00
Mark VanderVoord
671f8d25f1 Update all the boilerplates 2024-03-16 23:15:00 -04:00
Mark VanderVoord
85452ad154 📝 Add Code of Conduct and Contributing docs 2024-03-13 15:07:30 -04:00
Mark VanderVoord
860062d51b Fixed issue #715 (typo that disabled two tests) 2024-03-09 19:36:15 -05:00
Mark VanderVoord
e3457a85f4 Fix temperamental test in core test suite. 2024-03-09 19:26:38 -05:00
Mark VanderVoord
b512a1c184 Flesh out documentation for command line options for runner generator. 2024-03-09 18:50:25 -05:00
Mark VanderVoord
2777955d3a Document unity exec time options. 2024-03-09 18:28:42 -05:00
andre-lei
ef7f968331 Merge branch 'ThrowTheSwitch:master' into dev/gen-testrunner-use-begin-end-macro 2024-02-21 10:28:28 -08:00
Mark VanderVoord
64939db64e generate test runner: clean injected defines so the ifndef doesn't use the assignment when it exists. 2024-01-19 11:44:48 -05:00
Mark VanderVoord
b4f65573f7 Bump rubocop version 2024-01-04 16:57:45 -05:00
Mark VanderVoord
da5a45ba1c Merge pull request #706 from Skinner927/add-help-to-test-binaries
Add help option to test command line args
2023-12-04 14:10:11 -05:00
Dennis Skinner
3adb5dd7b9 Add FALLTHRU 2023-12-04 14:04:13 -05:00
Dennis Skinner
4a606dc2cd Add missing generate_test_runner.rb options to docs 2023-12-03 23:02:23 -05:00
Dennis Skinner
049ddda615 Fix tests for new help verbiage 2023-12-03 23:02:09 -05:00
Dennis Skinner
fcb4e53c36 Update help menu to use mnemonics 2023-12-03 22:07:15 -05:00
Dennis Skinner
985f6e0194 Add help option to test command line args
When test binaries are run with unknown options or with the standard
-h option, a help menu will print all available options.

This is much more convenient than having to dig through unity.c to
find every option.
2023-12-02 03:05:33 -05:00
Lei, Andre
3911b01d81 Update generate test runner to leverage custom UNITY_END() 2023-11-16 19:40:45 +00:00
Mark VanderVoord
bf560290f6 Merge pull request #656 from ThrowTheSwitch/platform_matrix
unity 2.6 release candidate
2023-11-13 17:06:15 -05:00
Mark VanderVoord
a1b1600e43 Update change log and known issues.
Fix bug with infinity and NaN handling.
2023-11-13 17:03:07 -05:00
Mark VanderVoord
3f7564ea3b Catch up on Ruby style and formatting changes. 2023-11-12 19:07:32 -05:00
Mark VanderVoord
bd32847abf Merge branch 'master' into platform_matrix 2023-11-08 00:16:40 -05:00
Mark VanderVoord
88069f045c Fix docs issues.
Update scripts to match latest rubocop.
Fix hex length of unity printf feature.
2023-11-07 23:48:48 -05:00
Mark VanderVoord
8b0daf153f Merge pull request #675 from nfarid/include-dir
Allowing #including <unity/unity.h>
2023-11-07 22:53:12 -05:00
Mark VanderVoord
b175905940 Merge pull request #701 from stevebroshar/replace-pointer-comparison-with-null-checking
Use null check instead of pointer comparison
2023-10-09 16:15:15 -04:00
SteveBroshar
7d0bcc892e use null check instead of pointer compar 2023-10-08 15:47:22 -05:00
Mark VanderVoord
dcef17bf43 Merge pull request #698 from dreamer-coding-555/add_bdd_feature
Adding bdd feature to Unity test framework
2023-09-19 09:08:12 -04:00
Mark VanderVoord
d3804d0661 Merge pull request #695 from fkjagodzinski/dev/add-user-defined-protect-and-abort
Allow user-defined TEST_PROTECT & TEST_ABORT macros
2023-09-19 07:37:15 -04:00
Michael Gene Brockus (Dreamer)
4403d97d14 Create meson.build 2023-09-15 10:22:26 -06:00
Michael Gene Brockus (Dreamer)
24c175f64f Create readme.md 2023-09-15 10:20:26 -06:00
Michael Gene Brockus (Dreamer)
a4d0150758 Rename bdd.h to unity_bdd.h 2023-09-15 10:13:06 -06:00
Michael Gene Brockus (Dreamer)
de387ef073 Create test_bdd.c 2023-09-15 10:12:34 -06:00
Michael Gene Brockus (Dreamer)
cf13244043 adding stdio 2023-09-15 09:54:32 -06:00
Michael Gene Brockus (Dreamer)
955809048c Create bdd.h 2023-09-15 09:53:34 -06:00
Mark VanderVoord
2775e1b058 Merge pull request #694 from cmachida/master
fix: TEST_PRINTF(): printing 64-bit hex numbers or pointers
2023-09-15 10:39:16 -04:00
Filip Jagodzinski
710bb58c6a Allow user-defined TEST_PROTECT & TEST_ABORT macros
However rare, this update covers real-world use cases where:
- Unity is used to provide the assertion macros only, and an external
  test harness/runner is used for test orchestration/reporting.
- Calling longjmp on a given platform is possible, but has a
  platform-specific (or implementation-specific) set of prerequisites,
e.g. privileged access level.

Enable project-specific customisation of TEST_PROTECT and TEST_ABORT
macros.
- Use the user-defined UNITY_TEST_ABORT if available; fall back to
  default behaviour otherwise.
- Use the user-defined UNITY_TEST_PROTECT if available; fall back to
  default behaviour otherwise.
- These may be defined independently.
2023-09-04 13:36:00 +02:00
cmachida
f3b2de4da2 fix: TEST_PRINTF(): printing 64-bit hex numbers or pointers 2023-08-25 17:19:21 +00:00
Mark VanderVoord
cb03c3afa7 Merge pull request #680 from JamesB192/23g06-unhandled-enumeration
Squash warnings about unhandled enumeration.
2023-08-16 11:04:42 -04:00
Mark VanderVoord
09075ea0f3 Merge pull request #692 from epsilonrt/master
fix: fixes TEST_PRINTF() expansion error #691
2023-08-16 11:02:49 -04:00
Mark VanderVoord
f9c4038341 Merge pull request #690 from ThrowTheSwitch/feature/updated-build-directives
Add/update build directives
2023-08-16 10:15:59 -04:00
Mike Karlesky
5109be3881 Missed renames of TEST_FILE() directive 2023-08-15 21:16:02 -04:00
Mark VanderVoord
20bb4355d7 Merge pull request #685 from jonhenneberg/test_matix_feature
Thanks to @jonhenneberg (especially) and @AJIOB for your work on the TEST_MATRIX feature!
2023-08-13 09:24:03 -04:00
epsilonrt
7a9e25b445 fix: fixes TEST_PRINTF() expansion error #691
fixes TEST_PRINTF() expansion error when no variadic arguments are passed
2023-08-08 22:15:56 +02:00
Michael Karlesky
aa3ca2d572 Add/update build directives
* Renamed macro `TEST_FILE()` to `TEST_SOURCE_FILE()`
* Added macro `TEST_INCLUDE_PATH()`
* Added full comment block for documentation
2023-07-29 20:20:33 -04:00
Jon Hanghøj Henneberg
5baa4580ee Fix file endings 2023-07-15 22:19:46 +02:00
Jon Hanghøj Henneberg
c97a2705b3 Add tests for TEST_MATRIX 2023-07-14 17:04:54 +02:00
Jon Hanghøj Henneberg
5dd2be96fa Add TEST_MATRIX to docs 2023-07-14 17:04:54 +02:00
Jon Hanghøj Henneberg
d593817630 Add TEST_MATIX option for parameterization
Added matrix option for parameterization that generates cases based on
the product of the given arguments.
2023-07-13 22:39:58 +02:00
Mark VanderVoord
1b9199ee38 Merge pull request #684 from detly/expose_assert_options
Expose double support as an option.
2023-07-13 07:36:18 -04:00
Jason Heeris
8a5918b81d Expose double support as an option. 2023-07-13 15:27:48 +08:00
Mark VanderVoord
924d656188 Merge pull request #681 from AJIOB/docs-typo-fix
Fix TEST_CASE description typo
2023-07-10 23:28:47 -04:00
Alex Overchenko
30b1a05c33 Fix TEST_CASE description typo 2023-07-08 23:15:15 +03:00
James Browning
e271a76a11 Squash warnings about unhandled enumeration. 2023-07-06 02:23:04 -07:00
Mark VanderVoord
8a6623990a Merge pull request #677 from ThrowTheSwitch/docs/unity_assertion_reference_fixes
Assertion reference documentation improvements
2023-06-12 14:51:33 -04:00
nfarid
b35f6b0851 Add CMAKE_INSTALL_INCLUDEDIR to INSTALL_INTERFACE's include directory
This allows one to #include <unity/unity.h>
2023-05-30 11:40:39 +01:00
Mark VanderVoord
a7639eeb54 Bump rubocop up to newer ruby versions (in progress) 2023-02-16 16:40:23 -05:00
Mark VanderVoord
7a31075b77 Bump years. 2023-02-06 16:26:36 -05:00
Mark VanderVoord
cd354d9458 Merge branch 'master' into platform_matrix 2023-02-06 15:32:39 -05:00
Mark VanderVoord
36259d46b6 Merge PR #545 2023-02-06 15:15:43 -05:00
Mark VanderVoord
5e4c587ff5 Merge branch 'master' into platform_matrix 2023-02-06 15:03:04 -05:00
Mark VanderVoord
1807cb972d Merge branch 'master' into platform_matrix 2023-02-06 14:52:01 -05:00
Mark VanderVoord
278b8dd3e2 Pull in PR #553.
Bump release.
2023-02-06 14:49:29 -05:00
Mark VanderVoord
43a3256747 Test across multiple versions of Ruby 2023-01-16 16:41:21 -05:00
138 changed files with 3291 additions and 728 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
github: ThrowTheSwitch
#patreon: # Replace with a single Patreon username
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
#polar: # Replace with a single Polar username
#buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
#thanks_dev: # Replace with a single thanks.dev username
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -15,16 +15,19 @@ jobs:
unit-tests:
name: "Unit Tests"
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2']
steps:
# Install Ruby Testing Tools
- name: Setup Ruby Testing Tools
run: |
sudo gem install rspec
sudo gem install rubocop -v 0.57.2
sudo gem install rubocop -v 1.57.2
# Checks out repository under $GITHUB_WORKSPACE
- name: Checkout Latest Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
# Run Tests
- name: Run All Unit Tests

View File

@@ -76,6 +76,7 @@ target_include_directories(${PROJECT_NAME}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:$<$<BOOL:${UNITY_EXTENSION_MEMORY_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/memory/src>>
$<BUILD_INTERFACE:$<$<BOOL:${UNITY_EXTENSION_FIXTURE_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/fixture/src>>
)

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) <year> 2007-21 Mike Karlesky, Mark VanderVoord, Greg Williams
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,6 +1,6 @@
# Unity Test ![CI][]
__Copyright (c) 2007 - 2021 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__
__Copyright (c) 2007 - 2024 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__
Welcome to the Unity Test Project, one of the main projects of ThrowTheSwitch.org.
Unity Test is a unit testing framework built for C, with a focus on working with embedded toolchains.
@@ -12,6 +12,8 @@ If you'd like to leave the hard work to us, you might be interested in Ceedling,
If you're new to Unity, we encourage you to tour the [getting started guide][].
You can also find the [change log][] and [known issues][] in our documentation.
## Getting Started
The [docs][] folder contains a [getting started guide][] and much more tips about using Unity.
@@ -54,7 +56,7 @@ The message is output stating why.
Compare two integers for equality and display errors as signed integers.
A cast will be performed to your natural integer size so often this can just be used.
When you need to specify the exact size, like when comparing arrays, you can use a specific version:
When you need to specify the exact size, you can use a specific version.
TEST_ASSERT_EQUAL_UINT(expected, actual)
TEST_ASSERT_EQUAL_UINT8(expected, actual)
@@ -72,7 +74,8 @@ Like INT, there are variants for different sizes also.
TEST_ASSERT_EQUAL_HEX64(expected, actual)
Compares two integers for equality and display errors as hexadecimal.
Like the other integer comparisons, you can specify the size... here the size will also effect how many nibbles are shown (for example, `HEX16` will show 4 nibbles).
Like the other integer comparisons, you can specify the size...
here the size will also affect how many nibbles are shown (for example, `HEX16` will show 4 nibbles).
TEST_ASSERT_EQUAL(expected, actual)
@@ -214,7 +217,8 @@ Fails if the pointer is equal to NULL
TEST_ASSERT_EQUAL_MEMORY(expected, actual, len)
Compare two blocks of memory.
This is a good generic assertion for types that can't be coerced into acting like standard types... but since it's a memory compare, you have to be careful that your data types are packed.
This is a good generic assertion for types that can't be coerced into acting like standard types...
but since it's a memory compare, you have to be careful that your data types are packed.
### \_MESSAGE
@@ -224,5 +228,7 @@ This is useful for specifying more information about the problem.
[CI]: https://github.com/ThrowTheSwitch/Unity/workflows/CI/badge.svg
[getting started guide]: docs/UnityGettingStartedGuide.md
[change log]: docs/UnityChangeLog.md
[known issues]: docs/UnityKnownIssues.md
[docs]: docs/
[UnityAssertionsReference.md]: docs/UnityAssertionsReference.md

View File

@@ -0,0 +1,7 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================

View File

@@ -1,8 +1,9 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
if RUBY_PLATFORM =~ /(win|w)32$/
begin

View File

@@ -1,8 +1,9 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
require_relative 'colour_prompt'
@@ -12,7 +13,7 @@ def report(message)
if !$colour_output
$stdout.puts(message)
else
message = message.join('\n') if message.class == Array
message = message.join('\n') if message.instance_of?(Array)
message.each_line do |line|
line.chomp!
colour = case line

View File

@@ -1,4 +1,11 @@
#!/usr/bin/env python3
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
import re
import sys

View File

@@ -1,3 +1,10 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
#this is a sample configuration file for generate_module
#you would use it by calling generate_module with the -ygenerate_config.yml option
#files like this are useful for customizing generate_module to your environment

View File

@@ -1,8 +1,9 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
# This script creates all the files with start code necessary for a new module.
# A simple module only requires a source file, header file, and test file.
@@ -13,7 +14,7 @@ require 'fileutils'
require 'pathname'
# TEMPLATE_TST
TEMPLATE_TST ||= '#ifdef TEST
TEMPLATE_TST ||= '#ifdef %5$s
#include "unity.h"
@@ -32,7 +33,7 @@ void test_%4$s_NeedToImplement(void)
TEST_IGNORE_MESSAGE("Need to Implement %1$s");
}
#endif // TEST
#endif // %5$s
'.freeze
# TEMPLATE_SRC
@@ -108,7 +109,8 @@ class UnityModuleGenerator
update_svn: false,
boilerplates: {},
test_prefix: 'Test',
mock_prefix: 'Mock'
mock_prefix: 'Mock',
test_define: 'TEST'
}
end
@@ -134,7 +136,7 @@ class UnityModuleGenerator
prefix = @options[:test_prefix] || 'Test'
triad = [{ ext: '.c', path: @options[:path_src], prefix: '', template: TEMPLATE_SRC, inc: :src, boilerplate: @options[:boilerplates][:src] },
{ ext: '.h', path: @options[:path_inc], prefix: '', template: TEMPLATE_INC, inc: :inc, boilerplate: @options[:boilerplates][:inc] },
{ ext: '.c', path: @options[:path_tst], prefix: prefix, template: TEMPLATE_TST, inc: :tst, boilerplate: @options[:boilerplates][:tst] }]
{ ext: '.c', path: @options[:path_tst], prefix: prefix, template: TEMPLATE_TST, inc: :tst, boilerplate: @options[:boilerplates][:tst], test_define: @options[:test_define] }]
# prepare the pattern for use
pattern = (pattern || @options[:pattern] || 'src').downcase
@@ -154,10 +156,11 @@ class UnityModuleGenerator
path: (Pathname.new("#{cfg[:path]}#{subfolder}") + filename).cleanpath,
name: submodule_name,
template: cfg[:template],
test_define: cfg[:test_define],
boilerplate: cfg[:boilerplate],
includes: case (cfg[:inc])
when :src then (@options[:includes][:src] || []) | (pattern_traits[:inc].map { |f| format(f, module_name) })
when :inc then (@options[:includes][:inc] || [])
when :inc then @options[:includes][:inc] || []
when :tst then (@options[:includes][:tst] || []) | (pattern_traits[:inc].map { |f| format("#{@options[:mock_prefix]}#{f}", module_name) })
end
}
@@ -168,18 +171,19 @@ class UnityModuleGenerator
end
############################
def neutralize_filename(name, start_cap = true)
def neutralize_filename(name, start_cap: true)
return name if name.empty?
name = name.split(/(?:\s+|_|(?=[A-Z][a-z]))|(?<=[a-z])(?=[A-Z])/).map(&:capitalize).join('_')
name = name[0].downcase + name[1..-1] unless start_cap
name = name[0].downcase + name[1..] unless start_cap
name
end
############################
def create_filename(part1, part2 = '')
name = part2.empty? ? part1 : part1 + '_' + part2
name = part2.empty? ? part1 : "#{part1}_#{part2}"
case (@options[:naming])
when 'bumpy' then neutralize_filename(name, false).delete('_')
when 'bumpy' then neutralize_filename(name, start_cap: false).delete('_')
when 'camel' then neutralize_filename(name).delete('_')
when 'snake' then neutralize_filename(name).downcase
when 'caps' then neutralize_filename(name).upcase
@@ -212,7 +216,8 @@ class UnityModuleGenerator
f.write(file[:template] % [file[:name],
file[:includes].map { |ff| "#include \"#{ff}\"\n" }.join,
file[:name].upcase.tr('-', '_'),
file[:name].tr('-', '_')])
file[:name].tr('-', '_'),
file[:test_define]])
end
if @options[:update_svn]
`svn add \"#{file[:path]}\"`
@@ -260,12 +265,12 @@ if $0 == __FILE__
case arg
when /^-d/ then destroy = true
when /^-u/ then options[:update_svn] = true
when /^-p\"?(\w+)\"?/ then options[:pattern] = Regexp.last_match(1)
when /^-s\"?(.+)\"?/ then options[:path_src] = Regexp.last_match(1)
when /^-i\"?(.+)\"?/ then options[:path_inc] = Regexp.last_match(1)
when /^-t\"?(.+)\"?/ then options[:path_tst] = Regexp.last_match(1)
when /^-n\"?(.+)\"?/ then options[:naming] = Regexp.last_match(1)
when /^-y\"?(.+)\"?/ then options = UnityModuleGenerator.grab_config(Regexp.last_match(1))
when /^-p"?(\w+)"?/ then options[:pattern] = Regexp.last_match(1)
when /^-s"?(.+)"?/ then options[:path_src] = Regexp.last_match(1)
when /^-i"?(.+)"?/ then options[:path_inc] = Regexp.last_match(1)
when /^-t"?(.+)"?/ then options[:path_tst] = Regexp.last_match(1)
when /^-n"?(.+)"?/ then options[:naming] = Regexp.last_match(1)
when /^-y"?(.+)"?/ then options = UnityModuleGenerator.grab_config(Regexp.last_match(1))
when /^(\w+)/
raise "ERROR: You can't have more than one Module name specified!" unless module_name.nil?

View File

@@ -1,10 +1,10 @@
#!/usr/bin/ruby
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
#!/usr/bin/env ruby
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
class UnityTestRunnerGenerator
def initialize(options = nil)
@@ -45,8 +45,11 @@ class UnityTestRunnerGenerator
cmdline_args: false,
omit_begin_end: false,
use_param_tests: false,
use_system_files: true,
include_extensions: '(?:hpp|hh|H|h)',
source_extensions: '(?:cpp|cc|ino|C|c)'
source_extensions: '(?:cpp|cc|ino|C|c)',
shuffle_tests: false,
rng_seed: 0
}
end
@@ -69,7 +72,7 @@ class UnityTestRunnerGenerator
source = source.force_encoding('ISO-8859-1').encode('utf-8', replace: nil)
tests = find_tests(source)
headers = find_includes(source)
testfile_includes = (headers[:local] + headers[:system])
testfile_includes = @options[:use_system_files] ? (headers[:local] + headers[:system]) : (headers[:local])
used_mocks = find_mocks(testfile_includes)
testfile_includes = (testfile_includes - used_mocks)
testfile_includes.delete_if { |inc| inc =~ /(unity|cmock)/ }
@@ -80,7 +83,7 @@ class UnityTestRunnerGenerator
# determine which files were used to return them
all_files_used = [input_file, output_file]
all_files_used += testfile_includes.map { |filename| filename + '.c' } unless testfile_includes.empty?
all_files_used += testfile_includes.map { |filename| "#{filename}.c" } unless testfile_includes.empty?
all_files_used += @options[:includes] unless @options[:includes].empty?
all_files_used += headers[:linkonly] unless headers[:linkonly].empty?
all_files_used.uniq
@@ -89,6 +92,7 @@ class UnityTestRunnerGenerator
def generate(input_file, output_file, tests, used_mocks, testfile_includes)
File.open(output_file, 'w') do |output|
create_header(output, used_mocks, testfile_includes)
create_run_test_params_struct(output)
create_externs(output, tests, used_mocks)
create_mock_management(output, used_mocks)
create_setup(output)
@@ -98,6 +102,7 @@ class UnityTestRunnerGenerator
create_reset(output)
create_run_test(output) unless tests.empty?
create_args_wrappers(output, tests)
create_shuffle_tests(output) if @options[:shuffle_tests]
create_main(output, input_file, tests, used_mocks)
end
@@ -132,8 +137,8 @@ class UnityTestRunnerGenerator
lines.each_with_index do |line, _index|
# find tests
next unless line =~ /^((?:\s*(?:TEST_CASE|TEST_RANGE)\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/m
next unless line =~ /^((?:\s*(?:TEST_CASE|TEST_RANGE)\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]})\w*)\s*\(\s*(.*)\s*\)/m
next unless line =~ /^((?:\s*(?:TEST_(?:CASE|RANGE|MATRIX))\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/m
next unless line =~ /^((?:\s*(?:TEST_(?:CASE|RANGE|MATRIX))\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]})\w*)\s*\(\s*(.*)\s*\)/m
arguments = Regexp.last_match(1)
name = Regexp.last_match(2)
@@ -143,14 +148,13 @@ class UnityTestRunnerGenerator
if @options[:use_param_tests] && !arguments.empty?
args = []
type_and_args = arguments.split(/TEST_(CASE|RANGE)/)
for i in (1...type_and_args.length).step(2)
if type_and_args[i] == "CASE"
type_and_args = arguments.split(/TEST_(CASE|RANGE|MATRIX)/)
(1...type_and_args.length).step(2).each do |i|
case type_and_args[i]
when 'CASE'
args << type_and_args[i + 1].sub(/^\s*\(\s*(.*?)\s*\)\s*$/m, '\1')
next
end
# RANGE
when 'RANGE'
args += type_and_args[i + 1].scan(/(\[|<)\s*(-?\d+.?\d*)\s*,\s*(-?\d+.?\d*)\s*,\s*(-?\d+.?\d*)\s*(\]|>)/m).map do |arg_values_str|
exclude_end = arg_values_str[0] == '<' && arg_values_str[-1] == '>'
arg_values_str[1...-1].map do |arg_value_str|
@@ -163,6 +167,20 @@ class UnityTestRunnerGenerator
end.map do |arg_combinations|
arg_combinations.flatten.join(', ')
end
when 'MATRIX'
single_arg_regex_string = /(?:(?:"(?:\\"|[^\\])*?")+|(?:'\\?.')+|(?:[^\s\]\["',]|\[[\d\S_-]+\])+)/.source
args_regex = /\[((?:\s*#{single_arg_regex_string}\s*,?)*(?:\s*#{single_arg_regex_string})?\s*)\]/m
arg_elements_regex = /\s*(#{single_arg_regex_string})\s*,\s*/m
args += type_and_args[i + 1].scan(args_regex).flatten.map do |arg_values_str|
"#{arg_values_str},".scan(arg_elements_regex)
end.reduce do |result, arg_range_expanded|
result.product(arg_range_expanded)
end.map do |arg_combinations|
arg_combinations.flatten.join(', ')
end
end
end
end
@@ -175,7 +193,7 @@ class UnityTestRunnerGenerator
source_lines = source.split("\n")
source_index = 0
tests_and_line_numbers.size.times do |i|
source_lines[source_index..-1].each_with_index do |line, index|
source_lines[source_index..].each_with_index do |line, index|
next unless line =~ /\s+#{tests_and_line_numbers[i][:test]}(?:\s|\()/
source_index += index
@@ -194,12 +212,11 @@ class UnityTestRunnerGenerator
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
# parse out includes
includes = {
local: source.scan(/^\s*#include\s+\"\s*(.+\.#{@options[:include_extensions]})\s*\"/).flatten,
{
local: source.scan(/^\s*#include\s+"\s*(.+\.#{@options[:include_extensions]})\s*"/).flatten,
system: source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" },
linkonly: source.scan(/^TEST_FILE\(\s*\"\s*(.+\.#{@options[:source_extensions]})\s*\"/).flatten
linkonly: source.scan(/^TEST_SOURCE_FILE\(\s*"\s*(.+\.#{@options[:source_extensions]})\s*"/).flatten
}
includes
end
def find_mocks(includes)
@@ -218,15 +235,43 @@ class UnityTestRunnerGenerator
@options[:has_suite_teardown] ||= (source =~ /int\s+suiteTearDown\s*\(int\s+([a-zA-Z0-9_])+\s*\)/)
end
def count_tests(tests)
if @options[:use_param_tests]
idx = 0
tests.each do |test|
if (test[:args].nil? || test[:args].empty?)
idx += 1
else
test[:args].each do |args|
idx += 1
end
end
end
return idx
else
return tests.size
end
end
def create_header(output, mocks, testfile_includes = [])
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
output.puts("\n/*=======Automagically Detected Files To Include=====*/")
output.puts('extern "C" {') if @options[:externcincludes]
if @options[:shuffle_tests]
output.puts('#include <stdlib.h>')
if @options[:rng_seed] == 0
output.puts('#include <time.h>')
end
end
output.puts("#include \"#{@options[:framework]}.h\"")
output.puts('#include "cmock.h"') unless mocks.empty?
output.puts('}') if @options[:externcincludes]
if @options[:defines] && !@options[:defines].empty?
@options[:defines].each { |d| output.puts("#ifndef #{d}\n#define #{d}\n#endif /* #{d} */") }
output.puts('/* injected defines for unity settings, etc */')
@options[:defines].each do |d|
def_only = d.match(/(\w+).*/)[1]
output.puts("#ifndef #{def_only}\n#define #{d}\n#endif /* #{def_only} */")
end
end
if @options[:header_file] && !@options[:header_file].empty?
output.puts("#include \"#{File.basename(@options[:header_file])}\"")
@@ -253,6 +298,16 @@ class UnityTestRunnerGenerator
output.puts('char* GlobalOrderError;')
end
def create_run_test_params_struct(output)
output.puts("\n/*=======Structure Used By Test Runner=====*/")
output.puts('struct UnityRunTestParameters')
output.puts('{')
output.puts(' UnityTestFunction func;')
output.puts(' const char* name;')
output.puts(' UNITY_LINE_TYPE line_num;')
output.puts('};')
end
def create_externs(output, tests, _mocks)
output.puts("\n/*=======External Functions This Runner Calls=====*/")
output.puts("extern void #{@options[:setup_name]}(void);")
@@ -356,7 +411,7 @@ class UnityTestRunnerGenerator
require 'erb'
file = File.read(File.join(__dir__, 'run_test.erb'))
template = ERB.new(file, trim_mode: '<>')
output.puts("\n" + template.result(binding))
output.puts("\n#{template.result(binding)}")
end
def create_args_wrappers(output, tests)
@@ -375,6 +430,22 @@ class UnityTestRunnerGenerator
end
end
def create_shuffle_tests(output)
output.puts("\n/*=======Shuffle Test Order=====*/")
output.puts('static void shuffleTests(struct UnityRunTestParameters run_test_params_arr[], int num_of_tests)')
output.puts('{')
# Use Fisher-Yates shuffle algorithm
output.puts(' for (int i = num_of_tests - 1; i > 0; i--)')
output.puts(' {')
output.puts(' int j = rand() % (i + 1);')
output.puts(' struct UnityRunTestParameters temp = run_test_params_arr[i];')
output.puts(' run_test_params_arr[i] = run_test_params_arr[j];')
output.puts(' run_test_params_arr[j] = temp;')
output.puts(' }')
output.puts('}')
end
def create_main(output, filename, tests, used_mocks)
output.puts("\n/*=======MAIN=====*/")
main_name = @options[:main_name].to_sym == :auto ? "main_#{filename.gsub('.c', '')}" : (@options[:main_name]).to_s
@@ -384,6 +455,7 @@ class UnityTestRunnerGenerator
end
output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv)")
output.puts('{')
output.puts('#ifdef UNITY_USE_COMMAND_LINE_ARGS')
output.puts(' int parse_status = UnityParseOptions(argc, argv);')
output.puts(' if (parse_status != 0)')
output.puts(' {')
@@ -406,6 +478,7 @@ class UnityTestRunnerGenerator
output.puts(' }')
output.puts(' return parse_status;')
output.puts(' }')
output.puts('#endif')
else
main_return = @options[:omit_begin_end] ? 'void' : 'int'
if main_name != 'main'
@@ -420,33 +493,61 @@ class UnityTestRunnerGenerator
else
output.puts(" UnityBegin(\"#{filename.gsub(/\\/, '\\\\\\')}\");")
end
if @options[:shuffle_tests]
output.puts
if @options[:rng_seed] == 0
output.puts(' srand(time(NULL));')
else
output.puts(" srand(#{@options[:rng_seed]});")
end
end
output.puts
output.puts(" int number_of_tests = #{count_tests(tests)};")
output.puts(' struct UnityRunTestParameters run_test_params_arr[number_of_tests];')
output.puts
idx = 0
tests.each do |test|
if (!@options[:use_param_tests]) || test[:args].nil? || test[:args].empty?
output.puts(" run_test(#{test[:test]}, \"#{test[:test]}\", #{test[:line_number]});")
output.puts(" run_test_params_arr[#{idx}].func = #{test[:test]};")
output.puts(" run_test_params_arr[#{idx}].name = \"#{test[:test]}\";")
output.puts(" run_test_params_arr[#{idx}].line_num = #{test[:line_number]};")
idx += 1
else
test[:args].each.with_index(1) do |args, idx|
wrapper = "runner_args#{idx}_#{test[:test]}"
test[:args].each.with_index(1) do |args, arg_idx|
wrapper = "runner_args#{arg_idx}_#{test[:test]}"
testname = "#{test[:test]}(#{args})".dump
output.puts(" run_test(#{wrapper}, #{testname}, #{test[:line_number]});")
output.puts(" run_test_params_arr[#{idx}].func = #{wrapper};")
output.puts(" run_test_params_arr[#{idx}].name = #{testname};")
output.puts(" run_test_params_arr[#{idx}].line_num = #{test[:line_number]};")
idx += 1
end
end
end
output.puts
if @options[:shuffle_tests]
output.puts(' shuffleTests(run_test_params_arr, number_of_tests);')
output.puts
end
output.puts(' for (int i = 0; i < number_of_tests; i++)')
output.puts(' {')
output.puts(' run_test(run_test_params_arr[i].func, run_test_params_arr[i].name, run_test_params_arr[i].line_num);')
output.puts(' }')
output.puts
output.puts(' CMock_Guts_MemFreeFinal();') unless used_mocks.empty?
if @options[:has_suite_teardown]
if @options[:omit_begin_end]
output.puts(' (void) suite_teardown(0);')
else
output.puts(' return suiteTearDown(UnityEnd());')
output.puts(' return suiteTearDown(UNITY_END());')
end
else
output.puts(' return UnityEnd();') unless @options[:omit_begin_end]
output.puts(' return UNITY_END();') unless @options[:omit_begin_end]
end
output.puts('}')
end
def create_h_file(output, filename, tests, testfile_includes, used_mocks)
filename = File.basename(filename).gsub(/[-\/\\\.\,\s]/, '_').upcase
filename = File.basename(filename).gsub(/[-\/\\.,\s]/, '_').upcase
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
output.puts("#ifndef _#{filename}")
output.puts("#define _#{filename}\n\n")
@@ -485,7 +586,7 @@ if $0 == __FILE__
when /\.*\.ya?ml$/
options = UnityTestRunnerGenerator.grab_config(arg)
true
when /--(\w+)=\"?(.*)\"?/
when /--(\w+)="?(.*)"?/
options[Regexp.last_match(1).to_sym] = Regexp.last_match(2)
true
when /\.*\.(?:hpp|hh|H|h)$/
@@ -516,8 +617,10 @@ if $0 == __FILE__
' --suite_setup="" - code to execute for setup of entire suite',
' --suite_teardown="" - code to execute for teardown of entire suite',
' --use_param_tests=1 - enable parameterized tests (disabled by default)',
' --omit_begin_end=1 - omit calls to UnityBegin and UnityEnd (disabled by default)',
' --header_file="" - path/name of test header file to generate too'].join("\n")
' --omit_begin_end=1 - omit calls to UnityBegin and UNITY_END (disabled by default)',
' --header_file="" - path/name of test header file to generate too',
' --shuffle_tests=1 - enable shuffling of the test execution order (disabled by default)',
' --rng_seed=1 - seed value for randomization of test execution order'].join("\n")
exit 1
end

View File

@@ -1,3 +1,10 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
#============================================================
# Author: John Theofanopoulos
# A simple parser. Takes the output files generated during the
@@ -56,7 +63,7 @@ class ParseOutput
# Set the flag to indicate if there will be an XML output file or not
def test_suite_name=(cli_arg)
@real_test_suite_name = cli_arg
puts 'Real test suite name will be \'' + @real_test_suite_name + '\''
puts "Real test suite name will be '#{@real_test_suite_name}'"
end
def xml_encode_s(str)
@@ -75,7 +82,7 @@ class ParseOutput
# Pushes the suite info as xml to the array list, which will be written later
def push_xml_output_suite_info
# Insert opening tag at front
heading = '<testsuite name=' + xml_encode_s(@real_test_suite_name) + ' tests="' + @total_tests.to_s + '" failures="' + @test_failed.to_s + '"' + ' skips="' + @test_ignored.to_s + '">'
heading = "<testsuite name=#{xml_encode_s(@real_test_suite_name)} tests=\"#{@total_tests}\" failures=\"#{@test_failed}\" skips=\"#{@test_ignored}\">"
@array_list.insert(0, heading)
# Push back the closing tag
@array_list.push '</testsuite>'
@@ -83,20 +90,20 @@ class ParseOutput
# Pushes xml output data to the array list, which will be written later
def push_xml_output_passed(test_name, execution_time = 0)
@array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s((execution_time / 1000.0).to_s) + ' />'
@array_list.push " <testcase classname=#{xml_encode_s(@test_suite)} name=#{xml_encode_s(test_name)} time=#{xml_encode_s((execution_time / 1000.0).to_s)} />"
end
# Pushes xml output data to the array list, which will be written later
def push_xml_output_failed(test_name, reason, execution_time = 0)
@array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s((execution_time / 1000.0).to_s) + '>'
@array_list.push ' <failure type="ASSERT FAILED">' + reason + '</failure>'
@array_list.push " <testcase classname=#{xml_encode_s(@test_suite)} name=#{xml_encode_s(test_name)} time=#{xml_encode_s((execution_time / 1000.0).to_s)} >"
@array_list.push " <failure type=\"ASSERT FAILED\">#{reason}</failure>"
@array_list.push ' </testcase>'
end
# Pushes xml output data to the array list, which will be written later
def push_xml_output_ignored(test_name, reason, execution_time = 0)
@array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s((execution_time / 1000.0).to_s) + '>'
@array_list.push ' <skipped type="TEST IGNORED">' + reason + '</skipped>'
@array_list.push " <testcase classname=#{xml_encode_s(@test_suite)} name=#{xml_encode_s(test_name)} time=#{xml_encode_s((execution_time / 1000.0).to_s)} >"
@array_list.push " <skipped type=\"TEST IGNORED\">#{reason}</skipped>"
@array_list.push ' </testcase>'
end
@@ -144,7 +151,7 @@ class ParseOutput
test_name = array[1]
test_suite_verify(class_name)
reason_array = array[2].split(':')
reason = reason_array[-1].lstrip.chomp + ' at line: ' + reason_array[-4]
reason = "#{reason_array[-1].lstrip.chomp} at line: #{reason_array[-4]}"
printf "%-40s FAILED\n", test_name
@@ -189,12 +196,12 @@ class ParseOutput
def test_failed(array)
# ':' symbol will be valid in function args now
real_method_name = array[@result_usual_idx - 1..-3].join(':')
array = array[0..@result_usual_idx - 3] + [real_method_name] + array[-2..-1]
array = array[0..@result_usual_idx - 3] + [real_method_name] + array[-2..]
last_item = array.length - 1
test_time = get_test_time(array[last_item])
test_name = array[last_item - 2]
reason = array[last_item].chomp.lstrip + ' at line: ' + array[last_item - 3]
reason = "#{array[last_item].chomp.lstrip} at line: #{array[last_item - 3]}"
class_name = array[@class_name_idx]
if test_name.start_with? 'TEST('
@@ -217,7 +224,7 @@ class ParseOutput
def test_ignored(array)
# ':' symbol will be valid in function args now
real_method_name = array[@result_usual_idx - 1..-3].join(':')
array = array[0..@result_usual_idx - 3] + [real_method_name] + array[-2..-1]
array = array[0..@result_usual_idx - 3] + [real_method_name] + array[-2..]
last_item = array.length - 1
test_time = get_test_time(array[last_item])
@@ -268,7 +275,7 @@ class ParseOutput
def process(file_name)
@array_list = []
puts 'Parsing file: ' + file_name
puts "Parsing file: #{file_name}"
@test_passed = 0
@test_failed = 0
@@ -333,17 +340,17 @@ class ParseOutput
@test_ignored += 1
elsif line_array.size >= 4
# We will check output from color compilation
if line_array[@result_usual_idx..-1].any? { |l| l.include? 'PASS' }
if line_array[@result_usual_idx..].any? { |l| l.include? 'PASS' }
test_passed(line_array)
@test_passed += 1
elsif line_array[@result_usual_idx..-1].any? { |l| l.include? 'FAIL' }
elsif line_array[@result_usual_idx..].any? { |l| l.include? 'FAIL' }
test_failed(line_array)
@test_failed += 1
elsif line_array[@result_usual_idx..-2].any? { |l| l.include? 'IGNORE' }
test_ignored(line_array)
@test_ignored += 1
elsif line_array[@result_usual_idx..-1].any? { |l| l.include? 'IGNORE' }
line_array.push('No reason given (' + get_test_time(line_array[@result_usual_idx..-1]).to_s + ' ms)')
elsif line_array[@result_usual_idx..].any? { |l| l.include? 'IGNORE' }
line_array.push("No reason given (#{get_test_time(line_array[@result_usual_idx..])} ms)")
test_ignored(line_array)
@test_ignored += 1
end
@@ -353,9 +360,9 @@ class ParseOutput
puts ''
puts '=================== SUMMARY ====================='
puts ''
puts 'Tests Passed : ' + @test_passed.to_s
puts 'Tests Failed : ' + @test_failed.to_s
puts 'Tests Ignored : ' + @test_ignored.to_s
puts "Tests Passed : #{@test_passed}"
puts "Tests Failed : #{@test_failed}"
puts "Tests Ignored : #{@test_ignored}"
return unless @xml_out

View File

@@ -2,7 +2,7 @@
static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num)
{
Unity.CurrentTestName = name;
Unity.CurrentTestLineNumber = line_num;
Unity.CurrentTestLineNumber = (UNITY_UINT) line_num;
#ifdef UNITY_USE_COMMAND_LINE_ARGS
if (!UnityTestMatches())
return;

View File

@@ -1,11 +1,11 @@
#! python3
# ==========================================
# Fork from Unity Project - A Test Framework for C
# Pull request on Gerrit in progress, the objective of this file is to be deleted when official Unity deliveries
# include that modification
# Copyright (c) 2015 Alexander Mueller / XelaRellum@web.de
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
#!/usr/bin/env python3
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
import sys
import os
from glob import glob

View File

@@ -1,14 +1,16 @@
#!/usr/bin/ruby
#
# unity_to_junit.rb
#
#!/usr/bin/env ruby
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
require 'fileutils'
require 'optparse'
require 'ostruct'
require 'set'
require 'pp'
VERSION = 1.0
class ArgvParser
@@ -99,7 +101,7 @@ class UnityToJUnit
test_file = if test_file_str.length < 2
result_file
else
test_file_str[0] + ':' + test_file_str[1]
"#{test_file_str[0]}:#{test_file_str[1]}"
end
result_output[:source][:path] = File.dirname(test_file)
result_output[:source][:file] = File.basename(test_file)

View File

@@ -1,8 +1,9 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
require_relative 'yaml_helper'
@@ -15,6 +16,7 @@ module RakefileHelpers
file = 'test_file_filter.yml'
return unless File.exist?(file)
filters = YamlHelper.load_file(file)
@all_files = filters[:all_files]
@only_files = filters[:only_files]

View File

@@ -1,6 +1,13 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
module TypeSanitizer
def self.sanitize_c_identifier(unsanitized)
# convert filename to valid C identifier by replacing invalid chars with '_'
unsanitized.gsub(/[-\/\\\.\,\s]/, '_')
unsanitized.gsub(/[-\/\\.,\s]/, '_')
end
end

View File

@@ -1,10 +1,11 @@
#! python3
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2015 Alexander Mueller / XelaRellum@web.de
# [Released under MIT License. Please refer to license.txt for details]
# Based on the ruby script by Mike Karlesky, Mark VanderVoord, Greg Williams
# ==========================================
#!/usr/bin/env python3
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
import sys
import os
import re

View File

@@ -1,10 +1,11 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
#!/usr/bin/env ruby
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
# !/usr/bin/ruby
#
# unity_test_summary.rb
#
@@ -86,7 +87,11 @@ class UnityTestSummary
def get_details(_result_file, lines)
results = { failures: [], ignores: [], successes: [] }
lines.each do |line|
_src_file, _src_line, _test_name, status, _msg = line.split(/:/)
status_match = line.match(/^[^:]+:[^:]+:\w+(?:\([^)]*\))?:([^:]+):?/)
next unless status_match
status = status_match.captures[0]
line_out = (@root && (@root != 0) ? "#{@root}#{line}" : line).gsub(/\//, '\\')
case status
when 'IGNORE' then results[:ignores] << line_out
@@ -108,7 +113,7 @@ if $0 == __FILE__
# parse out the command options
opts, args = ARGV.partition { |v| v =~ /^--\w+/ }
opts.map! { |v| v[2..-1].to_sym }
opts.map! { |v| v[2..].to_sym }
# create an instance to work with
uts = UnityTestSummary.new(opts)
@@ -124,7 +129,7 @@ if $0 == __FILE__
uts.targets = results
# set the root path
args[1] ||= Dir.pwd + '/'
args[1] ||= "#{Dir.pwd}/"
uts.root = ARGV[1]
# run the summarizer

View File

@@ -1,15 +1,19 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
require 'yaml'
module YamlHelper
def self.load(body)
YAML.respond_to?(:unsafe_load) ?
YAML.unsafe_load(body) : YAML.load(body)
if YAML.respond_to?(:unsafe_load)
YAML.unsafe_load(body)
else
YAML.load(body)
end
end
def self.load_file(file)

138
docs/CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,138 @@
# ThrowTheSwitch.org Code of Conduct
Thank you for participating in a ThrowTheSwitch.org community project! We want
this to continue to be a warm and inviting place for everyone to share ideas
and get help. To accomplish this goal, we've developed this Code of Conduct.
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
hello@thingamabyte.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

238
docs/CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,238 @@
# Contributing to a ThrowTheSwitch.org Project
👍🎉 _First off, thanks for taking the time to contribute!_ 🎉👍
The following is a set of guidelines for contributing to any of ThrowTheSwitch.org's projects or the website itself, hosted at throwtheswitch.org or ThrowTheSwitch's organization on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
### Table Of Contents
- [Code of Conduct](#book-code-of-conduct)
- [Asking Questions](#bulb-asking-questions)
- [Opening an Issue](#inbox_tray-opening-an-issue)
- [Feature Requests](#love_letter-feature-requests)
- [Triaging Issues](#mag-triaging-issues)
- [Submitting Pull Requests](#repeat-submitting-pull-requests)
- [Writing Commit Messages](#memo-writing-commit-messages)
- [Code Review](#white_check_mark-code-review)
- [Coding Style](#nail_care-coding-style)
- [Certificate of Origin](#medal_sports-certificate-of-origin)
- [Credits](#pray-credits)
## :book: Code of Conduct
Please review our [Code of Conduct](CODE_OF_CONDUCT.md). It is in effect at all times. We expect it to be honored by everyone who contributes to this project. Be a Good Human!
## :bulb: Asking Questions
> **Note:** Please don't file an issue to ask a question. We have an official forum where the community chimes in with helpful advice if you have questions.
* [ThrowTheSwitch Forums](https://throwtheswitch.org/forums)
### What should I know before I get started?
ThrowTheSwitch hosts a number of open source projects &mdash; Ceedling is the entrypoint for many users. Ceedling is actually built upon the foundation of Unity Test (a flexible C testing framework) and CMock (a mocking tool for C) and it coordinates many other open source and proprietary tools. Please do your best to focus your ideas and questions at the correct tool. We'll do our best to help you find your way, but there will be times where we'll have to direct your attention to another subtool.
Here are some of the main projects hosted by ThrowTheSwitch.org:
- [Ceedling](https://www.github.com/throwtheswitch/ceedling) -- Build coordinator for testing C applications, especially embedded C (and optionally your release build too!)
- [CMock](https://www.github.com/throwtheswitch/cmock) -- Mocking tool for automatically creating stubs, mocks, and skeletons in C
- [Unity](https://www.github.com/throwtheswitch/unity) -- Unit Testing framework for C, specially embedded C.
- [MadScienceLabDocker](https://www.github.com/throwtheswitch/madsciencelabdocker) -- Docker image giving you a shortcut to getting running with Ceedling
- [CException](https://www.github.com/throwtheswitch/cexception) -- An exception framework for using simple exceptions in C.
There are many more, but this list should be a good starting point.
## :inbox_tray: Opening an Issue
Before [creating an issue](https://help.github.com/en/github/managing-your-work-on-github/creating-an-issue), check if you are using the latest version of the project. If you are not up-to-date, see if updating fixes your issue first.
### :beetle: Bug Reports and Other Issues
A great way to contribute to the project is to send a detailed issue when you encounter a problem. We always appreciate a well-written, thorough bug report. :v:
In short, since you are most likely a developer, **provide a ticket that you would like to receive**.
- **Review the documentation** before opening a new issue.
- **Do not open a duplicate issue!** Search through existing issues to see if your issue has previously been reported. If your issue exists, comment with any additional information you have. You may simply note "I have this problem too", which helps prioritize the most common problems and requests.
- **Prefer using [reactions](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)**, not comments, if you simply want to "+1" an existing issue.
- **Fully complete the provided issue template.** The bug report template requests all the information we need to quickly and efficiently address your issue. Be clear, concise, and descriptive. Provide as much information as you can, including steps to reproduce, stack traces, compiler errors, library versions, OS versions, and screenshots (if applicable).
- **Use [GitHub-flavored Markdown](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax).** Especially put code blocks and console outputs in backticks (```). This improves readability.
## :seedling: Feature Requests
Feature requests are welcome! We don't have all the answers and we truly love the collaborative experience of building software together! That being said, we cannot guarantee your request will be accepted. We want to avoid [feature creep](https://en.wikipedia.org/wiki/Feature_creep). Your idea may be great, but also out-of-scope for the project. If accepted, we'll do our best to tackle it in a timely manner, but cannot make any commitments regarding the timeline for implementation and release. However, you are welcome to submit a pull request to help!
- **Please don't open a duplicate feature request.** Search for existing feature requests first. If you find your feature (or one very similar) previously requested, comment on that issue.
- **Fully complete the provided issue template.** The feature request template asks for all necessary information for us to begin a productive conversation.
- Be precise about the proposed outcome of the feature and how it relates to existing features. Include implementation details if possible.
## :mag: Triaging Issues
You can triage issues which may include reproducing bug reports or asking for additional information, such as version numbers or reproduction instructions. Any help you can provide to quickly resolve an issue is very much appreciated!
## :repeat: Submitting Pull Requests
We **love** pull requests! Before [forking the repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) and [creating a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests) for non-trivial changes, it is usually best to first open an issue to discuss the changes, or discuss your intended approach for solving the problem in the comments for an existing issue.
For most contributions, after your first pull request is accepted and merged, you will be [invited to the project](https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository) and given **push access**. :tada:
*Note: All contributions will be licensed under the project's license.*
- **Smaller is better.** Submit **one** pull request per bug fix or feature. A pull request should contain isolated changes pertaining to a single bug fix or feature implementation. **Do not** refactor or reformat code that is unrelated to your change. It is better to **submit many small pull requests** rather than a single large one. Enormous pull requests will take enormous amounts of time to review, or may be rejected altogether.
- **Coordinate bigger changes.** For large and non-trivial changes, open an issue to discuss a strategy with the maintainers. Otherwise, you risk doing a lot of work for nothing!
- **Prioritize understanding over cleverness.** Write code clearly and concisely. Remember that source code usually gets written once and read often. Ensure the code is clear to the reader. The purpose and logic should be obvious to a reasonably skilled developer, otherwise you should add a comment that explains it.
- **Follow existing coding style and conventions.** Keep your code consistent with the style, formatting, and conventions in the rest of the code base. When possible, these will be enforced with a linter. Consistency makes it easier to review and modify in the future.
- **Include test coverage.** Add unit tests when possible. Follow existing patterns for implementing tests.
- **Update the example project** if one exists to exercise any new functionality you have added.
- **Add documentation.** Document your changes with code doc comments or in existing guides.
- **Update the CHANGELOG** for all enhancements and bug fixes. Include the corresponding issue number if one exists, and your GitHub username. (example: "- Fixed crash in profile view. #123 @jessesquires")
- **Use the repo's default branch.** Branch from and [submit your pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) to the repo's default branch. Usually this is `main`, but it could be `dev`, `develop`, or `master`.
- **[Resolve any merge conflicts](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/resolving-a-merge-conflict-on-github)** that occur.
- **Promptly address any CI failures**. If your pull request fails to build or pass tests, please push another commit to fix it.
- When writing comments, use properly constructed sentences, including punctuation.
- Use spaces, not tabs.
## :memo: Writing Commit Messages
Please [write a great commit message](https://chris.beams.io/posts/git-commit/).
1. Separate subject from body with a blank line
1. Limit the subject line to 50 characters
1. Capitalize the subject line
1. Do not end the subject line with a period
1. Wrap the body at _about_ 72 characters
1. Use the body to explain **why**, *not what and how* (the code shows that!)
1. If applicable, prefix the title with the relevant component name or emoji (see below. examples: "[Docs] Fix typo", "[Profile] Fix missing avatar")
```
:palm_tree: Summary of Amazing Feature Here
Add a more detailed explanation here, if necessary. Possibly give
some background about the issue being fixed, etc. The body of the
commit message can be several paragraphs. Further paragraphs come
after blank lines and please do proper word-wrap.
Wrap it to about 72 characters or so. In some contexts,
the first line is treated as the subject of the commit and the
rest of the text as the body. The blank line separating the summary
from the body is critical (unless you omit the body entirely);
various tools like `log`, `shortlog` and `rebase` can get confused
if you run the two together.
Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how or what. The code explains
how or what. Reviewers and your future self can read the patch,
but might not understand why a particular solution was implemented.
Are there side effects or other unintuitive consequences of this
change? Here's the place to explain them.
- Bullet points are awesome, too
- A hyphen should be used for the bullet, preceded
by a single space, with blank lines in between
Note the fixed or relevant GitHub issues at the end:
Resolves: #123
See also: #456, #789
```
## :heart: Who Loves Emoji?
Commit comments, Issues, Feature Requests... they can all use a little sprucing up, right? Consider using the following emoji for a mix of function and :sparkles: dazzle!
- actions
- :seedling: `:seedling:` (or other plants) when growing new features. Choose your fav! :cactus: :herb: :evergreen_tree: :palm_tree: :deciduous_tree: :blossom:
- :art: `:art:` when improving the format/structure of the code
- :racehorse: `:racehorse:` when improving performance
- :non-potable_water: `:non-potable_water:` when plugging memory leaks
- :memo: `:memo:` when writing docs
- :bug: `:bug:` (or other insects) when fixing a bug. Maybe :beetle: :ant: or :honeybee: ?
- :fire: `:fire:` when removing code or files
- :green_heart: `:green_heart:` when fixing the CI build
- :white_check_mark: `:white_check_mark:` when adding tests
- :lock: `:lock:` when dealing with security
- :arrow_up: `:arrow_up:` when upgrading dependencies
- :arrow_down: `:arrow_down:` when downgrading dependencies
- :shirt: `:shirt:` when removing linter warnings
- platforms
- :penguin: `:penguin:` when fixing something on Linux
- :apple: `:apple:` when fixing something on macOS
- :checkered_flag: `:checkered_flag:` when fixing something on Windows
## :white_check_mark: Code Review
- **Review the code, not the author.** Look for and suggest improvements without disparaging or insulting the author. Provide actionable feedback and explain your reasoning.
- **You are not your code.** When your code is critiqued, questioned, or constructively criticized, remember that you are not your code. Do not take code review personally.
- **Always do your best.** No one writes bugs on purpose. Do your best, and learn from your mistakes.
- Kindly note any violations to the guidelines specified in this document.
## :violin: Coding Style
Consistency is the most important. Following the existing style, formatting, and naming conventions of the file you are modifying and of the overall project. Failure to do so will result in a prolonged review process that has to focus on updating the superficial aspects of your code, rather than improving its functionality and performance.
For example, if all private properties are prefixed with an underscore `_`, then new ones you add should be prefixed in the same way. Or, if methods are named using camelcase, like `thisIsMyNewMethod`, then do not diverge from that by writing `this_is_my_new_method`. You get the idea. If in doubt, please ask or search the codebase for something similar.
When possible, style and format will be enforced with a linter.
### C Styleguide
C code is linted with [AStyle](https://astyle.sourceforge.net/).
### Ruby Styleguide
Ruby code is linted with [Rubocop](https://github.com/rubocop/rubocop)
## :medal_sports: Certificate of Origin
*Developer's Certificate of Origin 1.1*
By making a contribution to this project, I certify that:
> 1. The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
> 1. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
> 1. The contribution was provided directly to me by some other person who certified (1), (2) or (3) and I have not modified it.
> 1. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
## [No Brown M&M's](https://en.wikipedia.org/wiki/Van_Halen#Contract_riders)
If you are reading this, bravo dear user and (hopefully) contributor for making it this far! You are awesome. :100:
To confirm that you have read this guide and are following it as best as possible, **include this emoji at the top** of your issue or pull request: :pineapple: `:pineapple:`
## :pray: Credits
Written by [@jessesquires](https://github.com/jessesquires). Lovingly adapted to ThrowTheSwitch.org by [@mvandervoord](https://github.com/mvandervoord).
**Please feel free to adopt this guide in your own projects. Fork it wholesale or remix it for your needs.**
*Many of the ideas and prose for the statements in this document were based on or inspired by work from the following communities:*
- [Alamofire](https://github.com/Alamofire/Alamofire/blob/master/CONTRIBUTING.md)
- [CocoaPods](https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md)
- [Docker](https://github.com/moby/moby/blob/master/CONTRIBUTING.md)
- [Linux](https://elinux.org/Developer_Certificate_Of_Origin)
*We commend them for their efforts to facilitate collaboration in their projects.*

View File

@@ -90,7 +90,7 @@ Take a look through the file names in Ceedling and you'll get a good idea of wha
Why use preprocess when you can use preprocessinator?
Or what better describes a module in charge of invoking tasks during releases than release_invoker?
Don't get carried away.
The names are still descriptive and fulfil the above requirements, but they don't feel stale.
The names are still descriptive and fulfill the above requirements, but they don't feel stale.
## C and C++ Details

View File

@@ -1,5 +1,35 @@
# Unity Assertions Reference
## Table of Contents
1. [Background and Overview](#background-and-overview)
1. [Super Condensed Version](#super-condensed-version)
2. [Unity Is Several Things But Mainly Its Assertions](#unity-is-several-things-but-mainly-its-assertions)
3. [Whats an Assertion?](#whats-an-assertion)
4. [Unitys Assertions: Helpful Messages _and_ Free Source Code Documentation](#unitys-assertions-helpful-messages-and-free-source-code-documentation)
2. [Assertion Conventions and Configurations](#assertion-conventions-and-configurations)
1. [Naming and Parameter Conventions](#naming-and-parameter-conventions)
2. [TEST_ASSERT_EACH_EQUAL_X Variants](#test_assert_each_equal_x-variants)
3. [Configuration](#configuration)
3. [The Assertions in All Their Blessed Glory](#the-assertions-in-all-their-blessed-glory)
1. [Basic Fail, Pass and Ignore](#basic-fail-pass-and-ignore)
2. [Boolean](#boolean)
3. [Signed and Unsigned Integers (of all sizes)](#signed-and-unsigned-integers-of-all-sizes)
4. [Unsigned Integers (of all sizes) in Hexadecimal](#unsigned-integers-of-all-sizes-in-hexadecimal)
5. [Characters](#characters)
6. [Masked and Bit-level Assertions](#masked-and-bit-level-assertions)
7. [Integer Less Than / Greater Than](#integer-less-than--greater-than)
8. [Integer Ranges (of all sizes)](#integer-ranges-of-all-sizes)
9. [Structs and Strings](#structs-and-strings)
10. [Arrays](#arrays)
11. [Integer Array Ranges (of all sizes)](#integer-array-ranges-of-all-sizes)
12. [Each Equal (Arrays to Single Value)](#each-equal-arrays-to-single-value)
13. [Floating Point (If enabled)](#floating-point-if-enabled)
14. [Double (If enabled)](#double-if-enabled)
4. [Advanced Asserting: Details On Tricky Assertions](#advanced-asserting-details-on-tricky-assertions)
1. [How do the EQUAL assertions work for FLOAT and DOUBLE?](#how-do-the-equal-assertions-work-for-float-and-double)
2. [How do we deal with targets with non-standard int sizes?](#how-do-we-deal-with-targets-with-non-standard-int-sizes)
## Background and Overview
### Super Condensed Version

110
docs/UnityChangeLog.md Normal file
View File

@@ -0,0 +1,110 @@
# Unity Test - Change Log
## A Note
This document captures significant features and fixes to the Unity project core source files
and scripts. More detail can be found in the history on Github.
This project is now tracking changes in more detail. Previous releases get less detailed as
we move back in histroy.
Prior to 2012, the project was hosted on SourceForge.net
Prior to 2008, the project was an internal project and not released to the public.
## Log
### Unity 2.6.1 (Jan 2025)
New Features:
- Add `-n` comand line option as strict matcher again
Significant Bugfixes:
- Protect against problems when mis-matched command line options selected
Other:
- Protect against Conversion warnings in gcc
- Remove Redundant line-casts
- Make more internal functions static
### Unity 2.6.0 (Mar 2024)
New Features:
- Fill out missing variations of arrays, within, etc.
- Add `TEST_PRINTF()`
- Add `TEST_MATRIX()` and `TEST_RANGE()` options and documentation
- Add support for searching `TEST_SOURCE_FILE()` for determining test dependencies
- Add Unity BDD plugin
- Add `UNITY_INCLUDE_EXEC_TIME` option to report test times
- Allow user to override test abort underlying mechanism
- Add `NOT_EQUAL*` and `NOT_WITHIN*` checks for floats and doubles
Significant Bugfixes:
- More portable validation of NaN and Infinity. Added `UNITY_IS_NAN` and `UNITY_IS_INF` options
- Add `UNITY_PROGMEM` configuration option
- Fix overflow detection of hex values when using arrays
- Fix scripts broken by Ruby standard changes
Other:
- Avoid pointer comparison when one is null to avoid compiler warnings
- Significant improvements to documentation
- Updates to match latest Ruby style specification
- Meson, CMake, PlatformIO builds
### Unity 2.5.2 (January 2021)
- improvements to RUN_TEST macro and generated RUN_TEST
- Fix `UNITY_TEST_ASSERT_BIT(S)_HIGH`
- Cleaner handling of details tracking by CMock
### Unity 2.5.1 (May 2020)
Mostly a bugfix and stability release.
Bonus Features:
- Optional TEST_PRINTF macro
- Improve self-testing procedures.
### Unity 2.5.0 (October 2019)
It's been a LONG time since the last release of Unity. Finally, here it is!
There are too many updates to list here, so some highlights:
- more standards compliant (without giving up on supporting ALL compilers, no matter how quirky)
- many more specialized assertions for better test feedback
- more examples for integrating into your world
- many many bugfixes and tweaks
### Unity 2.4.3 (November 2017)
- Allow suiteSetUp() and suiteTearDown() to be povided as normal C functions
- Fix & Expand Greater Than / Less Than assertions for integers
- Built-in option to colorize test results
- Documentation updates
### Unity 2.4.2 (September 2017)
- Fixed bug in UNTY_TEST_ASSERT_EACH_EQUAL_*
- Added TEST_ASSERT_GREATER_THAN and TEST_ASSERT_LESS_THAN
- Updated Module Generator to stop changing names when no style given
- Cleanup to custom float printing for accuracy
- Cleanup incorrect line numbers are partial name matching
- Reduce warnings from using popular function names as variable names
### Unity 2.4.1 (April 2017)
- test runner generator can inject defines as well as headers
- added a built-in floating point print routine instead of relying on printf
- updated to new coding and naming standard
- updated documentation to be markdown instead of pdf
- fixed many many little bugs, most of which were supplied by the community (you people are awesome!)
- coding standard actually enforced in CI
### Unity 2.4.0 (October, 2016)
- port from SourceForge and numerous bugfixes

View File

@@ -33,7 +33,7 @@ In either case, you've got a couple choices for configuring these options:
Unfortunately, it doesn't usually work well to just #define these things in the test itself.
These defines need to take effect where ever unity.h is included.
This would be test test, the test runner (if you're generating one), and from unity.c when it's compiled.
This would be the test, the test runner (if you're generating one), and from unity.c when it's compiled.
## The Options
@@ -222,6 +222,17 @@ _Example:_
#define UNITY_FLOAT_PRECISION 0.001f
```
#### `UNITY_IS_NAN` and `UNITY_IS_INF`
If your toolchain defines `isnan` and `isinf` in `math.h` as macros, nothing needs to be done. If your toolchain doesn't define these, Unity
will create these macros itself. You may override either or both of these defines to specify how you want to evaluate if a number is NaN or Infinity.
_Example:_
```C
#define UNITY_IS_NAN(n) ((n != n) ? 1 : 0)
```
### Miscellaneous
#### `UNITY_EXCLUDE_STDDEF_H`
@@ -399,6 +410,68 @@ _Example:_
#define UNITY_EXCLUDE_SETJMP
```
#### `UNITY_TEST_PROTECT`
#### `UNITY_TEST_ABORT`
Unity handles test failures via `setjmp`/`longjmp` pair by default. As mentioned above, you can disable this with `UNITY_EXCLUDE_SETJMP`. You can also customise what happens on every `TEST_PROTECT` and `TEST_ABORT` call. This can be accomplished by providing user-defined `UNITY_TEST_PROTECT` and `UNITY_TEST_ABORT` macros (and these may be defined independently).
`UNITY_TEST_PROTECT` is used as an `if` statement expression, and has to evaluate to `true` on the first call (when saving stack environment with `setjmp`), and to `false` when it returns as a result of a `TEST_ABORT` (when restoring the stack environment with `longjmp`).
Whenever an assert macro fails, `TEST_ABORT` is used to restore the stack environment previously set by `TEST_PROTECT`. This part may be overriden with `UNITY_TEST_ABORT`, e.g. if custom failure handling is needed.
_Example 1:_
Calling `longjmp` on your target is possible, but has a platform-specific (or implementation-specific) set of prerequisites, e.g. privileged access level. You can extend the default behaviour of `TEST_PROTECT` and `TEST_ABORT` as:
`unity_config.h`:
```C
#include "my_custom_test_handlers.h"
#define UNITY_TEST_PROTECT() custom_test_protect()
#define UNITY_TEST_ABORT() custom_test_abort()
```
`my_custom_test_handlers.c`:
```C
int custom_test_protect(void) {
platform_specific_code();
return setjmp(Unity.AbortFrame) == 0;
}
UNITY_NORETURN void custom_test_abort(void) {
more_platform_specific_code();
longjmp(Unity.AbortFrame, 1);
}
```
_Example 2:_
Unity is used to provide the assertion macros only, and an external test harness/runner is used for test orchestration/reporting. In this case you can easily plug your code by overriding `TEST_ABORT` as:
`unity_config.h`:
```C
#include "my_custom_test_handlers.h"
#define UNITY_TEST_PROTECT() 1
#define UNITY_TEST_ABORT() custom_test_abort()
```
`my_custom_test_handlers.c`:
```C
void custom_test_abort(void) {
if (Unity.CurrentTestFailed == 1) {
custom_failed_test_handler();
} else if (Unity.CurrentTestIgnored == 1) {
custom_ignored_test_handler();
}
}
```
#### `UNITY_OUTPUT_COLOR`
If you want to add color using ANSI escape codes you can use this define.
@@ -409,6 +482,34 @@ _Example:_
#define UNITY_OUTPUT_COLOR
```
#### `UNITY_INCLUDE_EXEC_TIME`
Define this to measure and report execution time for each test in the suite. When enabled, Unity will do
it's best to automatically find a way to determine the time in milliseconds. On most Windows, macos, or
Linux environments, this is automatic. If not, you can give Unity more information.
#### `UNITY_CLOCK_MS`
If you're working on a system (embedded or otherwise) which has an accessible millisecond timer. You can
define `UNITY_CLOCK_MS` to be the name of the function which returns the millisecond timer. It will then
attempt to use that function for timing purposes.
#### `UNITY_EXEC_TIME_START`
Define this hook to start a millisecond timer if necessary.
#### `UNITY_EXEC_TIME_STOP`
Define this hook to stop a millisecond timer if necessary.
#### `UNITY_PRINT_EXEC_TIME`
Define this hook to print the current execution time. Used to report the milliseconds elapsed.
#### `UNITY_TIME_TYPE`
Finally, this can be set to the type which holds the millisecond timer.
#### `UNITY_SHORTHAND_AS_INT`
#### `UNITY_SHORTHAND_AS_MEM`
@@ -448,7 +549,7 @@ To enable it, use the following example:
#define UNITY_SUPPORT_TEST_CASES
```
You can manually provide required `TEST_CASE` or `TEST_RANGE` macro definitions
You can manually provide required `TEST_CASE`, `TEST_RANGE` or `TEST_MATRIX` macro definitions
before including `unity.h`, and they won't be redefined.
If you provide one of the following macros, some of default definitions will not be
defined:
@@ -456,8 +557,10 @@ defined:
|---|---|
| `UNITY_EXCLUDE_TEST_CASE` | `TEST_CASE` |
| `UNITY_EXCLUDE_TEST_RANGE` | `TEST_RANGE` |
| `UNITY_EXCLUDE_TEST_MATRIX` | `TEST_MATRIX` |
| `TEST_CASE` | `TEST_CASE` |
| `TEST_RANGE` | `TEST_RANGE` |
| `TEST_MATRIX` | `TEST_MATRIX` |
`UNITY_EXCLUDE_TEST_*` defines is not processed by test runner generator script.
If you exclude one of them from definition, you should provide your own definition

View File

@@ -94,12 +94,12 @@ UnityTestRunnerGenerator.new.run(testfile, runner_name, options)
```
If you have multiple files to generate in a build script (such as a Rakefile), you might want to instantiate a generator object with your options and call it to generate each runner afterwards.
Like thus:
Like this:
```Ruby
gen = UnityTestRunnerGenerator.new(options)
test_files.each do |f|
gen.run(f, File.basename(f,'.c')+"Runner.c"
gen.run(f, File.basename(f,'.c')+"Runner.c")
end
```
@@ -114,6 +114,11 @@ In the `examples` directory, Example 3's Rakefile demonstrates using a Ruby hash
This option specifies an array of file names to be `#include`'d at the top of your runner C file.
You might use it to reference custom types or anything else universally needed in your generated runners.
##### `:defines`
This option specifies an array of definitions to be `#define`'d at the top of your runner C file.
Each definition will be wrapped in an `#ifndef`.
##### `:suite_setup`
Define this option with C code to be executed _before any_ test cases are run.
@@ -121,6 +126,8 @@ Define this option with C code to be executed _before any_ test cases are run.
Alternatively, if your C compiler supports weak symbols, you can leave this option unset and instead provide a `void suiteSetUp(void)` function in your test suite.
The linker will look for this symbol and fall back to a Unity-provided stub if it is not found.
This option can also be specified at the command prompt as `--suite_setup=""`
##### `:suite_teardown`
Define this option with C code to be executed _after all_ test cases have finished.
@@ -131,6 +138,8 @@ You can normally just return `num_failures`.
Alternatively, if your C compiler supports weak symbols, you can leave this option unset and instead provide a `int suiteTearDown(int num_failures)` function in your test suite.
The linker will look for this symbol and fall back to a Unity-provided stub if it is not found.
This option can also be specified at the command prompt as `--suite_teardown=""`
##### `:enforce_strict_ordering`
This option should be defined if you have the strict order feature enabled in CMock (see CMock documentation).
@@ -141,6 +150,8 @@ If you provide the same YAML to the generator as used in CMock's configuration,
This option should be defined if you are mixing C and CPP and want your test runners to automatically include extern "C" support when they are generated.
This option can also be specified at the command prompt as `--externc`
##### `:mock_prefix` and `:mock_suffix`
Unity automatically generates calls to Init, Verify and Destroy for every file included in the main test file that starts with the given mock prefix and ends with the given mock suffix, file extension not included.
@@ -165,8 +176,11 @@ Or as a yaml file:
If you are using CMock, it is very likely that you are already passing an array of plugins to CMock.
You can just use the same array here.
This script will just ignore the plugins that don't require additional support.
This option can also be specified at the command prompt as `--cexception`
##### `:include_extensions`
This option specifies the pattern for matching acceptable header file extensions.
@@ -191,7 +205,93 @@ Few usage examples can be found in `/test/tests/test_unity_parameterized.c` file
You should define `UNITY_SUPPORT_TEST_CASES` macro for tests success compiling,
if you enable current option.
You can see list of supported macros list in the next section.
You can see a list of supported macros in the
[Parameterized tests provided macros](#parameterized-tests-provided-macros)
section that follows.
This option can also be specified at the command prompt as `--use_param_tests=1`
##### `:cmdline_args`
When set to `true`, the generated test runner can accept a number of
options to modify how the test(s) are run.
Ensure Unity is compiled with `UNITY_USE_COMMAND_LINE_ARGS` defined or else
the required functions will not exist.
These are the available options:
| Option | Description |
| --------- | ------------------------------------------------- |
| `-l` | List all tests and exit |
| `-f NAME` | Filter to run only tests whose name includes NAME |
| `-n NAME` | Run only the test named NAME |
| `-h` | show the Help menu that lists these options |
| `-q` | Quiet/decrease verbosity |
| `-v` | increase Verbosity |
| `-x NAME` | eXclude tests whose name includes NAME |
##### `:setup_name`
Override the default test `setUp` function name.
This option can also be specified at the command prompt as `--setup_name=""`
##### `:teardown_name`
Override the default test `tearDown` function name.
This option can also be specified at the command prompt as `--teardown_name=""`
##### `:test_reset_name`
Override the default test `resetTest` function name.
This option can also be specified at the command prompt as `--test_reset_name=""`
##### `:test_verify_name`
Override the default test `verifyTest` function name.
This option can also be specified at the command prompt as `--test_verify_name=""`
##### `:main_name`
Override the test's `main()` function name (from `main` to whatever is specified).
The sentinel value `:auto` will use the test's filename with the `.c` extension removed prefixed
with `main_` as the "main" function.
To clarify, if `:main_name == :auto` and the test filename is "test_my_project.c", then the
generated function name will be `main_test_my_project(int argc, char** argv)`.
This option can also be specified at the command prompt as `--main_name=""`
##### `main_export_decl`
Provide any `cdecl` for the `main()` test function. Is empty by default.
##### `:omit_begin_end`
If `true`, the `UnityBegin` and `UnityEnd` function will not be called for
Unity test state setup and cleanup.
This option can also be specified at the command prompt as `--omit_begin_end`
##### `:shuffle_tests`
If `true`, the test execution order will be shuffled. Is `false` by default.
This option can also be specified at the command prompt as `--shuffle_tests`
##### `:rng_seed`
If set to some positive integer value, said value will be used as the seed value passed
to the `srand` function. Otherwise, if not set to any value, `time(NULL)` will be used
as the seed value.
Only applicable if `:shuffle_tests` is set to `true`.
This option can also be specified at the command prompt as `--rng_seed`
#### Parameterized tests provided macros
@@ -199,7 +299,7 @@ Unity provides support for few param tests generators, that can be combined
with each other. You must define test function as usual C function with usual
C arguments, and test generator will pass what you tell as a list of arguments.
Let's show how all of them works on the following test function definitions:
Let's show how all of them work on the following test function definitions:
```C
/* Place your test generators here, usually one generator per one or few lines */
@@ -220,7 +320,7 @@ If we use replace comment before test function with the following code:
```C
TEST_CASE(1, 2, 5)
TEST_CASE(3, 7, 20)
TEST_CASE(10, 7, 20)
```
script will generate 2 test calls:
@@ -296,6 +396,93 @@ TEST_CASE(4, 8, 30)
TEST_CASE(4, 6, 30)
```
##### `TEST_MATRIX`
Test matix is an advanced generator. It single call can be converted to zero,
one or few `TEST_CASE` equivalent commands.
That generator will create tests for all combinations of the provided list. Each argument has to be given as a list of one or more elements in the format `[<parm1>, <param2>, ..., <paramN-1>, <paramN>]`.
All parameters supported by the `TEST_CASE` are supported as arguments:
- Numbers incl type specifiers e.g. `<1>`, `<1u>`, `<1l>`, `<2.3>`, or `<2.3f>`
- Strings incl string concatenation e.g. `<"string">`, or `<"partial" "string">`
- Chars e.g. `<'c'>`
- Enums e.g. `<ENUM_NAME>`
- Elements of arrays e.g. `<data[0]>`
Let's use our `test_demoParamFunction` test for checking what ranges
will be generated for our single `TEST_MATRIX` row:
```C
TEST_MATRIX([3, 4, 7], [10, 8, 2, 1],[30u, 20.0f])
```
Tests execution output will be similar to that text:
```Log
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(3, 10, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(3, 10, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(3, 8, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(3, 8, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(3, 2, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(3, 2, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(3, 1, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(3, 1, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(4, 10, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(4, 10, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(4, 8, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(4, 8, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(4, 2, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(4, 2, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(4, 1, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(4, 1, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(7, 10, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(7, 10, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(7, 8, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(7, 8, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(7, 2, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(7, 2, 20.0f):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(7, 1, 30u):PASS
tests/test_unity_parameterizedDemo.c:18:test_demoParamFunction(7, 1, 20.0f):PASS
```
As we can see:
| Parameter | Format | Count of values |
|---|---|---|
| `a` | `[3, 4, 7]` | 3 |
| `b` | `[10, 8, 2, 1]` | 4 |
| `c` | `[30u, 20.0f]` | 2 |
We totally have 3 * 4 * 2 = 24 equal test cases, that can be written as following:
```C
TEST_CASE(3, 10, 30u)
TEST_CASE(3, 10, 20.0f)
TEST_CASE(3, 8, 30u)
TEST_CASE(3, 8, 20.0f)
TEST_CASE(3, 2, 30u)
TEST_CASE(3, 2, 20.0f)
TEST_CASE(3, 1, 30u)
TEST_CASE(3, 1, 20.0f)
TEST_CASE(4, 10, 30u)
TEST_CASE(4, 10, 20.0f)
TEST_CASE(4, 8, 30u)
TEST_CASE(4, 8, 20.0f)
TEST_CASE(4, 2, 30u)
TEST_CASE(4, 2, 20.0f)
TEST_CASE(4, 1, 30u)
TEST_CASE(4, 1, 20.0f)
TEST_CASE(7, 10, 30u)
TEST_CASE(7, 10, 20.0f)
TEST_CASE(7, 8, 30u)
TEST_CASE(7, 8, 20.0f)
TEST_CASE(7, 2, 30u)
TEST_CASE(7, 2, 20.0f)
TEST_CASE(7, 1, 30u)
TEST_CASE(7, 1, 20.0f)
```
### `unity_test_summary.rb`
A Unity test file contains one or more test case functions.
@@ -329,7 +516,7 @@ ruby unity_test_summary.rb build/test/ ~/projects/myproject/
Or, if you're more of a Windows sort of person:
```Shell
ruby unity_test_summary.rb build\teat\ C:\projects\myproject\
ruby unity_test_summary.rb build\test\ C:\projects\myproject\
```
When configured correctly, you'll see a final summary, like so:

13
docs/UnityKnownIssues.md Normal file
View File

@@ -0,0 +1,13 @@
# Unity Test - Known Issues
## A Note
This project will do its best to keep track of significant bugs that might effect your usage of this
project and its supporting scripts. A more detailed and up-to-date list for cutting edge Unity can
be found on our Github repository.
## Issues
- No built-in validation of no-return functions
- Incomplete support for Printf-style formatting
- Incomplete support for VarArgs

View File

@@ -1,8 +1,9 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
#We try to detect the OS we are running on, and adjust commands as needed
ifeq ($(OS),Windows_NT)

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
int FindFunction_WhichIsBroken(int NumberToFind);
int FunctionWhichReturnsLocalVariable(void);

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode2.h"

View File

@@ -1,2 +1,8 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction);

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"
#include "unity.h"

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode2.h"
#include "unity.h"

View File

@@ -1,8 +1,9 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
#We try to detect the OS we are running on, and adjust commands as needed
ifeq ($(OS),Windows_NT)

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
int FindFunction_WhichIsBroken(int NumberToFind);
int FunctionWhichReturnsLocalVariable(void);

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode2.h"

View File

@@ -1,2 +1,8 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction);

View File

@@ -1,3 +1,10 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"
#include "unity.h"
#include "unity_fixture.h"

View File

@@ -1,3 +1,10 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode2.h"
#include "unity.h"
#include "unity_fixture.h"

View File

@@ -1,3 +1,10 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "unity_fixture.h"

View File

@@ -1,3 +1,10 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "unity_fixture.h"

View File

@@ -1,3 +1,10 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity_fixture.h"
static void RunAllTests(void)

View File

@@ -1,3 +1,10 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "UnityHelper.h"
#include <stdio.h>

View File

@@ -1,3 +1,10 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TESTHELPER_H
#define _TESTHELPER_H

View File

@@ -1,3 +1,10 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
require 'rake'
require 'rake/clean'
require_relative 'rakefile_helper'

View File

@@ -1,8 +1,9 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
require 'fileutils'
require_relative '../../auto/unity_test_summary'
@@ -17,7 +18,7 @@ def load_configuration(config_file)
end
def configure_clean
CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil?
CLEAN.include("#{$cfg['compiler']['build_path']}*.*") unless $cfg['compiler']['build_path'].nil?
end
def configure_toolchain(config_file = DEFAULT_CONFIG_FILE)
@@ -27,7 +28,7 @@ def configure_toolchain(config_file = DEFAULT_CONFIG_FILE)
end
def unit_test_files
path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION
path = "#{$cfg['compiler']['unit_tests_path']}Test*#{C_EXTENSION}"
path.tr!('\\', '/')
FileList.new(path)
end
@@ -42,7 +43,7 @@ def extract_headers(filename)
includes = []
lines = File.readlines(filename)
lines.each do |line|
m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/)
m = line.match(/^\s*#include\s+"\s*(.+\.[hH])\s*"/)
includes << m[1] unless m.nil?
end
includes
@@ -57,12 +58,11 @@ def find_source_file(header, paths)
end
def tackit(strings)
result = if strings.is_a?(Array)
if strings.is_a?(Array)
"\"#{strings.join}\""
else
strings
end
result
end
def squash(prefix, items)
@@ -80,7 +80,7 @@ def build_compiler_fields
end
options = squash('', $cfg['compiler']['options'])
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
includes = includes.gsub(/\\ /, ' ').gsub(/\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
{ command: command, defines: defines, options: options, includes: includes }
end
@@ -105,18 +105,18 @@ def build_linker_fields
''
else
squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
end.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
end.gsub(/\\ /, ' ').gsub(/\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
{ command: command, options: options, includes: includes }
end
def link_it(exe_name, obj_list)
linker = build_linker_fields
cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
(obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join +
$cfg['linker']['bin_files']['prefix'] + ' ' +
$cfg['linker']['bin_files']['destination'] +
exe_name + $cfg['linker']['bin_files']['extension']
cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]}"
cmd_str += " #{(obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj}" }).join(' ')}"
cmd_str += " #{$cfg['linker']['bin_files']['prefix']} "
cmd_str += $cfg['linker']['bin_files']['destination']
cmd_str += exe_name + $cfg['linker']['bin_files']['extension']
execute(cmd_str)
end
@@ -126,7 +126,7 @@ def build_simulator_fields
command = if $cfg['simulator']['path'].nil?
''
else
(tackit($cfg['simulator']['path']) + ' ')
"#{tackit($cfg['simulator']['path'])} "
end
pre_support = if $cfg['simulator']['pre_support'].nil?
''
@@ -189,7 +189,7 @@ def run_tests(test_files)
# Build the test runner (generate if configured to do so)
test_base = File.basename(test, C_EXTENSION)
runner_name = test_base + '_Runner.c'
runner_name = "#{test_base}_Runner.c"
if $cfg['compiler']['runner_path'].nil?
runner_path = $cfg['compiler']['build_path'] + runner_name
test_gen = UnityTestRunnerGenerator.new($cfg_file)

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
int FindFunction_WhichIsBroken(int NumberToFind);
int FunctionWhichReturnsLocalVariable(void);

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode2.h"

View File

@@ -1,2 +1,8 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction);

View File

@@ -1,3 +1,10 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
# Copied from ~Unity/targets/gcc_32.yml
unity_root: &unity_root '../..'
unity_source: &unity_source '../../src/'

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"
#include "unity.h"

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode2.h"
#include "unity.h"

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
int FindFunction_WhichIsBroken(int NumberToFind);
int FunctionWhichReturnsLocalVariable(void);

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode2.h"

View File

@@ -1,2 +1,8 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction);

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"
#include "unity.h"

View File

@@ -1,3 +1,9 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode2.h"
#include "unity.h"

View File

@@ -0,0 +1,63 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
#We try to detect the OS we are running on, and adjust commands as needed
ifeq ($(OS),Windows_NT)
ifeq ($(shell uname -s),) # not in a bash-like shell
CLEANUP = del /F /Q
MKDIR = mkdir
else # in a bash-like shell, like msys
CLEANUP = rm -f
MKDIR = mkdir -p
endif
TARGET_EXTENSION=.exe
else
CLEANUP = rm -f
MKDIR = mkdir -p
TARGET_EXTENSION=.out
endif
C_COMPILER=gcc
ifeq ($(shell uname -s), Darwin)
C_COMPILER=clang
endif
UNITY_ROOT=../..
CFLAGS=-std=c89
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Wpointer-arith
CFLAGS += -Wcast-align
CFLAGS += -Wwrite-strings
CFLAGS += -Wswitch-default
CFLAGS += -Wunreachable-code
CFLAGS += -Winit-self
CFLAGS += -Wmissing-field-initializers
CFLAGS += -Wno-unknown-pragmas
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef
CFLAGS += -Wold-style-definition
#CFLAGS += -Wno-misleading-indentation
TARGET_BASE1=test1
TARGET1 = $(TARGET_BASE1)$(TARGET_EXTENSION)
SRC_FILES1=$(UNITY_ROOT)/src/unity.c src/ProductionCode.c test/TestProductionCode.c test/test_runners/TestProductionCode_Runner.c
INC_DIRS=-Isrc -I$(UNITY_ROOT)/src
SYMBOLS=-include"test/unity_detail_config.h" -DUNIT_TESTING
all: clean default
default: $(SRC_FILES1)
$(C_COMPILER) $(CFLAGS) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES1) -o $(TARGET1)
- ./$(TARGET1)
clean:
$(CLEANUP) $(TARGET1) $(TARGET2)
ci: CFLAGS += -Werror
ci: default

View File

@@ -0,0 +1,38 @@
Example 5
=========
Demonstrate Details Stack usage to implement something similar to a stacktrace.
This allows locating the error source much faster in branching/iterating code.
Build and run with Make
---
Just run `make`.
Output
---
Below the output is annotated with source of the elements.
```
test/TestProductionCode.c:36:test_BitExtractor:FAIL: Expected 0 Was 1. During call BitExtractor. During call BitExtractor_down. Bit Position 6. Bit Mask 0x02. Unexpected bit value
```
| String | Source |
|-----------------------------|---------------------------------------------------------------------------|
| `test/TestProductionCode.c` | `Unity.TestFile` |
| `36` | `UNITY_TEST_ASSERT_EQUAL_INT` line |
| `test_BitExtractor` | `RUN_TEST` name |
| `FAIL` | `UnityStrFail` |
| `Expected 1 Was 0` | `UnityAssertEqualNumber` |
| `During call` | Detail 0, Label |
| `BitExtractor` | Detail 0, Value |
| `During call` | Detail 0, Label |
| `BitExtractor` | Detail 0, Value |
| `During call` | Detail 1, Label |
| `BitExtractor_down` | Detail 1, Value |
| `Bit Position` | Detail 2, Label (literal starts with #\x18, so value is printed as INT32) |
| `6` | Detail 2 Value |
| `Bit Mask` | Detail 2, Label (literal starts with #\x41, so value is printed as HEX8) |
| `0x02` | Detail 2 Value |
| `Unexpected bit value` | `UNITY_TEST_ASSERT_EQUAL_INT` message |
While this example is a bit contrived, the source of the error can be clearly located to be within the `test_BitExtractor->BitExtractor->BitExtractor_down`

View File

@@ -0,0 +1,56 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"
#include <stdint.h>
#ifdef UNIT_TESTING
#include "unity.h"
#else
/* No-Op when not testing */
#define UNITY_DETAIL_PUSH
#define UNITY_DETAIL_POP
#endif
static void BitExtractor_up(uint8_t input, callback_t cb)
{
int32_t pos;
UNITY_DETAIL_PUSH(UNITY_DETAIL_CALL, __FUNCTION__);
for(pos=0; pos<8; pos++) {
UNITY_DETAIL_PUSH(UNITY_DETAIL_BIT_POS, pos);
UNITY_DETAIL_PUSH(UNITY_DETAIL_BIT_MASK, 1<<pos);
cb(pos, !!(input & (1<<pos)));
UNITY_DETAIL_POP(UNITY_DETAIL_BIT_MASK, 1<<pos);
UNITY_DETAIL_POP(UNITY_DETAIL_BIT_POS, pos);
}
UNITY_DETAIL_POP(UNITY_DETAIL_CALL, __FUNCTION__);
}
static void BitExtractor_down(uint8_t input, callback_t cb)
{
int32_t pos;
UNITY_DETAIL_PUSH(UNITY_DETAIL_CALL, __FUNCTION__);
for(pos=0; pos<8; pos++) {
UNITY_DETAIL_PUSH(UNITY_DETAIL_BIT_POS, pos);
UNITY_DETAIL_PUSH(UNITY_DETAIL_BIT_MASK, 0x80>>pos);
cb(pos, !!(input & (0x80>>pos)));
UNITY_DETAIL_POP(UNITY_DETAIL_BIT_MASK, 0x80>>pos);
UNITY_DETAIL_POP(UNITY_DETAIL_BIT_POS, pos);
}
UNITY_DETAIL_POP(UNITY_DETAIL_CALL, __FUNCTION__);
}
void BitExtractor(bit_direction_t dir, uint8_t input, callback_t cb)
{
UNITY_DETAIL_PUSH(UNITY_DETAIL_CALL, __FUNCTION__);
if(dir == BIT_DIRECTION_UP) {
BitExtractor_up(input, cb);
} else {
BitExtractor_down(input, cb);
}
UNITY_DETAIL_POP(UNITY_DETAIL_CALL, __FUNCTION__);
}

View File

@@ -0,0 +1,16 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include <stdint.h>
typedef void callback_t(int position, int bit_value);
typedef enum {
BIT_DIRECTION_UP,
BIT_DIRECTION_DOWN,
} bit_direction_t;
void BitExtractor(bit_direction_t dir, uint8_t input, callback_t cb);

View File

@@ -0,0 +1,3 @@
[wrap-git]
url = https://github.com/ThrowTheSwitch/Unity.git
revision = head

View File

@@ -0,0 +1,45 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "ProductionCode.h"
#include "unity.h"
const int* current_expected_bits = NULL;
UNITY_LINE_TYPE current_vector_line = 0;
typedef struct {
UNITY_LINE_TYPE line;
uint8_t value;
bit_direction_t dir;
int expected_bits[8];
} test_vector_t;
void setUp(void)
{
}
void tearDown(void)
{
}
static void be_bit_tester(int position, int value) {
UNITY_TEST_ASSERT_EQUAL_INT(current_expected_bits[position], value, current_vector_line, "Unexpected bit value");
}
void test_BitExtractor(void)
{
const test_vector_t test_vectors[] = {
{__LINE__, 7, BIT_DIRECTION_UP, {1,1,1,0,0,0,0,0}},
{__LINE__, 7, BIT_DIRECTION_DOWN, {0,0,0,0,0,1,0,1}}, /* intentionally wrong to demonstrate detail output */
{0}
};
const test_vector_t* tv;
for (tv = test_vectors; tv->line; tv++) {
current_vector_line = tv->line;
current_expected_bits = tv->expected_bits;
BitExtractor(tv->dir, tv->value, be_bit_tester);
}
}

View File

@@ -0,0 +1,48 @@
/* AUTOGENERATED FILE. DO NOT EDIT. */
/*=======Test Runner Used To Run Each Test Below=====*/
#define RUN_TEST(TestFunc, TestLineNum) \
{ \
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
if (TEST_PROTECT()) \
{ \
setUp(); \
TestFunc(); \
} \
if (TEST_PROTECT()) \
{ \
tearDown(); \
} \
UnityConcludeTest(); \
}
/*=======Automagically Detected Files To Include=====*/
#include "unity.h"
#include <setjmp.h>
#include <stdio.h>
#include "ProductionCode.h"
/*=======External Functions This Runner Calls=====*/
extern void setUp(void);
extern void tearDown(void);
extern void test_BitExtractor(void);
/*=======Test Reset Option=====*/
void resetTest(void);
void resetTest(void)
{
tearDown();
setUp();
}
/*=======MAIN=====*/
int main(void)
{
UnityBegin("test/TestProductionCode.c");
RUN_TEST(test_BitExtractor, 32);
return UNITY_END();
}

View File

@@ -0,0 +1,18 @@
#define UNITY_DETAIL_STACK_SIZE 5
#define LABEL_AS_INT32 "#\x18" /*UNITY_DISPLAY_STYLE_INT32 = 0x18 */
#define LABEL_AS_HEX8 "#\x41" /* UNITY_DISPLAY_STYLE_HEX8 = 0x41 */
#define UNITY_DETAIL_LABEL_NAMES { 0, \
UNITY_DETAIL1_NAME, \
UNITY_DETAIL2_NAME, \
"During call", \
LABEL_AS_INT32 "Bit Position", \
LABEL_AS_HEX8 "Bit Mask", \
}
typedef enum {
UNITY_DETAIL_NONE = 0,
UNITY_DETAIL_D1 = 1,
UNITY_DETAIL_D2 = 2,
UNITY_DETAIL_CALL,
UNITY_DETAIL_BIT_POS,
UNITY_DETAIL_BIT_MASK,
} UNITY_DETAIL_LABEL_T;

View File

@@ -1,3 +1,10 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
/* Unity Configuration
* As of May 11th, 2016 at ThrowTheSwitch/Unity commit 837c529
* Update: December 29th, 2016
@@ -102,7 +109,7 @@
* There can be a significant size and speed impact to enabling 64-bit support
* on small targets, so don't define it if you don't need it.
*/
/* #define UNITY_INCLUDE_64 */
/* #define UNITY_SUPPORT_64 */
/* *************************** FLOATING POINT TYPES ****************************

40
extras/bdd/readme.md Normal file
View File

@@ -0,0 +1,40 @@
# Unity Project - BDD Feature
Unity's Behavior-Driven Development (BDD) test feature. It allows developers to structure and describe various phases (Given, When, Then) of a test scenario in a BDD-style format.
## Introduction
This project is based on the Unity framework originally created by Mike Karlesky, Mark VanderVoord, and Greg Williams in 2007. The project extends Unity by providing macros to define BDD structures with descriptive elements. Feature added by Michael Gene Brockus (Dreamer).
## License
This project is distributed under the MIT License. See the [license.txt](license.txt) file for more information.
## Usage
### BDD Macros
The provided BDD macros allow you to structure your test scenarios in a descriptive manner. These macros are for descriptive purposes only and do not have functional behavior.
- `GIVEN(description)`: Describes the "Given" phase of a test scenario.
- `WHEN(description)`: Describes the "When" phase of a test scenario.
- `THEN(description)`: Describes the "Then" phase of a test scenario.
Example usage:
```c
GIVEN("a valid input") {
// Test setup and context
// ...
WHEN("the input is processed") {
// Perform the action
// ...
THEN("the expected outcome occurs") {
// Assert the outcome
// ...
}
}
}
```

View File

@@ -0,0 +1,44 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef UNITY_BDD_TEST_H_
#define UNITY_BDD_TEST_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdio.h>
/**
* @brief Macros for defining a Behavior-Driven Development (BDD) structure with descriptions.
*
* These macros provide a way to structure and describe different phases (Given, When, Then) of a
* test scenario in a BDD-style format. However, they don't have functional behavior by themselves
* and are used for descriptive purposes.
*/
#define GIVEN(description) \
if (0) { \
printf("Given %s\n", description); \
} else
#define WHEN(description) \
if (0) { \
printf("When %s\n", description); \
} else
#define THEN(description) \
if (0) { \
printf("Then %s\n", description); \
} else
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,9 @@
project('BDD Tester', 'c')
# Add Unity as a dependency
unity_dep = dependency('unity')
# Define your source files
sources = files('test_bdd.c')
executable('tester', sources, dependencies : unity_dep)

129
extras/bdd/test/test_bdd.c Normal file
View File

@@ -0,0 +1,129 @@
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "unity_bdd.h"
void test_bdd_logic_test(void) {
GIVEN("a valid statement is passed")
{
// Set up the context
bool givenExecuted = true;
WHEN("a statement is true")
{
// Perform the login action
bool whenExecuted = true;
THEN("we validate everything was worked")
{
// Check the expected outcome
bool thenExecuted = true;
TEST_ASSERT_TRUE(givenExecuted);
TEST_ASSERT_TRUE(whenExecuted);
TEST_ASSERT_TRUE(thenExecuted);
}
}
}
} // end of case
void test_bdd_user_account(void) {
GIVEN("a user's account with sufficient balance")
{
// Set up the context
float accountBalance = 500.0;
float withdrawalAmount = 200.0;
WHEN("the user requests a withdrawal of $200")
{
// Perform the withdrawal action
if (accountBalance >= withdrawalAmount)
{
accountBalance -= withdrawalAmount;
} // end if
THEN("the withdrawal amount should be deducted from the account balance")
{
// Check the expected outcome
// Simulate the scenario
float compareBalance = 500.0;
TEST_ASSERT_LESS_THAN_FLOAT(accountBalance, compareBalance);
}
}
}
} // end of case
void test_bdd_empty_cart(void) {
GIVEN("a user with an empty shopping cart")
{
// Set up the context
int cartItemCount = 0;
WHEN("the user adds a product to the cart")
{
// Perform the action of adding a product
THEN("the cart item count should increase by 1")
{
// Check the expected outcome
cartItemCount++;
TEST_ASSERT_EQUAL_INT(cartItemCount, 1);
}
}
}
} // end of case
void test_bdd_valid_login(void) {
GIVEN("a registered user with valid credentials")
{
// Set up the context
const char* validUsername = "user123";
const char* validPassword = "pass456";
WHEN("the user provides correct username and password")
{
// Perform the action of user login
const char* inputUsername = "user123";
const char* inputPassword = "pass456";
THEN("the login should be successful")
{
// Check the expected outcome
// Simulate login validation
TEST_ASSERT_EQUAL_STRING(inputUsername, validUsername);
TEST_ASSERT_EQUAL_STRING(inputPassword, validPassword);
}
}
WHEN("the user provides incorrect password")
{
// Perform the action of user login
const char* inputUsername = "user123";
const char* inputPassword = "wrongpass";
THEN("the login should fail with an error message")
{
// Check the expected outcome
// Simulate login validation
TEST_ASSERT_EQUAL_STRING(inputUsername, validUsername);
// TEST_ASSERT_NOT_EQUAL_STRING(inputPassword, validPassword);
}
}
}
} // end of case
int main(void)
{
UnityBegin("test_bdd.c");
RUN_TEST(test_bdd_logic_test);
RUN_TEST(test_bdd_user_account);
RUN_TEST(test_bdd_empty_cart);
RUN_TEST(test_bdd_valid_login);
return UnityEnd();
}

View File

@@ -1,9 +1,9 @@
/* Copyright (c) 2010 James Grenning and Contributed to Unity Project
* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity_fixture.h"
#include "unity_internals.h"
@@ -46,21 +46,25 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void))
return (int)Unity.TestFailures;
}
static int selected(const char* filter, const char* name)
static int selected(const char* filter, const char* select, const char* name)
{
if (filter == 0)
if (filter == 0 && select == 0)
return 1;
return strstr(name, filter) ? 1 : 0;
if (filter && strstr(name, filter))
return 1;
if (select && strcmp(name, select) == 0)
return 1;
return 0;
}
static int testSelected(const char* test)
{
return selected(UnityFixture.NameFilter, test);
return selected(UnityFixture.NameFilter, UnityFixture.Name, test);
}
static int groupSelected(const char* group)
{
return selected(UnityFixture.GroupFilter, group);
return selected(UnityFixture.GroupFilter, UnityFixture.Group, group);
}
void UnityTestRunner(unityfunction* setup,
@@ -96,6 +100,7 @@ void UnityTestRunner(unityfunction* setup,
Unity.NumberOfTests++;
UnityPointer_Init();
if (!UnityFixture.DryRun) {
UNITY_EXEC_TIME_START();
if (TEST_PROTECT())
@@ -107,6 +112,8 @@ void UnityTestRunner(unityfunction* setup,
{
teardown();
}
}
if (TEST_PROTECT())
{
UnityPointer_UndoAllSets();
@@ -183,8 +190,11 @@ int UnityGetCommandLineOptions(int argc, const char* argv[])
int i;
UnityFixture.Verbose = 0;
UnityFixture.Silent = 0;
UnityFixture.DryRun = 0;
UnityFixture.GroupFilter = 0;
UnityFixture.Group = 0;
UnityFixture.NameFilter = 0;
UnityFixture.Name = 0;
UnityFixture.RepeatCount = 1;
if (argc == 1)
@@ -207,10 +217,16 @@ int UnityGetCommandLineOptions(int argc, const char* argv[])
UNITY_PRINT_EOL();
UnityPrint(" -s Silent mode: minimal output showing only test failures");
UNITY_PRINT_EOL();
UnityPrint(" -d Dry run all tests");
UNITY_PRINT_EOL();
UnityPrint(" -g NAME Only run tests in groups that contain the string NAME");
UNITY_PRINT_EOL();
UnityPrint(" -G NAME Only run tests in groups named NAME");
UNITY_PRINT_EOL();
UnityPrint(" -n NAME Only run tests whose name contains the string NAME");
UNITY_PRINT_EOL();
UnityPrint(" -N NAME Only run tests named NAME");
UNITY_PRINT_EOL();
UnityPrint(" -r NUMBER Repeatedly run all tests NUMBER times");
UNITY_PRINT_EOL();
UnityPrint(" -h, --help Display this help message");
@@ -237,6 +253,11 @@ int UnityGetCommandLineOptions(int argc, const char* argv[])
UnityFixture.Silent = 1;
i++;
}
else if (strcmp(argv[i], "-d") == 0)
{
UnityFixture.DryRun = 1;
i++;
}
else if (strcmp(argv[i], "-g") == 0)
{
i++;
@@ -245,6 +266,14 @@ int UnityGetCommandLineOptions(int argc, const char* argv[])
UnityFixture.GroupFilter = argv[i];
i++;
}
else if (strcmp(argv[i], "-G") == 0)
{
i++;
if (i >= argc)
return 1;
UnityFixture.Group= argv[i];
i++;
}
else if (strcmp(argv[i], "-n") == 0)
{
i++;
@@ -253,6 +282,14 @@ int UnityGetCommandLineOptions(int argc, const char* argv[])
UnityFixture.NameFilter = argv[i];
i++;
}
else if (strcmp(argv[i], "-N") == 0)
{
i++;
if (i >= argc)
return 1;
UnityFixture.Name = argv[i];
i++;
}
else if (strcmp(argv[i], "-r") == 0)
{
UnityFixture.RepeatCount = 2;

View File

@@ -1,9 +1,9 @@
/* Copyright (c) 2010 James Grenning and Contributed to Unity Project
* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef UNITY_FIXTURE_H_
#define UNITY_FIXTURE_H_

View File

@@ -1,9 +1,9 @@
/* Copyright (c) 2010 James Grenning and Contributed to Unity Project
* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef UNITY_FIXTURE_INTERNALS_H_
#define UNITY_FIXTURE_INTERNALS_H_
@@ -17,9 +17,12 @@ struct UNITY_FIXTURE_T
{
int Verbose;
int Silent;
int DryRun;
unsigned int RepeatCount;
const char* NameFilter;
const char* Name;
const char* GroupFilter;
const char* Group;
};
extern struct UNITY_FIXTURE_T UnityFixture;

View File

@@ -1,9 +1,9 @@
/* Copyright (c) 2010 James Grenning and Contributed to Unity Project
* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity_fixture.h"

View File

@@ -1,9 +1,9 @@
/* Copyright (c) 2010 James Grenning and Contributed to Unity Project
* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity_fixture.h"

View File

@@ -1,9 +1,9 @@
/* Copyright (c) 2010 James Grenning and Contributed to Unity Project
* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity_fixture.h"
#include <stdlib.h>
@@ -90,23 +90,32 @@ TEST_GROUP(UnityCommandOptions);
static int savedVerbose;
static unsigned int savedRepeat;
static int savedDryRun;
static const char* savedName;
static const char* savedGroup;
static const char* savedNameExact;
static const char* savedGroupExact;
TEST_SETUP(UnityCommandOptions)
{
savedVerbose = UnityFixture.Verbose;
savedRepeat = UnityFixture.RepeatCount;
savedDryRun = UnityFixture.DryRun;
savedName = UnityFixture.NameFilter;
savedGroup = UnityFixture.GroupFilter;
savedNameExact = UnityFixture.Name;
savedGroupExact = UnityFixture.Group;
}
TEST_TEAR_DOWN(UnityCommandOptions)
{
UnityFixture.Verbose = savedVerbose;
UnityFixture.RepeatCount= savedRepeat;
UnityFixture.DryRun = savedDryRun;
UnityFixture.NameFilter = savedName;
UnityFixture.GroupFilter = savedGroup;
UnityFixture.Name= savedNameExact;
UnityFixture.Group= savedGroup;
}
@@ -118,8 +127,11 @@ TEST(UnityCommandOptions, DefaultOptions)
{
UnityGetCommandLineOptions(1, noOptions);
TEST_ASSERT_EQUAL(0, UnityFixture.Verbose);
TEST_ASSERT_EQUAL(0, UnityFixture.DryRun);
TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter);
TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter);
TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.Group);
TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.Name);
TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount);
}
@@ -134,6 +146,17 @@ TEST(UnityCommandOptions, OptionVerbose)
TEST_ASSERT_EQUAL(1, UnityFixture.Verbose);
}
static const char* dryRun[] = {
"testrunner.exe",
"-d"
};
TEST(UnityCommandOptions, OptionDryRun)
{
TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, dryRun));
TEST_ASSERT_EQUAL(1, UnityFixture.DryRun);
}
static const char* group[] = {
"testrunner.exe",
"-g", "groupname"
@@ -156,6 +179,28 @@ TEST(UnityCommandOptions, OptionSelectTestByName)
STRCMP_EQUAL("testname", UnityFixture.NameFilter);
}
static const char* groupExact[] = {
"testrunner.exe",
"-G", "groupname"
};
TEST(UnityCommandOptions, OptionSelectTestByGroupExact)
{
TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, groupExact));
STRCMP_EQUAL("groupname", UnityFixture.Group);
}
static const char* nameExact[] = {
"testrunner.exe",
"-N", "testname"
};
TEST(UnityCommandOptions, OptionSelectTestByNameExact)
{
TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, nameExact));
STRCMP_EQUAL("testname", UnityFixture.Name);
}
static const char* repeat[] = {
"testrunner.exe",
"-r", "99"

View File

@@ -1,9 +1,9 @@
/* Copyright (c) 2010 James Grenning and Contributed to Unity Project
* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity_fixture.h"
@@ -19,8 +19,11 @@ TEST_GROUP_RUNNER(UnityCommandOptions)
{
RUN_TEST_CASE(UnityCommandOptions, DefaultOptions);
RUN_TEST_CASE(UnityCommandOptions, OptionVerbose);
RUN_TEST_CASE(UnityCommandOptions, OptionDryRun);
RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup);
RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName);
RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroupExact);
RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByNameExact);
RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount);
RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount);
RUN_TEST_CASE(UnityCommandOptions, MultipleOptions);

View File

@@ -1,8 +1,9 @@
/* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "unity_memory.h"

View File

@@ -1,8 +1,9 @@
/* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef UNITY_MEMORY_OVERRIDES_H_
#define UNITY_MEMORY_OVERRIDES_H_

View File

@@ -1,3 +1,10 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
CC = gcc
ifeq ($(shell uname -s), Darwin)
CC = clang

View File

@@ -1,8 +1,9 @@
/* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "unity_memory.h"

View File

@@ -1,8 +1,9 @@
/* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "unity_memory.h"

View File

@@ -1,8 +1,9 @@
/* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "unity_output_Spy.h"

View File

@@ -1,8 +1,9 @@
/* ==========================================
* Unity Project - A Test Framework for C
* Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
* [Released under MIT License. Please refer to license.txt for details]
* ========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef UNITY_OUTPUT_SPY_H
#define UNITY_OUTPUT_SPY_H

View File

@@ -1,6 +1,13 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
{
"name": "Unity",
"version": "2.5.2",
"version": "2.6.0",
"keywords": "unit-testing, testing, tdd, testing-framework",
"description": "Simple Unit Testing for C",
"homepage": "http://www.throwtheswitch.org/unity",

View File

@@ -25,25 +25,35 @@ project('unity', 'c',
build_fixture = get_option('extension_fixture')
build_memory = get_option('extension_memory')
support_double = get_option('support_double')
fixture_help_message = get_option('fixture_help_message')
unity_args = []
unity_src = []
unity_inc = []
subdir('src')
if build_fixture
# Building the fixture extension implies building the memory
# extension.
build_memory = true
subdir('extras/fixture/src')
if fixture_help_message != ''
unity_args += '-DUNITY_CUSTOM_HELP_MSG=' + fixture_help_message
endif
endif
if build_memory
if build_memory.enabled() or (build_memory.auto() and build_fixture)
subdir('extras/memory/src')
else
unity_args += '-DUNITY_FIXTURE_NO_EXTRAS'
endif
if support_double
unity_args += '-DUNITY_INCLUDE_DOUBLE'
endif
unity_lib = static_library(meson.project_name(),
sources: unity_src,
c_args: unity_args,
include_directories: unity_inc,
install: not meson.is_subproject(),
)
@@ -57,10 +67,10 @@ unity_dep = declare_dependency(
if not meson.is_subproject()
pkg = import('pkgconfig')
pkg.generate(
name: meson.project_name(),
unity_lib,
version: meson.project_version(),
libraries: [ unity_lib ],
description: 'C Unit testing framework.'
subdirs: 'unity',
extra_cflags: unity_args,
)
endif

View File

@@ -1,2 +1,4 @@
option('extension_fixture', type: 'boolean', value: 'false', description: 'Whether to enable the fixture extension.')
option('extension_memory', type: 'boolean', value: 'false', description: 'Whether to enable the memory extension.')
option('extension_fixture', type: 'boolean', value: false, description: 'Whether to enable the fixture extension.')
option('extension_memory', type: 'feature', value: 'auto', description: 'Whether to enable the memory extension. By default this is automatically enabled when extension_fixture is enabled.')
option('support_double', type: 'boolean', value: false, description: 'Whether to enable double precision floating point assertions.')
option('fixture_help_message', type: 'string', description: 'If the fixture extension is enabled, this allows a custom help message to be defined.')

View File

@@ -1,3 +1,10 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
import os
Import("env")

View File

@@ -1,8 +1,9 @@
/* =========================================================================
Unity Project - A Test Framework for C
Copyright (c) 2007-21 Mike Karlesky, Mark VanderVoord, Greg Williams
[Released under MIT License. Please refer to license.txt for details]
============================================================================ */
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
@@ -60,14 +61,24 @@ const char UNITY_PROGMEM UnityStrErrShorthand[] = "Unity Shorth
const char UNITY_PROGMEM UnityStrErrFloat[] = "Unity Floating Point Disabled";
const char UNITY_PROGMEM UnityStrErrDouble[] = "Unity Double Precision Disabled";
const char UNITY_PROGMEM UnityStrErr64[] = "Unity 64-bit Support Disabled";
const char UNITY_PROGMEM UnityStrErrDetailStack[] = "Unity Detail Stack Support Disabled";
static const char UNITY_PROGMEM UnityStrBreaker[] = "-----------------------";
static const char UNITY_PROGMEM UnityStrResultsTests[] = " Tests ";
static const char UNITY_PROGMEM UnityStrResultsFailures[] = " Failures ";
static const char UNITY_PROGMEM UnityStrResultsIgnored[] = " Ignored ";
#ifndef UNITY_EXCLUDE_DETAILS
#ifdef UNITY_DETAIL_STACK_SIZE
static const char* UNITY_PROGMEM UnityStrDetailLabels[] = UNITY_DETAIL_LABEL_NAMES;
static const UNITY_COUNTER_TYPE UNITY_PROGMEM UnityStrDetailLabelsCount = sizeof(UnityStrDetailLabels) / sizeof(const char*);
static const char UNITY_PROGMEM UnityStrErrDetailStackEmpty[] = " Detail Stack Empty";
static const char UNITY_PROGMEM UnityStrErrDetailStackFull[] = " Detail Stack Full";
static const char UNITY_PROGMEM UnityStrErrDetailStackLabel[] = " Detail Label Outside Of UNITY_DETAIL_LABEL_NAMES: ";
static const char UNITY_PROGMEM UnityStrErrDetailStackPop[] = " Detail Pop With Unexpected Arguments";
#else
static const char UNITY_PROGMEM UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
static const char UNITY_PROGMEM UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
#endif
#endif
/*-----------------------------------------------
* Pretty Printers & Test Result Output Handlers
*-----------------------------------------------*/
@@ -184,7 +195,7 @@ void UnityPrintLen(const char* string, const UNITY_UINT32 length)
}
/*-----------------------------------------------*/
void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style)
void UnityPrintIntNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style)
{
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
{
@@ -222,9 +233,13 @@ void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T
UnityPrintNumber(number);
}
}
else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
}
void UnityPrintUintNumberByStyle(const UNITY_UINT number, const UNITY_DISPLAY_STYLE_T style)
{
UnityPrintNumberUnsigned((UNITY_UINT)number);
if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
{
UnityPrintNumberUnsigned(number);
}
else
{
@@ -356,11 +371,11 @@ void UnityPrintFloat(const UNITY_DOUBLE input_number)
{
UnityPrint("0");
}
else if (isnan(number))
else if (UNITY_IS_NAN(number))
{
UnityPrint("nan");
}
else if (isinf(number))
else if (UNITY_IS_INF(number))
{
UnityPrint("inf");
}
@@ -573,6 +588,32 @@ static void UnityAddMsgIfSpecified(const char* msg)
UNITY_PRINT_TEST_CONTEXT();
#endif
#ifndef UNITY_EXCLUDE_DETAILS
#ifdef UNITY_DETAIL_STACK_SIZE
{
UNITY_COUNTER_TYPE c;
for (c = 0; (c < Unity.CurrentDetailStackSize) && (c < UNITY_DETAIL_STACK_SIZE); c++) {
const char* label;
if ((Unity.CurrentDetailStackLabels[c] == UNITY_DETAIL_NONE) || (Unity.CurrentDetailStackLabels[c] > UnityStrDetailLabelsCount)) {
break;
}
label = UnityStrDetailLabels[Unity.CurrentDetailStackLabels[c]];
UnityPrint(UnityStrSpacer);
if ((label[0] == '#') && (label[1] != 0)) {
UnityPrint(label + 2);
UNITY_OUTPUT_CHAR(' ');
if ((label[1] & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT) {
UnityPrintIntNumberByStyle((UNITY_INT)Unity.CurrentDetailStackValues[c], label[1]);
} else {
UnityPrintUintNumberByStyle((UNITY_UINT)Unity.CurrentDetailStackValues[c], label[1]);
}
} else if (Unity.CurrentDetailStackValues[c] != 0){
UnityPrint(label);
UNITY_OUTPUT_CHAR(' ');
UnityPrint((const char*)Unity.CurrentDetailStackValues[c]);
}
}
}
#else
if (Unity.CurrentDetail1)
{
UnityPrint(UnityStrSpacer);
@@ -584,6 +625,7 @@ static void UnityAddMsgIfSpecified(const char* msg)
UnityPrint(Unity.CurrentDetail2);
}
}
#endif
#endif
if (msg)
{
@@ -708,7 +750,7 @@ void UnityAssertBits(const UNITY_INT mask,
}
/*-----------------------------------------------*/
void UnityAssertEqualNumber(const UNITY_INT expected,
void UnityAssertEqualIntNumber(const UNITY_INT expected,
const UNITY_INT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
@@ -720,16 +762,35 @@ void UnityAssertEqualNumber(const UNITY_INT expected,
{
UnityTestResultsFailBegin(lineNumber);
UnityPrint(UnityStrExpected);
UnityPrintNumberByStyle(expected, style);
UnityPrintIntNumberByStyle(expected, style);
UnityPrint(UnityStrWas);
UnityPrintNumberByStyle(actual, style);
UnityPrintIntNumberByStyle(actual, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
}
void UnityAssertEqualUintNumber(const UNITY_UINT expected,
const UNITY_UINT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style)
{
RETURN_IF_FAIL_OR_IGNORE;
if (expected != actual)
{
UnityTestResultsFailBegin(lineNumber);
UnityPrint(UnityStrExpected);
UnityPrintUintNumberByStyle(expected, style);
UnityPrint(UnityStrWas);
UnityPrintUintNumberByStyle(actual, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
}
/*-----------------------------------------------*/
void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
void UnityAssertIntGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
const UNITY_INT actual,
const UNITY_COMPARISON_T compare,
const char *msg,
@@ -739,30 +800,52 @@ void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
int failed = 0;
RETURN_IF_FAIL_OR_IGNORE;
if ((threshold == actual) && (compare & UNITY_EQUAL_TO)) { return; }
if ((threshold == actual)) { failed = 1; }
if ((threshold == actual) && !(compare & UNITY_EQUAL_TO)) { failed = 1; }
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
{
if ((actual > threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
if ((actual < threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
}
else /* UINT or HEX */
{
if (((UNITY_UINT)actual > (UNITY_UINT)threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
if (((UNITY_UINT)actual < (UNITY_UINT)threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
}
if (failed)
{
UnityTestResultsFailBegin(lineNumber);
UnityPrint(UnityStrExpected);
UnityPrintNumberByStyle(actual, style);
UnityPrintIntNumberByStyle(actual, style);
if (compare & UNITY_GREATER_THAN) { UnityPrint(UnityStrGt); }
if (compare & UNITY_SMALLER_THAN) { UnityPrint(UnityStrLt); }
if (compare & UNITY_EQUAL_TO) { UnityPrint(UnityStrOrEqual); }
if (compare == UNITY_NOT_EQUAL) { UnityPrint(UnityStrNotEqual); }
UnityPrintNumberByStyle(threshold, style);
UnityPrintIntNumberByStyle(threshold, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
}
void UnityAssertUintGreaterOrLessOrEqualNumber(const UNITY_UINT threshold,
const UNITY_UINT actual,
const UNITY_COMPARISON_T compare,
const char *msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style)
{
int failed = 0;
RETURN_IF_FAIL_OR_IGNORE;
if ((threshold == actual) && !(compare & UNITY_EQUAL_TO)) { failed = 1; }
/* UINT or HEX */
if ((actual > threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
if ((actual < threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
if (failed)
{
UnityTestResultsFailBegin(lineNumber);
UnityPrint(UnityStrExpected);
UnityPrintUintNumberByStyle(actual, style);
if (compare & UNITY_GREATER_THAN) { UnityPrint(UnityStrGt); }
if (compare & UNITY_SMALLER_THAN) { UnityPrint(UnityStrLt); }
if (compare & UNITY_EQUAL_TO) { UnityPrint(UnityStrOrEqual); }
if (compare == UNITY_NOT_EQUAL) { UnityPrint(UnityStrNotEqual); }
UnityPrintUintNumberByStyle(threshold, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
@@ -876,9 +959,9 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
UnityPrint(UnityStrElement);
UnityPrintNumberUnsigned(num_elements - elements - 1);
UnityPrint(UnityStrExpected);
UnityPrintNumberByStyle(expect_val, style);
UnityPrintIntNumberByStyle(expect_val, style);
UnityPrint(UnityStrWas);
UnityPrintNumberByStyle(actual_val, style);
UnityPrintIntNumberByStyle(actual_val, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
@@ -895,15 +978,15 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
#ifndef UNITY_EXCLUDE_FLOAT
/* Wrap this define in a function with variable types as float or double */
#define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff) \
if (isinf(expected) && isinf(actual) && (((expected) < 0) == ((actual) < 0))) return 1; \
if (UNITY_IS_INF(expected) && UNITY_IS_INF(actual) && (((expected) < 0) == ((actual) < 0))) return 1; \
if (UNITY_NAN_CHECK) return 1; \
(diff) = (actual) - (expected); \
if ((diff) < 0) (diff) = -(diff); \
if ((delta) < 0) (delta) = -(delta); \
return !(isnan(diff) || isinf(diff) || ((diff) > (delta)))
return !(UNITY_IS_NAN(diff) || UNITY_IS_INF(diff) || ((diff) > (delta)))
/* This first part of this condition will catch any NaN or Infinite values */
#ifndef UNITY_NAN_NOT_EQUAL_NAN
#define UNITY_NAN_CHECK isnan(expected) && isnan(actual)
#define UNITY_NAN_CHECK UNITY_IS_NAN(expected) && UNITY_IS_NAN(actual)
#else
#define UNITY_NAN_CHECK 0
#endif
@@ -954,12 +1037,12 @@ void UnityAssertWithinFloatArray(const UNITY_FLOAT delta,
#endif
}
if (isinf(in_delta))
if (UNITY_IS_INF(in_delta))
{
return; /* Arrays will be force equal with infinite delta */
}
if (isnan(in_delta))
if (UNITY_IS_NAN(in_delta))
{
/* Delta must be correct number */
UnityPrintPointlessAndBail();
@@ -1027,6 +1110,7 @@ void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
}
}
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
/*-----------------------------------------------*/
void UnityAssertFloatsNotWithin(const UNITY_FLOAT delta,
const UNITY_FLOAT expected,
@@ -1080,6 +1164,7 @@ void UnityAssertGreaterOrLessFloat(const UNITY_FLOAT threshold,
UNITY_FAIL_AND_BAIL;
}
}
#endif /* ! UNITY_EXCLUDE_FLOAT_PRINT */
/*-----------------------------------------------*/
void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
@@ -1098,23 +1183,24 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
{
case UNITY_FLOAT_IS_INF:
case UNITY_FLOAT_IS_NOT_INF:
is_trait = isinf(actual) && (actual > 0);
is_trait = UNITY_IS_INF(actual) && (actual > 0);
break;
case UNITY_FLOAT_IS_NEG_INF:
case UNITY_FLOAT_IS_NOT_NEG_INF:
is_trait = isinf(actual) && (actual < 0);
is_trait = UNITY_IS_INF(actual) && (actual < 0);
break;
case UNITY_FLOAT_IS_NAN:
case UNITY_FLOAT_IS_NOT_NAN:
is_trait = isnan(actual) ? 1 : 0;
is_trait = UNITY_IS_NAN(actual) ? 1 : 0;
break;
case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
case UNITY_FLOAT_IS_NOT_DET:
is_trait = !isinf(actual) && !isnan(actual);
is_trait = !UNITY_IS_INF(actual) && !UNITY_IS_NAN(actual);
break;
case UNITY_FLOAT_INVALID_TRAIT: /* Supress warning */
default: /* including UNITY_FLOAT_INVALID_TRAIT */
trait_index = 0;
trait_names[0] = UnityStrInvalidFloatTrait;
@@ -1181,12 +1267,12 @@ void UnityAssertWithinDoubleArray(const UNITY_DOUBLE delta,
#endif
}
if (isinf(in_delta))
if (UNITY_IS_INF(in_delta))
{
return; /* Arrays will be force equal with infinite delta */
}
if (isnan(in_delta))
if (UNITY_IS_NAN(in_delta))
{
/* Delta must be correct number */
UnityPrintPointlessAndBail();
@@ -1253,6 +1339,7 @@ void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
}
}
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
/*-----------------------------------------------*/
void UnityAssertDoublesNotWithin(const UNITY_DOUBLE delta,
const UNITY_DOUBLE expected,
@@ -1306,6 +1393,7 @@ void UnityAssertGreaterOrLessDouble(const UNITY_DOUBLE threshold,
UNITY_FAIL_AND_BAIL;
}
}
#endif /* ! UNITY_EXCLUDE_FLOAT_PRINT */
/*-----------------------------------------------*/
void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
@@ -1324,23 +1412,24 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
{
case UNITY_FLOAT_IS_INF:
case UNITY_FLOAT_IS_NOT_INF:
is_trait = isinf(actual) && (actual > 0);
is_trait = UNITY_IS_INF(actual) && (actual > 0);
break;
case UNITY_FLOAT_IS_NEG_INF:
case UNITY_FLOAT_IS_NOT_NEG_INF:
is_trait = isinf(actual) && (actual < 0);
is_trait = UNITY_IS_INF(actual) && (actual < 0);
break;
case UNITY_FLOAT_IS_NAN:
case UNITY_FLOAT_IS_NOT_NAN:
is_trait = isnan(actual) ? 1 : 0;
is_trait = UNITY_IS_NAN(actual) ? 1 : 0;
break;
case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
case UNITY_FLOAT_IS_NOT_DET:
is_trait = !isinf(actual) && !isnan(actual);
is_trait = !UNITY_IS_INF(actual) && !UNITY_IS_NAN(actual);
break;
case UNITY_FLOAT_INVALID_TRAIT: /* Supress warning */
default: /* including UNITY_FLOAT_INVALID_TRAIT */
trait_index = 0;
trait_names[0] = UnityStrInvalidFloatTrait;
@@ -1374,7 +1463,7 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
#endif /* not UNITY_EXCLUDE_DOUBLE */
/*-----------------------------------------------*/
void UnityAssertNumbersWithin(const UNITY_UINT delta,
void UnityAssertIntNumbersWithin(const UNITY_UINT delta,
const UNITY_INT expected,
const UNITY_INT actual,
const char* msg,
@@ -1383,8 +1472,6 @@ void UnityAssertNumbersWithin(const UNITY_UINT delta,
{
RETURN_IF_FAIL_OR_IGNORE;
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
{
if (actual > expected)
{
Unity.CurrentTestFailed = (((UNITY_UINT)actual - (UNITY_UINT)expected) > delta);
@@ -1393,28 +1480,48 @@ void UnityAssertNumbersWithin(const UNITY_UINT delta,
{
Unity.CurrentTestFailed = (((UNITY_UINT)expected - (UNITY_UINT)actual) > delta);
}
if (Unity.CurrentTestFailed)
{
UnityTestResultsFailBegin(lineNumber);
UnityPrint(UnityStrDelta);
UnityPrintIntNumberByStyle((UNITY_INT)delta, style);
UnityPrint(UnityStrExpected);
UnityPrintIntNumberByStyle(expected, style);
UnityPrint(UnityStrWas);
UnityPrintIntNumberByStyle(actual, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
}
void UnityAssertUintNumbersWithin(const UNITY_UINT delta,
const UNITY_UINT expected,
const UNITY_UINT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style)
{
RETURN_IF_FAIL_OR_IGNORE;
if (actual > expected)
{
Unity.CurrentTestFailed = ((actual - expected) > delta);
}
else
{
if ((UNITY_UINT)actual > (UNITY_UINT)expected)
{
Unity.CurrentTestFailed = (((UNITY_UINT)actual - (UNITY_UINT)expected) > delta);
}
else
{
Unity.CurrentTestFailed = (((UNITY_UINT)expected - (UNITY_UINT)actual) > delta);
}
Unity.CurrentTestFailed = ((expected - actual) > delta);
}
if (Unity.CurrentTestFailed)
{
UnityTestResultsFailBegin(lineNumber);
UnityPrint(UnityStrDelta);
UnityPrintNumberByStyle((UNITY_INT)delta, style);
UnityPrintUintNumberByStyle(delta, style);
UnityPrint(UnityStrExpected);
UnityPrintNumberByStyle(expected, style);
UnityPrintUintNumberByStyle(expected, style);
UnityPrint(UnityStrWas);
UnityPrintNumberByStyle(actual, style);
UnityPrintUintNumberByStyle(actual, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
@@ -1565,13 +1672,13 @@ void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
}
UnityTestResultsFailBegin(lineNumber);
UnityPrint(UnityStrDelta);
UnityPrintNumberByStyle((UNITY_INT)delta, style);
UnityPrintIntNumberByStyle((UNITY_INT)delta, style);
UnityPrint(UnityStrElement);
UnityPrintNumberUnsigned(num_elements - elements - 1);
UnityPrint(UnityStrExpected);
UnityPrintNumberByStyle(expect_val, style);
UnityPrintIntNumberByStyle(expect_val, style);
UnityPrint(UnityStrWas);
UnityPrintNumberByStyle(actual_val, style);
UnityPrintIntNumberByStyle(actual_val, style);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
@@ -1607,8 +1714,8 @@ void UnityAssertEqualString(const char* expected,
}
}
else
{ /* handle case of one pointers being null (if both null, test should pass) */
if (expected != actual)
{ /* fail if either null but not if both */
if (expected || actual)
{
Unity.CurrentTestFailed = 1;
}
@@ -1647,8 +1754,8 @@ void UnityAssertEqualStringLen(const char* expected,
}
}
else
{ /* handle case of one pointers being null (if both null, test should pass) */
if (expected != actual)
{ /* fail if either null but not if both */
if (expected || actual)
{
Unity.CurrentTestFailed = 1;
}
@@ -1802,9 +1909,9 @@ void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
UnityPrint(UnityStrByte);
UnityPrintNumberUnsigned(length - bytes - 1);
UnityPrint(UnityStrExpected);
UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
UnityPrintIntNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
UnityPrint(UnityStrWas);
UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
UnityPrintIntNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
@@ -1934,7 +2041,7 @@ static enum UnityLengthModifier UnityLengthModifierGet(const char *pch, int *len
}
case 'h':
{
// short and char are converted to int
/* short and char are converted to int */
length_mod = UNITY_LENGTH_MODIFIER_NONE;
if (pch[1] == 'h')
{
@@ -1951,7 +2058,7 @@ static enum UnityLengthModifier UnityLengthModifierGet(const char *pch, int *len
case 't':
case 'L':
{
// Not supported, but should gobble up the length specifier anyway
/* Not supported, but should gobble up the length specifier anyway */
length_mod = UNITY_LENGTH_MODIFIER_NONE;
*length = 1;
break;
@@ -2029,15 +2136,22 @@ static void UnityPrintFVA(const char* format, va_list va)
UNITY_EXTRACT_ARG(UNITY_UINT, number, length_mod, va, unsigned int);
UNITY_OUTPUT_CHAR('0');
UNITY_OUTPUT_CHAR('x');
UnityPrintNumberHex(number, 8);
UnityPrintNumberHex(number, UNITY_MAX_NIBBLES);
break;
}
case 'p':
{
const unsigned int number = va_arg(va, unsigned int);
UNITY_UINT number;
char nibbles_to_print = 8;
if (UNITY_POINTER_WIDTH == 64)
{
length_mod = UNITY_LENGTH_MODIFIER_LONG_LONG;
nibbles_to_print = 16;
}
UNITY_EXTRACT_ARG(UNITY_UINT, number, length_mod, va, unsigned int);
UNITY_OUTPUT_CHAR('0');
UNITY_OUTPUT_CHAR('x');
UnityPrintNumberHex((UNITY_UINT)number, 8);
UnityPrintNumberHex((UNITY_UINT)number, nibbles_to_print);
break;
}
case 'c':
@@ -2117,32 +2231,7 @@ void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
UnityTestResultsBegin(Unity.TestFile, line);
UnityPrint(UnityStrFail);
if (msg != NULL)
{
UNITY_OUTPUT_CHAR(':');
#ifdef UNITY_PRINT_TEST_CONTEXT
UNITY_PRINT_TEST_CONTEXT();
#endif
#ifndef UNITY_EXCLUDE_DETAILS
if (Unity.CurrentDetail1)
{
UnityPrint(UnityStrDetail1Name);
UnityPrint(Unity.CurrentDetail1);
if (Unity.CurrentDetail2)
{
UnityPrint(UnityStrDetail2Name);
UnityPrint(Unity.CurrentDetail2);
}
UnityPrint(UnityStrSpacer);
}
#endif
if (msg[0] != ' ')
{
UNITY_OUTPUT_CHAR(' ');
}
UnityPrint(msg);
}
UnityAddMsgIfSpecified(msg);
UNITY_FAIL_AND_BAIL;
}
@@ -2185,7 +2274,13 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
Unity.CurrentTestName = FuncName;
Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;
Unity.NumberOfTests++;
#ifndef UNITY_EXCLUDE_DETAILS
#ifdef UNITY_DETAIL_STACK_SIZE
Unity.CurrentDetailStackSize = 0;
#else
UNITY_CLR_DETAILS();
#endif
#endif
UNITY_EXEC_TIME_START();
if (TEST_PROTECT())
{
@@ -2253,6 +2348,46 @@ int UnityEnd(void)
return (int)(Unity.TestFailures);
}
/*-----------------------------------------------
* Details Stack
*-----------------------------------------------*/
#ifndef UNITY_EXCLUDE_DETAILS
#ifdef UNITY_DETAIL_STACK_SIZE
void UnityPushDetail(UNITY_DETAIL_LABEL_TYPE label, UNITY_DETAIL_VALUE_TYPE value, const UNITY_LINE_TYPE line) {
if (Unity.CurrentDetailStackSize >= UNITY_DETAIL_STACK_SIZE) {
UnityTestResultsFailBegin(line);
UnityPrint(UnityStrErrDetailStackFull);
UnityAddMsgIfSpecified(NULL);
UNITY_FAIL_AND_BAIL;
}
if (label >= UnityStrDetailLabelsCount) {
UnityTestResultsFailBegin(line);
UnityPrint(UnityStrErrDetailStackLabel);
UnityPrintNumberUnsigned(label);
UnityAddMsgIfSpecified(NULL);
UNITY_FAIL_AND_BAIL;
}
Unity.CurrentDetailStackLabels[Unity.CurrentDetailStackSize] = label;
Unity.CurrentDetailStackValues[Unity.CurrentDetailStackSize++] = value;
}
void UnityPopDetail(UNITY_DETAIL_LABEL_TYPE label, UNITY_DETAIL_VALUE_TYPE value, const UNITY_LINE_TYPE line) {
if (Unity.CurrentDetailStackSize == 0) {
UnityTestResultsFailBegin(line);
UnityPrint(UnityStrErrDetailStackEmpty);
UnityAddMsgIfSpecified(NULL);
UNITY_FAIL_AND_BAIL;
}
if ((Unity.CurrentDetailStackLabels[Unity.CurrentDetailStackSize-1] != label) || (Unity.CurrentDetailStackValues[Unity.CurrentDetailStackSize-1] != value)) {
UnityTestResultsFailBegin(line);
UnityPrint(UnityStrErrDetailStackPop);
UnityAddMsgIfSpecified(NULL);
UNITY_FAIL_AND_BAIL;
}
Unity.CurrentDetailStackSize--;
}
#endif
#endif
/*-----------------------------------------------
* Command Line Argument Support
*-----------------------------------------------*/
@@ -2261,6 +2396,7 @@ int UnityEnd(void)
char* UnityOptionIncludeNamed = NULL;
char* UnityOptionExcludeNamed = NULL;
int UnityVerbosity = 1;
int UnityStrictMatch = 0;
/*-----------------------------------------------*/
int UnityParseOptions(int argc, char** argv)
@@ -2268,6 +2404,7 @@ int UnityParseOptions(int argc, char** argv)
int i;
UnityOptionIncludeNamed = NULL;
UnityOptionExcludeNamed = NULL;
UnityStrictMatch = 0;
for (i = 1; i < argc; i++)
{
@@ -2279,6 +2416,7 @@ int UnityParseOptions(int argc, char** argv)
return -1;
case 'n': /* include tests with name including this string */
case 'f': /* an alias for -n */
UnityStrictMatch = (argv[i][1] == 'n'); /* strictly match this string if -n */
if (argv[i][2] == '=')
{
UnityOptionIncludeNamed = &argv[i][3];
@@ -2320,6 +2458,18 @@ int UnityParseOptions(int argc, char** argv)
UnityPrint("ERROR: Unknown Option ");
UNITY_OUTPUT_CHAR(argv[i][1]);
UNITY_PRINT_EOL();
/* Now display help */
/* FALLTHRU */
case 'h':
UnityPrint("Options: "); UNITY_PRINT_EOL();
UnityPrint("-l List all tests and exit"); UNITY_PRINT_EOL();
UnityPrint("-f NAME Filter to run only tests whose name includes NAME"); UNITY_PRINT_EOL();
UnityPrint("-n NAME Run only the test named NAME"); UNITY_PRINT_EOL();
UnityPrint("-h show this Help menu"); UNITY_PRINT_EOL();
UnityPrint("-q Quiet/decrease verbosity"); UNITY_PRINT_EOL();
UnityPrint("-v increase Verbosity"); UNITY_PRINT_EOL();
UnityPrint("-x NAME eXclude tests whose name includes NAME"); UNITY_PRINT_EOL();
UNITY_OUTPUT_FLUSH();
return 1;
}
}
@@ -2329,7 +2479,7 @@ int UnityParseOptions(int argc, char** argv)
}
/*-----------------------------------------------*/
int IsStringInBiggerString(const char* longstring, const char* shortstring)
static int IsStringInBiggerString(const char* longstring, const char* shortstring)
{
const char* lptr = longstring;
const char* sptr = shortstring;
@@ -2337,7 +2487,7 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
if (*sptr == '*')
{
return 1;
return UnityStrictMatch ? 0 : 1;
}
while (*lptr)
@@ -2350,19 +2500,29 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
lptr++;
sptr++;
/* We're done if we match the entire string or up to a wildcard */
if (*sptr == '*')
return 1;
if (*sptr == ',')
return 1;
if (*sptr == '"')
return 1;
if (*sptr == '\'')
return 1;
if (*sptr == ':')
switch (*sptr)
{
case '*': /* we encountered a wild-card */
return UnityStrictMatch ? 0 : 1;
case ',': /* we encountered the end of match string */
case '"':
case '\'':
case 0:
return (!UnityStrictMatch || (*lptr == 0)) ? 1 : 0;
case ':': /* we encountered the end of a partial match */
return 2;
if (*sptr == 0)
return 1;
default:
break;
}
}
/* If we didn't match and we're on strict matching, we already know we failed */
if (UnityStrictMatch)
{
return 0;
}
/* Otherwise we start in the long pointer 1 character further and try again */
@@ -2374,7 +2534,7 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
}
/*-----------------------------------------------*/
int UnityStringArgumentMatches(const char* str)
static int UnityStringArgumentMatches(const char* str)
{
int retval;
const char* ptr1;

View File

@@ -1,16 +1,17 @@
/* ==========================================
Unity Project - A Test Framework for C
Copyright (c) 2007-21 Mike Karlesky, Mark VanderVoord, Greg Williams
[Released under MIT License. Please refer to license.txt for details]
========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef UNITY_FRAMEWORK_H
#define UNITY_FRAMEWORK_H
#define UNITY
#define UNITY_VERSION_MAJOR 2
#define UNITY_VERSION_MINOR 5
#define UNITY_VERSION_BUILD 4
#define UNITY_VERSION_MINOR 6
#define UNITY_VERSION_BUILD 2
#define UNITY_VERSION ((UNITY_VERSION_MAJOR << 16) | (UNITY_VERSION_MINOR << 8) | UNITY_VERSION_BUILD)
#ifdef __cplusplus
@@ -44,7 +45,7 @@ int suiteTearDown(int num_failures);
* Test Reset and Verify
*-------------------------------------------------------*/
/* These functions are intended to be called before during tests in order
/* These functions are intended to be called before or during tests in order
* to support complex test loops, etc. Both are NOT built into Unity. Instead
* the test runner generator will create them. resetTest will run teardown and
* setup again, verifying any end-of-test needs between. verifyTest will only
@@ -89,7 +90,7 @@ void verifyTest(void);
* - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script
* Parameterized Tests
* - you'll want to create a define of TEST_CASE(...) and/or TEST_RANGE(...) which basically evaluates to nothing
* - you'll want to create a define of TEST_CASE(...), TEST_RANGE(...) and/or TEST_MATRIX(...) which basically evaluates to nothing
* Tests with Arguments
* - you'll want to define UNITY_USE_COMMAND_LINE_ARGS if you have the test runner passing arguments to Unity
@@ -105,7 +106,7 @@ void verifyTest(void);
#define TEST_MESSAGE(message) UnityMessage((message), __LINE__)
#define TEST_ONLY()
#ifdef UNITY_INCLUDE_PRINT_FORMATTED
#define TEST_PRINTF(message, ...) UnityPrintF(__LINE__, (message), __VA_ARGS__)
#define TEST_PRINTF(message, ...) UnityPrintF(__LINE__, (message), ##__VA_ARGS__)
#endif
/* It is not necessary for you to call PASS. A PASS condition is assumed if nothing fails.
@@ -113,9 +114,19 @@ void verifyTest(void);
#define TEST_PASS() TEST_ABORT()
#define TEST_PASS_MESSAGE(message) do { UnityMessage((message), __LINE__); TEST_ABORT(); } while (0)
/* This macro does nothing, but it is useful for build tools (like Ceedling) to make use of this to figure out
* which files should be linked to in order to perform a test. Use it like TEST_FILE("sandwiches.c") */
#define TEST_FILE(a)
/*-------------------------------------------------------
* Build Directives
*-------------------------------------------------------
* These macros do nothing, but they are useful for additional build context.
* Tools (like Ceedling) can scan for these directives and make use of them for
* per-test-executable #include search paths and linking. */
/* Add source files to a test executable's compilation and linking. Ex: TEST_SOURCE_FILE("sandwiches.c") */
#define TEST_SOURCE_FILE(a)
/* Customize #include search paths for a test executable's compilation. Ex: TEST_INCLUDE_PATH("src/module_a/inc") */
#define TEST_INCLUDE_PATH(a)
/*-------------------------------------------------------
* Test Asserts (simple)

View File

@@ -1,8 +1,9 @@
/* ==========================================
Unity Project - A Test Framework for C
Copyright (c) 2007-21 Mike Karlesky, Mark VanderVoord, Greg Williams
[Released under MIT License. Please refer to license.txt for details]
========================================== */
/* =========================================================================
Unity - A Test Framework for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef UNITY_INTERNALS_H
#define UNITY_INTERNALS_H
@@ -46,12 +47,15 @@
#define UNITY_FUNCTION_ATTR(a) /* ignore */
#endif
/* UNITY_NORETURN is only required if we have setjmp.h. */
#ifndef UNITY_EXCLUDE_SETJMP_H
#ifndef UNITY_NORETURN
#if defined(__cplusplus)
#if __cplusplus >= 201103L
#define UNITY_NORETURN [[ noreturn ]]
#endif
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && __STDC_VERSION__ < 202311L
/* _Noreturn keyword is used from C11 but deprecated in C23. */
#if defined(_WIN32) && defined(_MSC_VER)
/* We are using MSVC compiler on Windows platform. */
/* Not all Windows SDKs supports <stdnoreturn.h>, but compiler can support C11: */
@@ -71,14 +75,31 @@
/* https://en.cppreference.com/w/c/language/_Noreturn */
#define UNITY_NORETURN _Noreturn
#else /* Using newer Windows SDK or not MSVC compiler */
#if defined(__GNUC__)
/* The header <stdnoreturn.h> collides with __attribute(noreturn)__ from GCC. */
#define UNITY_NORETURN _Noreturn
#else
#include <stdnoreturn.h>
#define UNITY_NORETURN noreturn
#endif
#endif
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
/* Since C23, the keyword _Noreturn has been replaced by the attribute noreturn, based on: */
/* https://en.cppreference.com/w/c/language/attributes/noreturn */
#define UNITY_NORETURN [[ noreturn ]]
#elif defined(__IAR_SYSTEMS_ICC__) && (__IAR_SYSTEMS_ICC__ >= 8)
/* For IAR compilers supporting at least C99 use the IAR specific '__noreturn' keyword */
/* Based on tests and: */
/* https://wwwfiles.iar.com/arm/webic/doc/EWARM_DevelopmentGuide.ENU.pdf */
/* https://wwwfiles.iar.com/AVR/webic/doc/EWAVR_CompilerGuide.pdf */
/* https://wwwfiles.iar.com/msp430/webic/doc/EW430_CompilerReference.pdf */
#define UNITY_NORETURN __noreturn
#endif
#endif
#ifndef UNITY_NORETURN
#define UNITY_NORETURN UNITY_FUNCTION_ATTR(__noreturn__)
#endif
#endif
/*-------------------------------------------------------
* Guess Widths If Not Specified
@@ -241,16 +262,25 @@
#endif
typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
/* isinf & isnan macros should be provided by math.h */
#ifndef isinf
/* The value of Inf - Inf is NaN */
#define isinf(n) (isnan((n) - (n)) && !isnan(n))
#endif
/* isnan macro should be provided by math.h. Override if not macro */
#ifndef UNITY_IS_NAN
#ifndef isnan
/* NaN is the only floating point value that does NOT equal itself.
* Therefore if n != n, then it is NaN. */
#define isnan(n) ((n != n) ? 1 : 0)
#define UNITY_IS_NAN(n) ((n != n) ? 1 : 0)
#else
#define UNITY_IS_NAN(n) isnan(n)
#endif
#endif
/* isinf macro should be provided by math.h. Override if not macro */
#ifndef UNITY_IS_INF
#ifndef isinf
/* The value of Inf - Inf is NaN */
#define UNITY_IS_INF(n) (UNITY_IS_NAN((n) - (n)) && !UNITY_IS_NAN(n))
#else
#define UNITY_IS_INF(n) isinf(n)
#endif
#endif
#endif
@@ -457,14 +487,12 @@ typedef enum
typedef enum
{
UNITY_WITHIN = 0x0,
UNITY_EQUAL_TO = 0x1,
UNITY_GREATER_THAN = 0x2,
UNITY_GREATER_OR_EQUAL = 0x2 + UNITY_EQUAL_TO,
UNITY_SMALLER_THAN = 0x4,
UNITY_SMALLER_OR_EQUAL = 0x4 + UNITY_EQUAL_TO,
UNITY_NOT_EQUAL = 0x0,
UNITY_UNKNOWN
UNITY_NOT_EQUAL = 0x8
} UNITY_COMPARISON_T;
#ifndef UNITY_EXCLUDE_FLOAT
@@ -489,13 +517,30 @@ typedef enum
UNITY_ARRAY_UNKNOWN
} UNITY_FLAGS_T;
#ifndef UNITY_EXCLUDE_DETAILS
#ifdef UNITY_DETAIL_STACK_SIZE
#ifndef UNITY_DETAIL_LABEL_TYPE
#define UNITY_DETAIL_LABEL_TYPE uint8_t
#endif
#ifndef UNITY_DETAIL_VALUE_TYPE
#define UNITY_DETAIL_VALUE_TYPE UNITY_PTR_TO_INT
#endif
#endif
#endif
struct UNITY_STORAGE_T
{
const char* TestFile;
const char* CurrentTestName;
#ifndef UNITY_EXCLUDE_DETAILS
#ifdef UNITY_DETAIL_STACK_SIZE
UNITY_DETAIL_LABEL_TYPE CurrentDetailStackLabels[UNITY_DETAIL_STACK_SIZE];
UNITY_DETAIL_VALUE_TYPE CurrentDetailStackValues[UNITY_DETAIL_STACK_SIZE];
UNITY_COUNTER_TYPE CurrentDetailStackSize;
#else
const char* CurrentDetail1;
const char* CurrentDetail2;
#endif
#endif
UNITY_LINE_TYPE CurrentTestLineNumber;
UNITY_COUNTER_TYPE NumberOfTests;
@@ -538,10 +583,6 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
#define UNITY_SET_DETAIL(d1)
#define UNITY_SET_DETAILS(d1,d2)
#else
#define UNITY_CLR_DETAILS() do { Unity.CurrentDetail1 = 0; Unity.CurrentDetail2 = 0; } while (0)
#define UNITY_SET_DETAIL(d1) do { Unity.CurrentDetail1 = (d1); Unity.CurrentDetail2 = 0; } while (0)
#define UNITY_SET_DETAILS(d1,d2) do { Unity.CurrentDetail1 = (d1); Unity.CurrentDetail2 = (d2); } while (0)
#ifndef UNITY_DETAIL1_NAME
#define UNITY_DETAIL1_NAME "Function"
#endif
@@ -549,6 +590,47 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
#ifndef UNITY_DETAIL2_NAME
#define UNITY_DETAIL2_NAME "Argument"
#endif
#ifdef UNITY_DETAIL_STACK_SIZE
/* stack based implementation */
#ifndef UNITY_DETAIL_LABEL_NAMES
/* Note: If the label name string starts with '#', the second byte is interpreted as UNITY_DISPLAY_STYLE_T,
* and the detail value will be printed as number (e.g. "#\x24Line" to output "Line <UINT32 value>").
* Otherwise, the detail value must be a pointer to a string that is valid until it is pop'ed.
*/
#define UNITY_DETAIL_LABEL_NAMES {0, UNITY_DETAIL1_NAME, UNITY_DETAIL2_NAME}
typedef enum
{
UNITY_DETAIL_NONE = 0,
UNITY_DETAIL_D1 = 1,
UNITY_DETAIL_D2 = 2
} UNITY_DETAIL_LABEL_T;
#endif
void UnityPushDetail(UNITY_DETAIL_LABEL_TYPE label, UNITY_DETAIL_VALUE_TYPE value, const UNITY_LINE_TYPE line);
void UnityPopDetail(UNITY_DETAIL_LABEL_TYPE label, UNITY_DETAIL_VALUE_TYPE value, const UNITY_LINE_TYPE line);
#define UNITY_CLR_DETAILS() do { \
if(Unity.CurrentDetailStackSize && \
Unity.CurrentDetailStackLabels[Unity.CurrentDetailStackSize - 1] == UNITY_DETAIL_D2) { \
Unity.CurrentDetailStackLabels[--Unity.CurrentDetailStackSize] = UNITY_DETAIL_NONE;} \
if(Unity.CurrentDetailStackSize && \
Unity.CurrentDetailStackLabels[Unity.CurrentDetailStackSize - 1] == UNITY_DETAIL_D1) { \
Unity.CurrentDetailStackLabels[--Unity.CurrentDetailStackSize] = UNITY_DETAIL_NONE;} \
} while (0)
#define UNITY_SET_DETAIL(d1) do { UNITY_CLR_DETAILS(); \
UnityPushDetail(UNITY_DETAIL_D1, (UNITY_DETAIL_VALUE_TYPE)(d1), __LINE__); \
} while (0)
#define UNITY_SET_DETAILS(d1,d2) do { UNITY_CLR_DETAILS(); \
UnityPushDetail(UNITY_DETAIL_D1, (UNITY_DETAIL_VALUE_TYPE)(d1), __LINE__); \
UnityPushDetail(UNITY_DETAIL_D2, (UNITY_DETAIL_VALUE_TYPE)(d2), __LINE__); \
} while (0)
#else
/* just two hardcoded slots */
#define UNITY_CLR_DETAILS() do { Unity.CurrentDetail1 = 0; Unity.CurrentDetail2 = 0; } while (0)
#define UNITY_SET_DETAIL(d1) do { Unity.CurrentDetail1 = (d1); Unity.CurrentDetail2 = 0; } while (0)
#define UNITY_SET_DETAILS(d1,d2) do { Unity.CurrentDetail1 = (d1); Unity.CurrentDetail2 = (d2); } while (0)
#endif
#endif
#ifdef UNITY_PRINT_TEST_CONTEXT
@@ -567,7 +649,8 @@ void UnityPrintF(const UNITY_LINE_TYPE line, const char* format, ...);
void UnityPrintLen(const char* string, const UNITY_UINT32 length);
void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number);
void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style);
void UnityPrintIntNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style);
void UnityPrintUintNumberByStyle(const UNITY_UINT number, const UNITY_DISPLAY_STYLE_T style);
void UnityPrintNumber(const UNITY_INT number_to_print);
void UnityPrintNumberUnsigned(const UNITY_UINT number);
void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print);
@@ -584,19 +667,32 @@ void UnityPrintFloat(const UNITY_DOUBLE input_number);
* convention and will pull in file and line information
* for you. */
void UnityAssertEqualNumber(const UNITY_INT expected,
void UnityAssertEqualIntNumber(const UNITY_INT expected,
const UNITY_INT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style);
void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
void UnityAssertEqualUintNumber(const UNITY_UINT expected,
const UNITY_UINT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style);
void UnityAssertIntGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
const UNITY_INT actual,
const UNITY_COMPARISON_T compare,
const char *msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style);
void UnityAssertUintGreaterOrLessOrEqualNumber(const UNITY_UINT threshold,
const UNITY_UINT actual,
const UNITY_COMPARISON_T compare,
const char *msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style);
void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
UNITY_INTERNAL_PTR actual,
const UNITY_UINT32 num_elements,
@@ -637,13 +733,20 @@ void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
const UNITY_LINE_TYPE lineNumber,
const UNITY_FLAGS_T flags);
void UnityAssertNumbersWithin(const UNITY_UINT delta,
void UnityAssertIntNumbersWithin(const UNITY_UINT delta,
const UNITY_INT expected,
const UNITY_INT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style);
void UnityAssertUintNumbersWithin(const UNITY_UINT delta,
const UNITY_UINT expected,
const UNITY_UINT actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style);
void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
UNITY_INTERNAL_PTR expected,
UNITY_INTERNAL_PTR actual,
@@ -759,13 +862,25 @@ extern const char UnityStrErrShorthand[];
* Test Running Macros
*-------------------------------------------------------*/
#ifdef UNITY_TEST_PROTECT
#define TEST_PROTECT() UNITY_TEST_PROTECT()
#else
#ifndef UNITY_EXCLUDE_SETJMP_H
#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)
#define TEST_ABORT() longjmp(Unity.AbortFrame, 1)
#else
#define TEST_PROTECT() 1
#endif
#endif
#ifdef UNITY_TEST_ABORT
#define TEST_ABORT() UNITY_TEST_ABORT()
#else
#ifndef UNITY_EXCLUDE_SETJMP_H
#define TEST_ABORT() longjmp(Unity.AbortFrame, 1)
#else
#define TEST_ABORT() return
#endif
#endif
/* Automatically enable variadic macros support, if it not enabled before */
#ifndef UNITY_SUPPORT_VARIADIC_MACROS
@@ -793,6 +908,9 @@ extern const char UnityStrErrShorthand[];
#if !defined(TEST_RANGE) && !defined(UNITY_EXCLUDE_TEST_RANGE)
#define TEST_RANGE(...)
#endif
#if !defined(TEST_MATRIX) && !defined(UNITY_EXCLUDE_TEST_MATRIX)
#define TEST_MATRIX(...)
#endif
#endif
#endif
@@ -850,103 +968,103 @@ int UnityTestMatches(void);
* Test Asserts
*-------------------------------------------------------*/
#define UNITY_TEST_ASSERT(condition, line, message) do { if (condition) { /* nothing*/ } else { UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message)); } } while (0)
#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)(line), (message))
#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)(line), (message))
#define UNITY_TEST_ASSERT_EMPTY(pointer, line, message) UNITY_TEST_ASSERT(((pointer[0]) == 0), (UNITY_LINE_TYPE)(line), (message))
#define UNITY_TEST_ASSERT_NOT_EMPTY(pointer, line, message) UNITY_TEST_ASSERT(((pointer[0]) != 0), (UNITY_LINE_TYPE)(line), (message))
#define UNITY_TEST_ASSERT(condition, line, message) do { if (condition) { /* nothing*/ } else { UNITY_TEST_FAIL((line), (message)); } } while (0)
#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (line), (message))
#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (line), (message))
#define UNITY_TEST_ASSERT_EMPTY(pointer, line, message) UNITY_TEST_ASSERT(((pointer[0]) == 0), (line), (message))
#define UNITY_TEST_ASSERT_NOT_EMPTY(pointer, line, message) UNITY_TEST_ASSERT(((pointer[0]) != 0), (line), (message))
#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_UINT8 )(expected), (UNITY_INT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_UINT16)(expected), (UNITY_INT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_UINT32)(expected), (UNITY_INT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_EQUAL_CHAR(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_INT)(UNITY_INT16)(expected), (UNITY_INT)(UNITY_INT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_INT)(UNITY_INT32)(expected), (UNITY_INT)(UNITY_INT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualUintNumber((UNITY_UINT)(expected), (UNITY_UINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualUintNumber((UNITY_UINT)(UNITY_UINT8)(expected), (UNITY_UINT)(UNITY_UINT8)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualUintNumber((UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualUintNumber((UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualUintNumber((UNITY_UINT)(UNITY_UINT8)(expected), (UNITY_UINT)(UNITY_UINT8)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualUintNumber((UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualUintNumber((UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_EQUAL_CHAR(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((UNITY_INT)(mask), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line))
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_NOT_EQUAL_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_NOT_EQUAL_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_NOT_EQUAL_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_NOT_EQUAL_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT8(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT16(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT32(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_NOT_EQUAL_HEX8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_NOT_EQUAL_HEX16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_NOT_EQUAL_HEX32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_NOT_EQUAL_CHAR(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_GREATER_THAN_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT8(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT16(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT32(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_GREATER_THAN_CHAR(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT8(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT16(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT32(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_SMALLER_THAN_CHAR(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 )(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 ) (threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16) (threshold), (UNITY_INT)(UNITY_INT16) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32) (threshold), (UNITY_INT)(UNITY_INT32) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 ) (threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 ) (threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16) (threshold), (UNITY_INT)(UNITY_INT16) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32) (threshold), (UNITY_INT)(UNITY_INT32) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT) (threshold), (UNITY_UINT) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_CHAR(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 ) (threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT8 )(threshold), (UNITY_INT)(UNITY_UINT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT16)(threshold), (UNITY_INT)(UNITY_UINT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_UINT32)(threshold), (UNITY_INT)(UNITY_UINT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT) (threshold), (UNITY_INT) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT8(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT16(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT16)(threshold), (UNITY_INT)(UNITY_INT16) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT32(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT32)(threshold), (UNITY_INT)(UNITY_INT32) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT) (threshold), (UNITY_UINT) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX8(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT8 )(threshold), (UNITY_UINT)(UNITY_UINT8 )(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX16(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT16)(threshold), (UNITY_UINT)(UNITY_UINT16)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX32(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(UNITY_UINT32)(threshold), (UNITY_UINT)(UNITY_UINT32)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_CHAR(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(UNITY_INT8 )(threshold), (UNITY_INT)(UNITY_INT8 ) (actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin( (delta), (UNITY_INT) (expected), (UNITY_INT) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 ) (expected), (UNITY_INT)(UNITY_INT8 ) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_INT16) (expected), (UNITY_INT)(UNITY_INT16) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_INT32) (expected), (UNITY_INT)(UNITY_INT32) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin( (delta), (UNITY_INT) (expected), (UNITY_INT) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT16)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT32)(delta), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_INT)(UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_CHAR_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 ) (expected), (UNITY_INT)(UNITY_INT8 ) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertIntNumbersWithin( (delta), (UNITY_INT) (expected), (UNITY_INT) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertIntNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 ) (expected), (UNITY_INT)(UNITY_INT8 ) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertIntNumbersWithin((UNITY_UINT16 )(delta), (UNITY_INT)(UNITY_INT16) (expected), (UNITY_INT)(UNITY_INT16) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message) UnityAssertIntNumbersWithin((UNITY_UINT32 )(delta), (UNITY_INT)(UNITY_INT32) (expected), (UNITY_INT)(UNITY_INT32) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin( (delta), (UNITY_UINT) (expected), (UNITY_UINT) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin((UNITY_UINT8 )(delta), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT8 )(expected), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin((UNITY_UINT16)(delta), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin((UNITY_UINT32)(delta), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin((UNITY_UINT8 )(delta), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT8 )(expected), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin((UNITY_UINT16)(delta), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT16)(expected), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin((UNITY_UINT32)(delta), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT32)(expected), (UNITY_UINT)(UNITY_UINT)(UNITY_UINT32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
#define UNITY_TEST_ASSERT_CHAR_WITHIN(delta, expected, actual, line, message) UnityAssertIntNumbersWithin((UNITY_UINT8 )(delta), (UNITY_INT)(UNITY_INT8 ) (expected), (UNITY_INT)(UNITY_INT8 ) (actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR)
#define UNITY_TEST_ASSERT_INT_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin( (delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT, UNITY_ARRAY_TO_ARRAY)
#define UNITY_TEST_ASSERT_INT8_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT8 )(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8, UNITY_ARRAY_TO_ARRAY)
@@ -962,7 +1080,7 @@ int UnityTestMatches(void);
#define UNITY_TEST_ASSERT_CHAR_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT8)( delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), ((UNITY_UINT32)(num_elements)), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR, UNITY_ARRAY_TO_ARRAY)
#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((UNITY_PTR_TO_INT)(expected), (UNITY_PTR_TO_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER)
#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_PTR_TO_INT)(expected), (UNITY_PTR_TO_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER)
#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)(line))
#define UNITY_TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len, line, message) UnityAssertEqualStringLen((const char*)(expected), (const char*)(actual), (UNITY_UINT32)(len), (message), (UNITY_LINE_TYPE)(line))
#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(len), 1, (message), (UNITY_LINE_TYPE)(line), UNITY_ARRAY_TO_ARRAY)
@@ -1000,33 +1118,33 @@ int UnityTestMatches(void);
#define UNITY_TEST_ASSERT_EACH_EQUAL_CHAR(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT8 )(expected), 1), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_CHAR, UNITY_ARRAY_TO_VAL)
#ifdef UNITY_SUPPORT_64
#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualIntNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
#define UNITY_TEST_ASSERT_EACH_EQUAL_INT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_VAL)
#define UNITY_TEST_ASSERT_EACH_EQUAL_UINT64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_UINT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_VAL)
#define UNITY_TEST_ASSERT_EACH_EQUAL_HEX64(expected, actual, num_elements, line, message) UnityAssertEqualIntArray(UnityNumToPtr((UNITY_INT)(UNITY_INT64)(expected), 8), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_VAL)
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_NOT_EQUAL_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64(threshold, actual, line, message) UnityAssertGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertIntNumbersWithin((delta), (UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin((delta), (UNITY_UINT)(expected), (UNITY_UINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertUintNumbersWithin((delta), (UNITY_UINT)(expected), (UNITY_UINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_NOT_EQUAL_INT64(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_NOT_EQUAL_UINT64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_NOT_EQUAL_HEX64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_NOT_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_GREATER_THAN_INT64(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_GREATER_THAN_UINT64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_GREATER_THAN_HEX64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_GREATER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT64(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_UINT64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_GREATER_OR_EQUAL_HEX64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_GREATER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_SMALLER_THAN_INT64(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_SMALLER_THAN_UINT64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_SMALLER_THAN_HEX64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_SMALLER_THAN, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_INT64(threshold, actual, line, message) UnityAssertIntGreaterOrLessOrEqualNumber((UNITY_INT)(threshold), (UNITY_INT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_UINT64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_SMALLER_OR_EQUAL_HEX64(threshold, actual, line, message) UnityAssertUintGreaterOrLessOrEqualNumber((UNITY_UINT)(threshold), (UNITY_UINT)(actual), UNITY_SMALLER_OR_EQUAL, (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_INT64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT64)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64, UNITY_ARRAY_TO_ARRAY)
#define UNITY_TEST_ASSERT_UINT64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT64)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64, UNITY_ARRAY_TO_ARRAY)
#define UNITY_TEST_ASSERT_HEX64_ARRAY_WITHIN(delta, expected, actual, num_elements, line, message) UnityAssertNumbersArrayWithin((UNITY_UINT64)(delta), (UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (UNITY_UINT32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64, UNITY_ARRAY_TO_ARRAY)
@@ -1141,5 +1259,13 @@ int UnityTestMatches(void);
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((UNITY_DOUBLE)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_DET)
#endif
#if !defined(UNITY_EXCLUDE_DETAILS) && defined(UNITY_DETAIL_STACK_SIZE)
#define UNITY_DETAIL_PUSH(label, value) UnityPushDetail((UNITY_DETAIL_LABEL_TYPE)(label), (UNITY_DETAIL_VALUE_TYPE)(value), __LINE__)
#define UNITY_DETAIL_POP(label, value) UnityPopDetail((UNITY_DETAIL_LABEL_TYPE)(label), (UNITY_DETAIL_VALUE_TYPE)(value), __LINE__)
#else
#define UNITY_DETAIL_PUSH(label, value) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDetailStack)
#define UNITY_DETAIL_POP(label, value) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDetailStack)
#endif
/* End of UNITY_INTERNALS_H */
#endif

View File

@@ -1,9 +1,14 @@
# This is the configuration used to check the rubocop source code.
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
#inherit_from: .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.3
TargetRubyVersion: 3.0
# These are areas where ThrowTheSwitch's coding style diverges from the Ruby standard
Style/SpecialGlobalVars:
@@ -28,6 +33,8 @@ Style/EvalWithLocation:
Enabled: false
Style/MixinUsage:
Enabled: false
Style/OptionalBooleanParameter:
Enabled: false
# These are also places we diverge... but we will likely comply down the road
Style/IfUnlessModifier:
@@ -36,10 +43,12 @@ Style/FormatStringToken:
Enabled: false
# This is disabled because it seems to get confused over nested hashes
Layout/AlignHash:
Layout/HashAlignment:
Enabled: false
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
Layout/LineLength:
Enabled: false
# We purposefully use these insecure features because they're what makes Ruby awesome
Security/Eval:
@@ -64,8 +73,6 @@ Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:

View File

@@ -1,16 +1,22 @@
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
CC = gcc
ifeq ($(shell uname -s), Darwin)
CC = clang
endif
ifeq ($(findstring clang, $(CC)), clang)
E = -Weverything
CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes
CFLAGS += -Wno-unused-macros -Wno-padded -Wno-missing-noreturn
CFLAGS += $E -Wno-unknown-warning-option
CFLAGS += -Wno-unsafe-buffer-usage
endif
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
#CFLAGS += -Wconversion #disabled because if falsely complains about the isinf and isnan macros
CFLAGS += -Wno-switch-enum -Wno-double-promotion
CFLAGS += -Wno-poison-system-directories
CFLAGS += -Wno-covered-switch-default
CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstrict-overflow \
-Wstrict-prototypes -Wswitch-default -Wundef
#DEBUG = -O0 -g

View File

@@ -1,8 +1,9 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
$verbose = false
$extra_paths = []

Some files were not shown because too many files have changed in this diff Show More