Implement `constexpr` generators or add the possibility for combining signature-based parametrised tests
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
Research direction
Start by reading docs/generators.md and docs/test-cases-and-sections.md, especially the generator, type-parametrised, and signature-based test sections. Review the related issue 1702 for the previously proposed solution. Done means Catch2 supports combining compile-time non-type template parameters as requested, with the supported approach documented and covered by relevant tests.
Written by the indexing model from the issue text.
Description
Description
There are various reasons why a class or function may have multiple non-type template parameters, including (but not limited to) compile-time feature toggling, guaranteed compile-time branch elimination, and multidimensional spans and containers with compile-time extents.
There are already two features that are close to the request, but none seem to satisfy it exactly:
- Generators allow going through a Cartesian product of inputs.
- Type parametrised test cases have
TEMPLATE_PRODUCT_TEST_CASEfor combining types, and signature-based parametrised tests allow traversing compile-time constants. TEMPLATE_LIST_TEST_CASEallows using anstd::tupleto represent types. Using anstd::tupleofconstexprvalues forTEMPLATE_TEST_CASE_SIGwould allow for at least manual compile-time generation of all required combinations.
Evident limitations of these approaches in the context of the request:
- Generators do not support
constexprvalues, so they cannot be used for non-type template parameters. - A signature-based parameterised test argument list grows exponentially with any additional argument that needs to be combined with the others.
- The template list test case does not support values directly. However, there is std::integral_constant, which is sufficient for a lot of applications, but not all, because non-type template parameters are not limited to integral constants.
Additional context
Another user already made a similar request and was satisfied with the proposed solution, but I cannot reopen it and am unsure whether a comment in the closed issue would be lost.
- Dominant language
- C++
- Stars
- 21.6k
- Forks
- 3.4k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from catchorg/Catch2
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 2 days
-
catch_discover_tests passes all EXTRA_ARGS as one argumentPossibly taken @CyberKun claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
catchorg/Catch2#3239 · 1 comment ·
Maintainers usually reply within 2 days
-
Not seeing some error messages from fakeit in jetbrains riderPossibly taken @Amanpal9 claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
catchorg/Catch2#3228 · 1 comment ·
Maintainers usually reply within 2 days
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0Possibly taken @nafiurahman00 claimed this 8 days ago. OpenExtras
Difficulty 3/5 1-2 days Newbie friendliness 72/100
catchorg/Catch2#3241 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cp-algorithms/cp-algorithms#1774 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
telefonicaid/fiware-orion#4836 ·
Maintainers usually reply within 1 day
-
nixd exits at startup when its parent process belongs to another userPossibly taken @conao3 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nix-community/nixd#930 ·
Maintainers usually reply within 2 days
-
refactor topic-ui topic-weather
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Command-Install Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
microsoft/winget-cli#6718 ·
Maintainers usually reply within 2 days