70 Commits

Author SHA1 Message Date
Mark VanderVoord f368744ca5 Updates for the new year 2026-01-23 11:19:02 -05:00
bal-stan 076df6dd5c Fix compiler error when compiling with -Wcast-qual and mocking const function arguments 2025-04-01 16:24:48 +00:00
bal-stan 2bcc723e10 Always cast memcpy dest pointers to const void 2025-02-13 18:06:27 +00:00
Mark VanderVoord a60383ec34 Update licenses to new standards... plus New Years bump 2025-01-01 12:05:55 -05:00
Mark VanderVoord a642b1fe49 Update to latest Unity and therefore newer Rubocop standards. Tweaked scripts to match latest standards. 2023-11-22 17:40:07 -05:00
Mark VanderVoord 4dd557f2df Merge pull request #311 from andred/master
allow compilation with stricter warnings
2021-01-07 18:02:24 -05:00
cloudsftp 94ca645061 add first simple test and remove warning "unused parameter" 2020-08-18 16:31:45 +02:00
cloudsftp b735d09603 add plugin :ignore_stateless that solves ThrowTheSwitch/CMock#307 2020-08-18 15:25:55 +02:00
André Draszik ec6fa2c516 Revert "drop unnecessary prototype (immediately before definition)"
This reverts commit 7fbeb40965.

This causes compilation warnings / errors when a project uses
-Wmissing-prototypes compilation flags for safety reasons:

.../test/mocks/mock_logMessages.c:685:6: warning: no previous prototype for ‘CMockExpectParameters_log_message’ [-Wmissing-prototypes]
  685 | void CMockExpectParameters_log_message(CMOCK_log_message_CALL_INSTANCE* cmock_call_instance, const char* logMessage, int messageID, severity_t severityIn)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

etc.

Signed-off-by: André Draszik <git@andred.net>
2020-05-25 16:35:54 +01:00
Tuc-An 7fbeb40965 drop unnecessary prototype (immediately before definition) 2020-03-27 11:17:14 -04:00
Tuc-An cfcca2e43e convert Boolean values from int to char to reduce memory 2020-03-25 10:00:05 -04:00
mvandervoord 67858837d1 Update coding style to match our own official coding guidelines 2020-03-18 19:16:58 -04:00
John Lindgren 03ddcb9bad Revert "Add quick pointer check before memory comparisons (#224)"
It didn't add direct comparisons only for pointer arguments, but
also other types of arguments like structs, which can't be compared
with '==' and cause a compiler error instead.

To reproduce, just enable the :array plugin in
system/test_interactions/expect_and_return_custom_types.yml:

In function ‘foo’:
error: invalid operands to binary != (have ‘EXAMPLE_STRUCT_T’ {aka
‘struct _EXAMPLE_STRUCT_T’} and ‘EXAMPLE_STRUCT_T’ {aka ‘struct
 _EXAMPLE_STRUCT_T’})
   59 |     if (cmock_call_instance->Expected_a != a) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~

This reverts commit 4df532afcc.
2019-11-15 12:46:28 -05:00
John Lindgren b76d570d4a Replace IgnoreMode with ExpectAnyArgsBool (no functional change).
IgnoreMode was used only for the ExpectAnyArgs plugin, and the
semantics of it were backwards:

  - IgnoreMode = CMOCK_ARG_NONE means to ignore all arguments
  - IgnoreMode = CMOCK_ARG_ALL means to verify all arguments

ExpectAnyArgsBool should make the purpose and semantics of this
field clearer.

Additionally, ExpectAnyArgs doesn't use FinalReturn for anything.
2019-09-16 13:28:14 -04:00
Mark VanderVoord c23c01266a We need function prototypes to comply with strict compiler settings 2019-09-09 16:32:39 -04:00
Mark VanderVoord 4df532afcc Add quick pointer check before memory comparisons (#224) 2019-07-09 23:16:02 -04:00
Mark VanderVoord 347dfc181a Merge branch 'master' into array-typedefs 2019-07-07 15:06:49 -04:00
Mark VanderVoord 4a6ee8680c Merge pull request #190 from achsfy/master
Detect array_data,array_size pattern when generating mock
2019-07-07 14:51:21 -04:00
Mark VanderVoord 5eab75a078 Reimplement PR 227 with fixed tests. 2019-07-06 12:11:56 -04:00
John Lindgren cfa46d6440 Prevent undefined behavior due to typedef array usage. 2018-12-04 18:22:53 -05:00
Aurelien CHAPPUIS e8c7ad9706 Try to find 'array pair' in parameters following this pattern : <type> * <name>, <@array_size_type> <@array_size_name>
When such a pattern is used, the second parameter is used as the array size in _Expect method.
2018-09-18 12:06:40 +02:00
John Lindgren 3b123fb533 Don't assume that pointer-to-constant types have "const" removed.
1. Update treat_as table to include pointer-to-constant types.
2. Remove unnecessary casts in assignments and return statements.
3. Improve logic for adding "const" to types of function arguments.
4. It's no longer necessary to prepend "const" to function return type.
2017-09-12 15:54:47 -04:00
John Lindgren a604fb71a4 Remove dead code (unity_msg is not used since 647876644b). 2017-08-30 10:28:53 -04:00
Mark VanderVoord 3fa4de14be -fix whitespace 2016-01-04 19:27:48 -05:00
Mark VanderVoord cda8d3a7e1 - push the internal function and argument names into a single each per mock to further reduce const overhead. 2015-12-12 12:24:38 -05:00
Mark VanderVoord 647876644b - Centralized error strings to a few constants.
- Made use of the new UNITY_SET_DETAILS feature to background set up function & argument details for messages
- CMock now takes up a lot less memory! woo!
2015-12-10 16:58:10 -05:00
Mark VanderVoord 4fcca4bab7 - Moved the "Out of Memory" string into a const to stop repeating it.
- Added test for Out of Memory error
- reorder the way we handle includes in CMock internals to match the way it works in Unity
2015-12-10 11:09:26 -05:00
Mark VanderVoord ce07ce98be - Fixed error where structs and such passed by reference were getting checked for null, which isn't valid. 2015-12-08 21:55:05 -05:00
Mark VanderVoord 13029cad64 Reintroduce fix to "comparison between pointer and integer" warning accidentally reverted in fcc6a40581. (Thanks for noticing, Steven) 2015-06-19 12:48:00 -04:00
Jocelyn Le Sage 591fa9d1c1 Issue #40: Initialize newly allocated call instances. 2014-11-06 08:46:20 -05:00
Jocelyn Le Sage 19f0bb89b6 Make sure *_IgnoreBool is (re)set to 0 when adding base expectations.
This way, a call to *_IgnoreAndReturn() followed by a call to *_ExpectAndReturn() is properly handled (i.e. the function will not be ignored, as instructed by the last statement).
2014-05-22 06:49:07 -04:00
Mark VanderVoord fcc6a40581 resolved conflicts 2014-03-17 11:14:32 -04:00
Dennis Lambe Jr b829be67b3 Fixed "comparison between pointer and integer" resulting from bad arg expectation assert generation. 2014-03-08 23:05:51 -05:00
Dennis Lambe Jr 93d812d528 Replaced class-level aliasing of code_verify_an_arg_expectation with instance-level dispatch. Fixed a bug in code_verify_an_arg_expectation_with_no_arrays which was being hidden from the unit tests by aliasing. 2014-03-08 22:20:28 -05:00
Dennis Lambe Jr 7239d815af Ensure tests pass after adding return_thru_ptr and ignore_arg plugins 2012-12-19 20:19:17 -05:00
Dennis Lambe Jr 932785fd71 Added the return_thru_ptr and ignore_arg plugins 2012-12-19 19:06:10 -05:00
mvandervoord e9a7151241 - Reworked memory handling to avoid realloc problems if it decides to relocate the block.
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@202 bf332499-1b4d-0410-844d-d2d48d5cc64c
2011-01-13 18:10:57 +00:00
mvandervoord 1639e2f49f - updated cmock to use unity's understanding of pointer size (why double configure?)
- small tweaks to cmock docs

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@181 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-07-29 02:39:57 +00:00
mvandervoord 35c59f1c38 - multi-dimensional arrays now get pointer comparisons (which is better than crashing, right?)
- the pointer size can now be specified (particularly for systems which need 64 bit pointers)
- removed a redundant parsing step

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@180 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-07-20 02:28:48 +00:00
mkarlesky 15efce2860 added messages to asserts to prevent test assert failures with no explanations
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@171 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-06-24 05:05:30 +00:00
mvandervoord f201cf2903 - Fixed callback-after-arg-check so that it actually checks args
- Fixed ignore-when-ignoring-args-only
- Fixed error in memory comparisons when pointers used
- Fixed system testing of CMock(!)

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@167 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-06-19 20:11:13 +00:00
mvandervoord 36de9c6fc4 - added copyright notices to code (oops)
- protected against people using extern "C"

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@161 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-04-27 02:14:44 +00:00
mvandervoord 436ffe0fee - cleaned up an error or two when using memory compares
- can use array assertions for non-arrays
- can sometimes get away with normal assertions for arrays (doesn't yet go through array, just first element)
- made parsing_challenges test better

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@159 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-03-30 03:36:08 +00:00
mvandervoord 14d639bbd8 - made index follow alignment rules too
- added support to track line numbers
- tweaked color support

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@158 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-03-24 01:06:51 +00:00
mvandervoord b2241274e4 - rolled in color coding changes from Martyn
- cleaned up utils to make faster and clearer
- corrected mistake in system test helper

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@157 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-03-13 04:53:12 +00:00
mvandervoord e79a5f13d1 - added cmock.c file for handling generic parts
- switched to better memory management technique


git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@155 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-03-08 13:32:31 +00:00
mvandervoord f6ebb9de6a * updated CMock internal variable and function names to avoid naming conflicts.
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@152 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-01-10 02:24:59 +00:00
mvandervoord eee379f611 - added array/pointer "smart" mode support
- removed differentiation between array and pointer (since it doesn't exist at this point anyway)

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@147 bf332499-1b4d-0410-844d-d2d48d5cc64c
2009-11-28 01:44:38 +00:00
mvandervoord dbb397adbe - better array and pointer support
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@146 bf332499-1b4d-0410-844d-d2d48d5cc64c
2009-11-27 03:40:48 +00:00
mvandervoord 0f857f24ec - foundation work towards more awesome pointer/array handling. not there yet, so don't try this at home kids.
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@145 bf332499-1b4d-0410-844d-d2d48d5cc64c
2009-11-26 00:55:02 +00:00