diff options
| author | Clement Courbet | 2025-07-08 14:26:25 +0200 |
|---|---|---|
| committer | GitHub | 2025-07-08 14:26:25 +0200 |
| commit | 2de12cb05f1e54fc2a8f7a894f2a435297295efa (patch) | |
| tree | a0e1a444b8bfa2681466c194a2426fe058550c58 /tests/SelfTest/UsageTests/Misc.tests.cpp | |
| parent | 8dc9f1a1247a15836044501c9a791ea67a709f05 (diff) | |
| download | catch3-2de12cb05f1e54fc2a8f7a894f2a435297295efa.tar.gz | |
Allow using only types in `TEMPLATE_TEST_CASE_SIG`. (#2995)
Right now `TEMPLATE_TEST_CASE_SIG` fails to compile when the signature contains only types:
```
TEMPLATE_TEST_CASE_SIG(
"TemplateTestSig: compiles with two type parameters",
"[template][onlytypes]",
((typename U, typename V), U, V), (int,int)) {}
```
The trick is to resolve the ambiguity between the two overloads of
`get_wrapper` (`TypeList` and `Nttp`) by making one match more strongly.
We also need to allow `reg_test` to register more than one type.
Add unit tests.
Fixes #2680
---------
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
Diffstat (limited to 'tests/SelfTest/UsageTests/Misc.tests.cpp')
| -rw-r--r-- | tests/SelfTest/UsageTests/Misc.tests.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp index 3697f069..464a4b1d 100644 --- a/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -334,6 +334,10 @@ TEMPLATE_TEST_CASE( "TemplateTest: vectors can be sized and resized", "[vector][ } } +TEMPLATE_TEST_CASE_SIG("TemplateTestSig: compiles with a single int parameter", "[template][singleint]", ((int V), V), 1, 3, 6) {} + +TEMPLATE_TEST_CASE_SIG("TemplateTestSig: compiles with two type parameters", "[template][onlytypes]", ((typename U, typename V), U, V), (int,int)) {} + TEMPLATE_TEST_CASE_SIG("TemplateTestSig: vectors can be sized and resized", "[vector][template][nttp]", ((typename TestType, int V), TestType, V), (int,5), (float,4), (std::string,15), ((std::tuple<int, float>), 6)) { std::vector<TestType> v(V); |