-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TEMPLATE_TEST_CASE_n macros #382
Conversation
I expect that PRs should be done using branch develop. |
Thanks @martinmoene, I wondered about that, it wasn't completely clear from the GitHub article about using pull requests. I guess I should probably have created a topic branch in my fork too. Anyway, before proceeding further I'd like to know whether a PR for this feature is likely ultimately to be accepted. Best regards, |
@garethsb, Agree to await Phil's reaction first ;) |
Hi @garethsb, Sorry for the radio silence. I've been away from this project for a while as I've got a couple of major things on (again!). |
Thanks, @philsquared, I understand. I'm a git/github newbie, but if I understand correctly, github doesn't allow me to fix this PR to change the base branch to develop rather than master or change the head from my fork's master branch to a topic branch... I'd have to create a new PR... so I'll just leave it alone, until whenever you have a chance to review. Thanks again. |
Hi all, I've tested @garethsb 's PR in my project and it works perfectly. I'd love to see this feature included in the Catch master... |
Here is another alternative for the templated "fixture".
Usage:
|
Thanks, @dcoeurjo, good to hear it works for you. I also like @zpgaal 's approach, basically as I described in last point of my original PR comment. Some thoughts: |
Unfortunatelly my soultion has some other drawback (and all derivation based alternatives). Using gcc and other similar compilers, typedef defined within the fixture cannot be access directly from the test function. template template |
How about using this trick to get rid of the trailing _n in TEMPLATE_TEST_CASE? |
@garethsb Hi, I'm reading at the code and I don't understand how it is supposed to work. You define this macro and the corresponding "DEFN" one:
At the end, |
@nicola-gigante The technique relies on the fact that those two The code of this PR, plus some other small Catch extensions, is in a self-contained Catch/Google Test/Boost Test single-header shim being used e.g. here: https://github.com/sony/nmos-cpp/blob/master/Development/bst/test/test.h Best regards, |
@garethsb-sony As far as I know, we don't and it wouldn't work as the use of I have no idea what the state of that was back in 2015 though |
@horenmar As you say, the code has moved on. The state of the repo in 2015 shows |
I updated the [CATCH_]TEMPLATE_TEST_CASE_n macros work with Catch 1.10.0. I've pushed this to the repo at https://github.com/sony/nmos-cpp/blob/7c1ed9dc/Development/bst/test/detail/catch-1.10.0.h#L74. |
I think this can be closed since we have |
Agreed |
Add
TEMPLATE_TEST_CASE_n
macros to meet the requirements of type-parameterised tests via test case templates. This PR is based on a sketch described in #46 and discussed in #357. The sketch implementation was also adapted and tested by @wichtounet.This is my first use of GitHub so please forgive and let me know any mistakes I've made in the PR procedure!
Issues with the PR as it stands:
CATCH_CONFIG_VARIADIC_MACROS
in implementation ofTEMPLATE_TEST_CASE_n
because the parametersname, description
precede the type list. Not sure if this matters or not.BOOST_PP_REPEAT
were used).