31 Commits

Author SHA1 Message Date
Mark VanderVoord f368744ca5 Updates for the new year 2026-01-23 11:19:02 -05:00
ml-physec 2bb9086214 Unset argument detail before calling callback 2025-07-04 16:32:37 +02: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
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
Mark VanderVoord 300ebb86fd Merge branch 'master' into master 2020-03-16 13:44:41 -04:00
André Draszik ccfe2690f4 cmock_generator_plugin_callback: allow usage with Clang scan-build
Running a project through Clang's scan-build produces countless
warnings like

build/test/mocks/mock_handleTroubleEvents.c:321:5: warning: Value stored to 'call_instance' is never read
    call_instance = CMOCK_GUTS_NONE;
    ^               ~~~~~~~~~~~~~~~

scan-build correctly determines that in the following snippet

    UNITY_CLR_DETAILS();
    if (Mock.checkForActiveTroubleAfterDebounce_CallbackFunctionPointer != NULL)
      call_instance = CMOCK_GUTS_NONE;
    call_instance = Mock.startStopTimer_CallInstance;

as generated by Ceedling / CMock, the first assignment to
call_instance is completely unused.

The sheer amount of warnings makes it very hard to impossible to
spot real problems in one's code, and creates huge code analysis
reports that just distract from actual problems in one's code.

Without being too invasive, we can instruct scan-build to ignore
this dead store using
    https://clang-analyzer.llvm.org/faq.html#dead_store

Signed-off-by: André Draszik <git@andred.net>
2020-02-14 02:56:21 +00:00
John Lindgren 574d532df7 callback: mock_verify() has no effect.
callback has a later priority than expect, so setting call_instance
to CMOCK_GUTS_NONE at this point has no effect.  This mock_verify()
has probably been obsolete for a long time.
2020-01-27 15:24:06 -05:00
Dom Postorivo 0cdc742538 make ret variable more unique to prevent collision with with code under test 2019-11-04 11:23:57 -05:00
Mark VanderVoord 582e0f87cf Reworked naming of the new divided callback functionality to better reflect what is happening and avoid another use of the word Ignore. 2019-09-09 11:00:09 -04:00
John Lindgren c70cec0b19 Add CheckWithCallback and IgnoreWithCallback.
StubWithCallback can currently be configured to run the callback
function either before or after argument+ordering checks, based on
:callback_after_arg_check.  Currently, however, you can't use both
behaviors in the same test suite; you have to pick one.

This change makes both behaviors available under two new names:
 - IgnoreWithCallback, as if :callback_after_arg_check = false
 - CheckWithCallback, as if :callback_after_arg_check = true

StubWithCallback simply becomes an alias (#define) for either
IgnoreWithCallback or CheckWithCallback, depending on config.
2019-07-24 13:36:41 -04:00
John Lindgren fbb0828ee0 callback's mock_destroy() is redundant.
create_mock_destroy_function() in cmock_generator.rb already clears
the entire mock to 0 (using memset) before call the plugin's
mock_destroy() function.  So mock_destroy() in the callback plugin
is doing work that was already done.
2019-07-24 12:05:50 -04:00
John Lindgren 8b4deef12b Call UNITY_CLR_DETAILS() before returning from mock 2019-07-23 17:41:28 -04:00
John Lindgren 9e5afe4255 Refactor callback generator a bit (no functional change) 2019-07-23 17:14:33 -04:00
John Lindgren 63527a3217 mock_Verify functions should ideally not modify the state of the mock.
In typical unit tests, this doesn't matter since the Verify functions
are called only from the end of the test.  However, in longer integration
tests, where a sequence of function calls is to be tested, it's handy
to be able to verify the Expects halfway through the test.  This change
is a first step in making that possible.
2018-08-28 14:51:41 -04: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
Tim Bates 39e99e9803 Fix system test
Generator for callback plugin now checks for existence of ignore plugin
to know what code to generate
2017-02-13 17:36:20 +10:30
Tim Bates 30064aa63c Fix generator test
Also fix indentation (tabs bad)
2017-02-13 17:19:55 +10:30
Timothy Fosdike c719dff1ad Clear Ignore flag when StubWithCallback is called 2017-02-13 11:57:33 +10:30
Mark VanderVoord d6efa5b88a Fix numerous small errors concerning precedence of plugins, particularly related to callbacks, return_thru_ptr, and expect_any_args 2016-01-07 13:38:59 -05:00
Mark VanderVoord 2ac0ccb27b fixed white space 2016-01-04 20:00:32 -05:00
Mark VanderVoord f17d1a933b Stop casting unless necessary for custom types or const when returning values. 2015-08-18 07:45:45 -04:00
mvandervoord 5a09a46ebb - fixed error in callback generation with no arguments, no returns, and no count values
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@217 bf332499-1b4d-0410-844d-d2d48d5cc64c
2012-01-24 23:47:08 +00: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 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 8cb956367d - added ability to use callbacks with or without argument checking
- added ability to use callbacks with or without the extra count argument
- updated docs

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@164 bf332499-1b4d-0410-844d-d2d48d5cc64c
2010-06-08 00:46:50 +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 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 06ef8bb221 * added callback plugin
* cleaned up plugin prioritization
* updated plain docs

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@148 bf332499-1b4d-0410-844d-d2d48d5cc64c
2009-12-04 18:52:59 +00:00