r/cpp • u/onqtam github.com/onqtam/doctest • Sep 21 '16
doctest - the lightest feature rich C++ single header testing framework - version 1.1 released!
On 2016.05.22 I released version 1.0 of doctest. 1.1 brings the following major changes:
-
HUGE improvements in compile time of asserts - 70-95% faster than the original one!
-
wrote a FAQ - and the much requested differences with Catch section
-
MANY minor fixes - it didn't compile when using
nullptrin asserts, etc. - see the changelog -
improved documentation
-
solved a very common problem of testing frameworks with self-registering tests inside static libraries - non-intrusive in pure CMake without any source code modification - see here
-
added code coverage of the library
You can see the full generated changelog here
The framework is in a very stable condition but there are still a lot of features in the roadmap.
I truly believe this framework can become the preferred choice for testing in C++ - the foundations are solid and pure and I believe there is nothing else quite like it - see the main readme.
The project is in need of sponsors and publicity!
I don't want this post to be a cry for money, but I would greatly appreciate any financial support by individuals or companies using (or wanting to use/support) the framework.
I created a patreon page for that purpose in addition to the pledgie campaign.
You can checkout the hackernews thread for this here.
Any feedback is welcome!
EDIT:
Baptiste Wicht tested the compile time of the 1.1 release with his Expression Templates Library (ETL) in this blog post!
While reading the post - keep in mind that if a part of a program takes 50% of the execution time and is made 10000 times faster - the overall program would still be only roughly 50% faster.
2
u/HPCEngineer Sep 21 '16
I'm curious as to why you chose to create doctest as opposed to improving Catch?
1
u/onqtam github.com/onqtam/doctest Sep 22 '16
check out this blog post (or look at my edit of this reddit post)
5
u/TotesMessenger Sep 21 '16
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)
1
u/FonderPrism Sep 22 '16 edited Sep 22 '16
I'm currently trying to implement doctest in my C++ project, but I'm having some trouble. This might not be the correct forum (is there an official help forum?), but anyway.
Is there any way to write tests inside a class declaration or definition? This doesn't work
I just get a lot of errors, the first of which is
It works if I move TEST_CASE() outside the class definition, but I'd rather have it as close as possible to the function I'm testing.
1
u/enobayram Sep 24 '16
Could you explain the gist of how the
CHECKmacro captures the results of both sİdes of the comparison?3
u/[deleted] Sep 22 '16
I used this for a personal project I started recently due to its simplicity compared to the alternatives. It's the closest thing in C++ I've found that mirrors D's unittest feature which I got used to. Thanks.
-1
u/egorpugin sw Sep 21 '16
Available at C++ Archive Network. Versions page, 1.1.0 page. Feel free to register there to add your library under your (not demo) namespace. For example, pvt.onqtam.doctest.
-10
u/tdz9 Sep 21 '16
Just a tip: "single header" is not a feature, it usually implies in slower compilation times (because it gets compiled repeatedly)