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
I've just starting using Catch2, and find it very expressive.
There are some tests that can be done at compile time; for example I am writing an adapter library and need to test if two types are implicitly convertible.
I could use REQUIRE(std::is_convertible_v<A, B>); which fits in nicely with this test framework.
However the argument is known at compile time. I've found myself doing something like:
static_assert(std::is_convertible_v<A, B>, "A should be convertible to B");
SUCCEED("A and B are convertible");
Such that the static test is logged and documented, but done at compile time.
Could there be a macro be included to wrap around that?
That way it's automatically statically tested, and logged. It would be nice for the expression to be in the output itself; which I guess can be emulated with:
which would actually test twice, once at compile time and once at run time; though it should be inexpensive as its likely to have been calculated at compile-time.
The text was updated successfully, but these errors were encountered:
Perhaps you want to be able to also let STATIC_REQUIRE behave as the normal REQUIRE so that compilation may continue where it otherwise would be stopped by a static assertion failure.
I've just starting using Catch2, and find it very expressive.
There are some tests that can be done at compile time; for example I am writing an adapter library and need to test if two types are implicitly convertible.
I could use
REQUIRE(std::is_convertible_v<A, B>);
which fits in nicely with this test framework.However the argument is known at compile time. I've found myself doing something like:
Such that the static test is logged and documented, but done at compile time.
Could there be a macro be included to wrap around that?
That way it's automatically statically tested, and logged. It would be nice for the expression to be in the output itself; which I guess can be emulated with:
which would actually test twice, once at compile time and once at run time; though it should be inexpensive as its likely to have been calculated at compile-time.
The text was updated successfully, but these errors were encountered: