Skip to content

Add parameterized tests - #109

Open
thetic wants to merge 5 commits into
mainfrom
parameterized-tests
Open

thetic wants to merge 5 commits into
mainfrom
parameterized-tests

Conversation

@thetic

@thetic thetic commented Sep 10, 2026 •

Copy link
Copy Markdown
Owner

Description

Adds PARAMETERIZED_TEST/PARAMETERIZED_TEST_CASE (mu/tiny/test.hpp): write a test body once and run it against several cases, each still expanding to an ordinary TEST() - independently named, filterable, and reported on failure. Includes C interface parity (PARAMETERIZED_TEST in test.h, PARAMETERIZED_TEST_CASE_C_WRAPPER in test.hpp) following the existing TEST_C_WRAPPER/TEST_ORDERED_C_WRAPPER bridging pattern.

This adapts cpputest/cpputest#666, a CppUTest PR for parametrized mix-in tests. That design added a second global test registry and re-injected a self-looping shell into the registry at run time to iterate cases - fragile and never reached a mergeable state. This implementation instead expands entirely to plain TEST() calls at compile time: no new registry, no runtime test-list mutation, no new Shell subclasses.

Related Issues

N/A - not tied to an existing issue in this repo.

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)

  • Target:
  • Result:

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.

@coveralls

coveralls commented Sep 10, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 98.947%. remained the same — parameterized-tests into main

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor
TestsPassed ✅Skipped ⚠️Failed
JUnit Tests1094 ran1085 passed9 skipped0 failed

Writing the same set of checks against several similar test subjects
(e.g. verifying multiple implementations of an interface) currently means
copy-pasting the test bodies per subject. These two macros let the body be
written once and instantiated per case, with each case still expanding to
an ordinary TEST() - independently named, filterable, and reported on
failure - so nothing new is needed in the registry or runner.
Shows both a plain data-driven table and the interface-conformance use
case (one suite of checks applied to several implementations), including
the local-macro pattern for reusing a case list across multiple checks.
Adds PARAMETERIZED_TEST (mu/tiny/test.h) for defining the shared body in a
C file, and PARAMETERIZED_TEST_CASE_C_WRAPPER (mu/tiny/test.hpp) for
registering each case from the C++ bridge file - the same two-file pattern
used by TEST_C_WRAPPER and TEST_ORDERED_C_WRAPPER, giving parameterized
tests parity with the rest of the test-definition macros for C code.
@thetic
thetic force-pushed the parameterized-tests branch from 061ca9f to 62a6bb8 Compare September 10, 2026 06:35

This branch has not been deployed

No deployments
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