You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CESTER_TEMPLATE_TEST(isSubnormalWithSubnormalInput, inst, T, (float, double, long double),
T p1 = std::numeric_limits<T>::min() / T(2.0);
cester_assert_true(isSubnormal(p1));
)
Basically - add parameters specifying the template variable and the list of types to instantiate.
It would have to generate names for each of the tests that include an indication what T was for that test.
I have not really thought through the ideal syntax, because if you have more than one template variable, my suggested syntax is not very practical, but you get the idea.....
The text was updated successfully, but these errors were encountered:
On Wed, Mar 10, 2021 at 9:42 PM MarcelInTO ***@***.***> wrote:
It would be useful to be able to define a test that uses C++ templates to
test template functions. For example, if I have a function like this:
template
inline bool isSubnormal(const T & v)
{
return std::isfinite(v) && !std::isnormal(v) && v != T(0.0);
}
Currently, my tests look like this:
CESTER_TEST(isSubnormalFloatWithSubnormalInput, inst,
float p1 = std::numeric_limits::min() / float(2.0);
cester_assert_true(isSubnormal(p1));
)
CESTER_TEST(isSubnormalDoubleWithSubnormalInput, inst,
double p1 = std::numeric_limits::min() / double(2.0);
cester_assert_true(isSubnormal(p1));
)
It would be great to do something like:
CESTER_TEMPLATE_TEST(isSubnormalWithSubnormalInput, inst, T, (float,
double, long double),
T p1 = std::numeric_limits::min() / T(2.0);
cester_assert_true(isSubnormal(p1));
)
Basically - add parameters specifying the template variable and the list
of types to instantiate.
It would have to generate names for each of the tests that include an
indication what T was for that test.
I have not really thought through the ideal syntax, because if you have
more than one template variable, my suggested syntax is not very practical,
but you get the idea.....
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#48>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRQVG7SQUSAVVGZVL6SPM3TC7DQZANCNFSM4Y623Q6A>
.
It would be useful to be able to define a test that uses C++ templates to test template functions. For example, if I have a function like this:
Currently, my tests look like this:
It would be great to do something like:
Basically - add parameters specifying the template variable and the list of types to instantiate.
It would have to generate names for each of the tests that include an indication what T was for that test.
I have not really thought through the ideal syntax, because if you have more than one template variable, my suggested syntax is not very practical, but you get the idea.....
The text was updated successfully, but these errors were encountered: