-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature Request: Functional Parameters #45
Comments
I'm not sure about this. I intended for this to be handled with a simple On the other hand, there's a certain symmetry to providing a special creator for value-parameterized suites. Though on the third(?) hand, "symmetry" is a pretty weak argument. |
The way that this works basically is exactly that; just a This is sort of similar to the discussion we had a couple of years ago about supporting properties based testing. It has the similar feel of generating a batch of tests from a programmable rule. It has been a while since I looked at that, but I seem to remember that we settled on a similar pattern of using a free function to populate the suite in a specialized way. You can close this issue, or use it as an example, or whatever you want to do with it. If others find it useful, then it is still going to be here in issues as a reference. |
I thought about this a bit more, and I think there's some value in doing this, since it's a bit more difficult to parameterize root-level suites with multiple values (obviously, you can't have a |
My favorite Mettle feature is the template parameters to instantiate tests on different types. However, I have also been experimenting with function parameters to solve a different kind of testing problem. Specifically, I need to sample my tests with different numerical parameters. They are always the same type, and there might be a great many of them. While these parameters can be coaxed into compile time arguments, the Mettle compile times then become prohibitive. Some test patterns are just more naturally expressed via sets of function parameters. This is particularly true in the scientific programming I normally do.
Here I demonstrate a prototype
mettle::enumerate<>(...)
that is supposed to emulatemettle::subsuite<>(...)
as closely as possible, except for these differences:name
argument for the tests use alibfmt
pattern instead of a plain string, and_.test()
invocations.I am completely unmarried to my names here, and I am certain extra wizardry would be required to fully support important Mettle features like fixtures and marks. I am posting this as a feature request, not a fully formed pull request, because I am sure some design discussion up front would be helpful.
From my code sample below, this is the output that I get. I am not actually making any test assertions (those work fine); I am more interested here is seeing which tests are collected and how the names are formatted.
Here is my investigation:
The text was updated successfully, but these errors were encountered: