Fix : gh #259 : Add missing CUnit assert macro coverage so check_macros passes - #260
Open
Ulrond wants to merge 1 commit into
Open
Fix : gh #259 : Add missing CUnit assert macro coverage so check_macros passes#260Ulrond wants to merge 1 commit into
Ulrond wants to merge 1 commit into
Conversation
…ATAL
'make check_macros' failed on develop at 30/33: three macros declared in
include/ut_cunit.h were never exercised by the C test source, so the
target could not be used as a coverage gate.
Add the missing cases, following the conventions already in the file
(step 1 passes, step 2 asserts non-fatally, step 3 asserts fatally, with
plain and _for_arg_function variants registered in their suites):
- test_ut_assert_NOT_EQUAL / _for_arg_function, mirroring the existing
EQUAL pair, which had no negative counterpart
- a UT_ASSERT_LOG_FATAL step appended to test_ut_assert_log and
test_ut_assert_log_for_arg_function, placed after the existing
UT_LOG_INFO so that line's expectation still holds
check_macros now reports 33/33 for both the C and CPP variants.
Fixes #259
There was a problem hiding this comment.
Pull request overview
Adds missing CUnit assert-macro usage in the ut-core self-test suite so make check_macros reaches full coverage (33/33) for the C/CUnit variant, addressing #259. This keeps the macro-coverage gate meaningful without changing production code.
Changes:
- Adds
test_ut_assert_NOT_EQUALandtest_ut_assert_NOT_EQUAL_for_arg_functionto exerciseUT_ASSERT_NOT_EQUALandUT_ASSERT_NOT_EQUAL_FATAL. - Extends the existing log-assert tests to also reference
UT_ASSERT_LOG_FATAL. - Registers the new NOT_EQUAL tests in
register_assert_functions().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #259
make check_macroswas failing ondevelopat 30 / 33 because three macros declared ininclude/ut_cunit.hwere never referenced bytests/src/c_source/ut_test_assert.c:UT_ASSERT_NOT_EQUALinclude/ut_cunit.h:340NOT_EQUALtest existed —test_ut_assert_EQUALhad no negative counterpartUT_ASSERT_NOT_EQUAL_FATALinclude/ut_cunit.h:359UT_ASSERT_LOG_FATALinclude/ut_cunit.h:594test_ut_assert_logcoveredUT_ASSERT_LOGbut stopped short of the_FATALvariantOnly the C / CUnit variant was affected; CPP / GTest was already 33 / 33.
Changes
All confined to
tests/src/c_source/ut_test_assert.c, following the conventions already used throughout that file — step 1 passes, step 2 asserts non-fatally, step 3 asserts fatally, with plain and_for_arg_functionvariants registered inregister_assert_functions:test_ut_assert_NOT_EQUALandtest_ut_assert_NOT_EQUAL_for_arg_function, mirroring the existingEQUALpair.UT_ASSERT_LOG_FATALstep appended totest_ut_assert_logandtest_ut_assert_log_for_arg_function. It is placed after the existingUT_LOG_INFO("+++ This line SHOULD be seen")so that line remains reachable and its expectation still holds.No production code changed; no existing test lines were modified.
Verification
check_macrosnow passes for both variants:make build TARGET=linuxcompiles clean, no new warnings.The assert suites are deliberately excluded from the normal run —
register_assert_functions()is commented out intests/src/ut_test_main.c:38because these tests intentionally fail, keeping the standard run at 100% pass. To prove the new cases genuinely work I temporarily re-enabled registration locally (per theFIXMEnote on that line), rebuilt and ran;ut_test_main.cis unchanged in this PR. Observed:Both
_for_arg_functionvariants produced the equivalent sequence. The fatal steps correctly abort their test —### This line should never be seenappears 0 times in the run.Note:
UT_LOG_INFOoutput does not appear in automated mode at all (0 INFO lines across the whole run, including pre-existing tests), which is existing behaviour unrelated to this change.