-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
work like doctest for c++? #66
Comments
just checked utest.h and it does not have such a flag, but it would be nice to have if possible. The use scenario is like: when I cmake Debug build it will use UTEST_MAIN() and run all the test cases, if I cmake the Release build it will turn off all the testcases(e.g. -DDISABLE_UTEST_H) and use a separate main.c/main.cpp for release build. |
That should be doable in theory - I don't have any bandwidth to commit to doing it in the near term though. |
I've been thinking about this and have solved it partially for my workflow. It may not be obvious, but literate programming can allow one to place code right next to the test code while tangling them to separate auto-generated files. Here is an example literate program to demonstrate: https://ferret-lang.org/#outline-container-sec-3 Source: https://github.com/nakkaya/ferret/blob/master/ferret.org Tests can be shipped with source code/packaging, so not sure what the advantage is in putting the test code into the binary? |
doctest has one definition flag(DOCTEST_CONFIG_DISABLE) that can toggle testcase code(e.g. like NDEBUG) and can let me mix test code with production code easily, can utest.h do that? that is, all unit tests code are right in the production code(instead of in separate test source files), and I can turn them off for a release build.
that make all test code just like the NDEBUG controlled assert, I can turn on and off easily, and can put testcases with the real production code together, in the same file.
however doctest does not work for c, utest.h can, so I wonder if utest.h can do the same.
The text was updated successfully, but these errors were encountered: