Skip to content

Add type-generic CHECK_EQUAL for C via C11 _Generic - #100

Merged
thetic merged 2 commits into
mainfrom
generic-check-equal
Aug 7, 2026
Merged

Add type-generic CHECK_EQUAL for C via C11 _Generic#100
thetic merged 2 commits into
mainfrom
generic-check-equal

Conversation

@thetic

@thetic thetic commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Description

Adds a type-generic CHECK_EQUAL/CHECK_EQUAL_TEXT to test.h, dispatching on the type of actual via C11 _Generic (bool/int/uint/long/ulong/longlong/ulonglong/char/ubyte/sbyte/string/pointer). The existing typed CHECK_EQUAL_* macros remain — they still back the dispatch, and double/memcmp keep their dedicated macros since those take extra arguments _Generic can't accommodate.

To support this, the top-level project() now declares C alongside CXX, and c_std_11 is set as a PUBLIC compile feature on the mutiny target so the C11 minimum propagates to any consumer (tests, examples) linking against mu::tiny, without touching each consumer's CMakeLists.txt individually.

Note for reviewers: enabling C as a project language means a C compiler is now required at configure time even for consumers that only use the C++ API. Worth considering whether this warrants a version bump per the semver policy in CONTRIBUTING.md.

Related Issues

N/A

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Manual Verification (Optional)

Checklist

  • I have written/updated documentation in docs/ for any user-facing changes.
  • My code follows the project's naming conventions (mu::tiny namespace, INCLUDED_MU_TINY_ guards, mutiny_ C-prefix).
  • For new features, I have considered if a C-interface adapter (.h and .c.cpp) is required for parity.
  • I have reviewed the CONTRIBUTING.md file to ensure compliance with architectural guidelines.

thetic added 2 commits August 6, 2026 21:00
Enable C as a project language and require c_std_11 as a public
compile feature on the mutiny target, propagating the minimum to
any consumer (mutiny_test, examples) that links against it. This
lets test.h dispatch CHECK_EQUAL/CHECK_EQUAL_TEXT on the type of
`actual`, as an additive alternative to the typed CHECK_EQUAL_*
macros (which remain for double/memcmp and explicit use).
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 98.928%. remained the same — generic-check-equal into main

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
TestsPassed ✅Skipped ⚠️Failed
JUnit Tests1081 ran1072 passed9 skipped0 failed

@thetic
thetic merged commit cbb837b into main Aug 7, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants