The fastest feature-rich C++11/14/17/20 single-header testing framework

Overview

master branch Windows All
dev branch Windows All

doctest is a new C++ testing framework but is by far the fastest both in compile times (by orders of magnitude) and runtime compared to other feature-rich alternatives. It brings the ability of compiled languages such as D / Rust / Nim to have tests written directly in the production code thanks to a fast, transparent and flexible test runner with a clean interface.

Standard License Version download CII Best Practices Language grade: C/C++ Join the chat at https://gitter.im/onqtam/doctest Try it online

The framework is and will stay free but needs your support to sustain its development. There are lots of new features and maintenance to do. If you work for a company using doctest or have the means to do so, please consider financial support. Monthly donations via Patreon and one-offs via PayPal.

A complete example with a self-registering test that compiles to an executable looks like this:

cover-example

There are many C++ testing frameworks - Catch, Boost.Test, UnitTest++, cpputest, googletest and many other.

The key differences between it and other testing frameworks are that it is light and unintrusive:

  • Ultra light on compile times both in terms of including the header and writing thousands of asserts
  • Doesn't produce any warnings even on the most aggressive warning levels for MSVC/GCC/Clang
  • Offers a way to remove everything testing-related from the binary with the DOCTEST_CONFIG_DISABLE identifier
  • thread-safe - asserts (and logging) can be used from multiple threads spawned from a single test case - example
  • asserts can be used outside of a testing context - as a general purpose assert library - example
  • Doesn't pollute the global namespace (everything is in namespace doctest) and doesn't drag any headers with it
  • Very portable C++11 (use tag 1.2.9 for C++98) with over 180 different CI builds (static analysis, sanitizers...)
  • binaries (exe/dll) can use the test runner of another binary - so tests end up in a single registry - example

cost-of-including-the-framework-header

This allows the framework to be used in more ways than any other - tests can be written directly in the production code!

Tests can be considered a form of documentation and should be able to reside near the production code which they test.

  • This makes the barrier for writing tests much lower - you don't have to: 1) make a separate source file 2) include a bunch of stuff in it 3) add it to the build system and 4) add it to source control - You can just write the tests for a class or a piece of functionality at the bottom of its source file - or even header file!
  • Tests in the production code can be thought of as documentation or up-to-date comments - showing the use of APIs
  • Testing internals that are not exposed through the public API and headers is no longer a mind-bending exercise
  • Test-driven development in C++ has never been easier!

The framework can be used like any other if you don't want/need to mix production code and tests - check out the features.

doctest is modeled after Catch and some parts of the code have been taken directly - check out the differences.

This table compares doctest / Catch / lest which are all very similar.

Checkout the CppCon 2017 talk on YouTube to get a better understanding of how the framework works and read about how to use it in the JetBrains article - highlighting the unique aspects of the framework! On a short description on how to use the framework along production code you could refer to this GitHub issue. There is also an older article in the february edition of ACCU Overload 2017.

CppCon 2017 talk about doctest on youtube

Documentation

Project:

Usage:

Contributing

Support the development of the project with donations! There is a list of planned features which are all important and big - see the roadmap. I took a break from working in the industry to make open source software so every cent is a big deal.

If you work for a company using doctest or have the means to do so, please consider financial support.

Contributions in the form of issues and pull requests are welcome as well - check out the Contributing page.

Stargazers over time

Stargazers over time

Logo

The logo is licensed under a Creative Commons Attribution 4.0 International License. Copyright © 2019 area55git   License: CC BY 4.0

Issues
  • Add Github Actions CI

    Add Github Actions CI

    Opening the pull request so I can start testing the configuration. I've started by taking reproc's Github Actions configuration and removing everything reproc related. Once that works I'll start adding all doctest related configuration.

    opened by DaanDeMeyer 38
  • Tests inside a static library

    Tests inside a static library

    Hi,

    (This is more a question than an issue) What is the recommended way to add tests inside a static library project ?

    If I compile a library (which includes TEST_CASE(s)) as a static library, and then I try to run the tests from this library by creating a target that links to it, the test suite is actually empty (i.e I guess the tests were stripped at link time)

    Am I doing something wrong, or is there a way to circumvent this?

    Below is an example of what I am trying to achieve (using cmake):

    Project         <- main project
      CMakeLists.txt
      doctest/
        doctest.h
        doctest_main.cpp
      MyLibrary/
        lib1.cpp    <- these files includes actual library code and TEST_CASE(s)
        lib2.cpp    
        lib3.cpp    
        CMakeLists.txt <- will produce two targets : library and its test
      MyMainProgram/
        main.cpp
        CMakeLists.txt
    
    

    MyLibrary/CMakeLists.txt :

        set(sources lib1.cpp lib2.cpp lib3.cpp)
        add_library(MyLibrary STATIC ${sources})
        target_include_directories(MyLibrary PUBLIC ${CMAKE_SOURCE_DIR}/doctest )
    
        # This does not work : it links but the test list is empty !
        add_executable(MyLibrary_DocTest ${CMAKE_SOURCE_DIR}/doctest/doctest_main.cpp)
        target_link_libraries(MyLibrary_DocTest MyLibrary)
    
        # This works, but it requires to re-compile all the source files and to re-define
        # exactly the same compile options as for the library (linked library, compile definition, etc); 
        # this can be tedious
        add_executable(MyLibrary_DocTest ${sources} ${CMAKE_SOURCE_DIR}/doctest/doctest_main.cpp)
    
    

    MyMainProgram/CMakeLists.txt :

        add_executable(MyMainProgram main.cpp)
        target_link_libraries(MyMainProgram MyLibrary)
    

    A working example can be found at https://github.com/pthom/DocTest_LibTest

    opened by pthom 27
  • Count points based on the number of passed/failed cases?

    Count points based on the number of passed/failed cases?

    Hi guys, I am now trying to use doctest to grade c++ code assignments, and this is my first time to use doctest. Just one question, is there any way that I can count the points based on how many testcases are passed? Or is there any way that I can perform like IF test case passed, THEN grade ++, something like that?

    Thanks a lot!

    opened by xrb936 24
  • Logo Proposal for Doctest

    Logo Proposal for Doctest

    Hi, In response to your request for Logo, I am very grateful to be able to collaborate in your project.

    I need a short review about Doctest to start with the sketches. I can improve the existing one or create something totally new and different. You can tell me your suggestions.

    opened by area55git 20
  • Add default printers for enums

    Add default printers for enums

    I've added an assertion for a function returning an enum and the enum value. When the test failed I've got pretty informative failure output {?} == {?}...

    I don't intend to write a custom printer for my enum type, but still want to see readable values when a test fails. I've workaround the problem by casting to int, but I'd prefer if the library does this for me.

    opened by obfuscated 19
  • Slower than Catch in realistic test cases

    Slower than Catch in realistic test cases

    Hi,

    I did some benchmarking of doctest on my machine (Linux, gcc-4.9.3). I adapted a bit your Python script to work on Linux (with_gcc = 1 and removed the forced CMake generator).

    First, I can confirm that in the simple benchmark case, it is indeed faster to compile than Catch by a large margin. However, this is not a very realistic test case.

    I have modified the benchmark to generate 50 files, each with 25 test cases and each with 10 CHECK (using a variable and not two constants). Here are the results:

    Catch: 1 minute 56 seconds Doctest: 2 minutes 32 seconds

    In a realistic test case, doctest is significantly slower than Catch. I can see the same thing when I replace Catch by doctest in one of my large test case of my ETL library.

    Do you have any idea why this happen ?

    I can only guess that the overhead comes from the templates used to extract lhs and rhs or by the macros generating the test cases.

    opened by wichtounet 19
  • doctest in embedded

    doctest in embedded

    Dear

    We are testing doctest in embedded environment, some small success so far, However, it is quite big footprint for small devices, we use dual targeting first PC host when footprint do not matter at all and verbose information is useful, than test on target where footprint matter but verbose information do not. So on embedded target what I am interesting in is only PASS or FAIL for all test. Is there option to disable serializing or formatting output option (xml) what probably increase footprint ?

    /Greg

    opened by GregKon 15
  • combine the same tests for different build configurations from multiple shared objects without having symbol clashes

    combine the same tests for different build configurations from multiple shared objects without having symbol clashes

    I have a header library that is configurable via macro definitions, much like doctest is. So my library behaves differently, depending on some #define XXX statements placed before including a header from my library and of course I want to test all possible configurations (there aren't so many, so this is feasible). My current solution is to have one test runner executable per configuration.

    Is there any way to aggregate the tests for the different configurations into one binary?

    I don't think that this doctest example is a viable solution for me, because it will lead to multiple definitions by linking the main runner to different versions of my library.

    Minimal example

    In the following example, I have

    • a function bar that behaves differently, depending on the existence of the macro definition RETURN_42
    • and some unit tests:
    CLICK ME
    #pragma once
    #include "doctest/doctest.h"
    #include <type_traits>
    
    #ifdef RETURN_42
    #define TEST_LABEL "[return42] "
    #else
    #define TEST_LABEL "[default] "
    #endif
    
    double bar() {
    #ifdef RETURN_42
        return 42;
    #else
        return 11;
    #endif
    }
    
    #if defined(DOCTEST_LIBRARY_INCLUDED) && defined(RETURN_42)
    TEST_CASE(TEST_LABEL "bartest"){
        INFO("Running " TEST_LABEL "bartest"); MESSAGE("");
        CHECK_EQ(42, bar());
    }
    #endif
    
    #if defined(DOCTEST_LIBRARY_INCLUDED) && !defined(RETURN_42)
    TEST_CASE(TEST_LABEL "bartest"){
        INFO("Running " TEST_LABEL "bartest"); MESSAGE("");
        CHECK_EQ(11, bar());
    }
    #endif
    
    #ifdef DOCTEST_LIBRARY_INCLUDED
    TEST_CASE(TEST_LABEL "commontest"){
        INFO("Running " TEST_LABEL "commontest");MESSAGE("");
        auto x = bar();
        CHECK(std::is_same<decltype(x), double>::value);
    }
    #endif
    

    There are two possible configurations and three unit tests, of which two are configuration specific and one should run for all configurations. With two test runners, one per configuration, I would have two unit tests each. I would like to have a runner that aggregates all four test cases.

    opened by joergbrech 15
  • Junit reporter

    Junit reporter

    I would just like to add some weight to the requirement for a Junit reporter; I know it's scheduled for the 2.4 release, but currently it is what is stopping me from moving to doctest from Catch2. Otherwise I'm very impressed with doctest.

    Junit is a very useful format for interacting with CI systems like Team City, Jenkins, and in my case GitLab.

    As such, the output format does NOT need to support all of the Junit schema, in fact it is better to provide the absolute minimum that will be parsed by these systems. By the way, the one that seems to cause the most issues is the 'classname' attribute which needs to be present, even though its not much use if the source language is not Java.

    The tricky issues would seem to be:

    1. Dealing with SUBCASES
    2. Junit seems to imply that the test statistics must be emitted as attributes in the opening tag of a testcase; which causes a problem with a lightweight framework, as we dont want to have to store intemediate results.

    My thoughts on these points:

    1. Is something specific to Doctest, so I think you are the best person to have an opinion.
    2. This can be sidestepped by NOT emitting the statistics attributes. Most CI frameworks are just interested in detecting a failure tag.

    In any event, if we need to emit attribute tags, it is fairly straightforward to build a post-processor program that can be run over the file. I built a simple one using a python package I found somewhere (can't remember the name now).

    It looks as though it should be possible to provide a Junit reporter by modifying the example XML reporter; in fact by dropping about 90% of the code! I did a quick trial to confirm this, but it's not suitable for a PR as my understanding of the API and subcases is poor.

    opened by byzantic 15
  • Fix UB of defining stuff in namespace std. Just include the headers.

    Fix UB of defining stuff in namespace std. Just include the headers.

    Having this UB may randomly break just by some compiler update. Fixes #194

    opened by dimztimz 14
  • Workaround access violation

    Workaround access violation

    Description

    Due to race between exiting the process and starting of a new detached thread in Windows, thread local variables, which constructors or destructors have calls to runtime functions (e.g.free() function) can cause access violation since TBB along with runtime library may have been unloaded by the time these variables are constructed or destroyed. The workaround is do not call constructors and/or destructors for such variables if they are not used.

    opened by isaevil 0
  • Fix redefinition error while using double time DOCTEST_ANONYMOUS(DOCTEST_CAPTURE_)

    Fix redefinition error while using double time DOCTEST_ANONYMOUS(DOCTEST_CAPTURE_)

    Description

    Double DOCTEST_ANONYMOUS(DOCTEST_CAPTURE_) leads to redefinition error on MSVS like this: error C2082: redefinition of formal parameter 'DOCTEST_CAPTURE_54'

    opened by isaevil 0
  • Fix error: missing initializer for member doctest::detail::TestSuite

    Fix error: missing initializer for member doctest::detail::TestSuite

    Description

    Fixing error: missing initializer for member doctest::detail::TestSuite:

    opened by isaevil 0
  • Add Intel Compiler support

    Add Intel Compiler support

    Description

    Support for compilation with Intel Compiler

    opened by isaevil 0
  • [PROJECT ANNOUNCEMENT] Looking for maintainers for Doctest

    [PROJECT ANNOUNCEMENT] Looking for maintainers for Doctest

    Working on doctest has taught me two very important lessons: how to prioritize and how to say no, and now it's time to apply them to my life. I can no longer maintain doctest properly and that's evident by my inactivity for the past 8 months - I haven't touched C++ professionally in almost 2 years and I've moved on to other things.

    I invite anyone interested in the development & maintenance of the framework to join the Discord server. I just moved doctest to a GitHub organization as suggested here and will add whoever is interested as a member. I'll release a version or two and will stick around for some time as people join in order to resolve any disputes and respond to questions and at some point, I'll promote the ones that have shown the most interest to admins & owners of the repository and the Discord server - I won't leave but I hope that by that time others would be able to reach consensus on contentious issues and I'll redirect any donations to the maintainers once this transition period is over.

    Doctest doesn't require too much work (unless new features are added) - mostly the occasional compiler bugfix & support in issues. The design goals of the framework should be followed - what made doctest successful is the art of saying no and keeping it light & easy to use.

    Best regards, Viktor

    opened by onqtam 1
  • Support for older compilers (g++-4.7, MSVC 2013/2015)

    Support for older compilers (g++-4.7, MSVC 2013/2015)

    We use doctest for our unit tests in cereal and had to update to a recent doctest to fix some issues with newer compilers. This unfortunately broke some of our builds against some older compilers which don't quite have full C++11 support, or do so in compiler-specific ways.

    Description

    This PR replaces or updates the platform-specific macros for [[noreturn]], thread_local, noexcept, constexpr, etc. to "do the right thing" based on the compiler version, supporting the older compilers mentioned. This passes all unit tests here and also in our codebase.

    opened by AzothAmmo 0
  • ASAN/UBSAN GCC11 test failures (`executable_dll_and_plugin*`)

    ASAN/UBSAN GCC11 test failures (`executable_dll_and_plugin*`)

    On the latest dev (30c3efdc9477080dc86fdaf717c05622ff6ca332), some tests (executable_dll_and_plugin*) fail when built with ASAN+UBSAN on GCC11 (NixOS). The exact-same configuration works fine when building without -fsanitize=address,undefined. Interestingly, stuff works with ASAN/UBSAN and clang 12 (Fedora 34).

    Here's the CMake log from the failing case:

    + cmake -DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=0 -DCMAKE_INSTALL_RPATH:INTERNAL=/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/target/lib64 -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:INTERNAL=ON -DCMAKE_PREFIX_PATH=/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/target -DCMAKE_INSTALL_PREFIX=/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/target /home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest
    -- The CXX compiler identification is GNU 11.1.0
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /nix/store/78srd9zc4rhm9j7593brrwsvx8m9crpm-gcc-wrapper-11.1.0/bin/g++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Looking for C++ include pthread.h
    -- Looking for C++ include pthread.h - found
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - found
    -- Found Threads: TRUE  
    -- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS) 
    -- Could NOT find MPI (missing: MPI_CXX_FOUND CXX) 
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest
    

    And the relevant test output:

    + ctest -j16 --output-on-failure
    ...
    133/135 Test #128: executable_dll_and_plugin_xml ..............***Failed    0.06 sec
    -- Found Git: /nix/store/32r66ar7hxcc4a6hh26yx49w79bjhnw7-git-2.33.0/bin/git (found version "2.33.0") 
    diff --git a/home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_xml.txt b/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/CMakeFiles/temp_test_output_executable_dll_and_plugin_xml.txt
    index b8d3b4f..2b5a182 100644
    --- a/home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_xml.txt
    +++ b/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/CMakeFiles/temp_test_output_executable_dll_and_plugin_xml.txt
    @@ -17,45 +17,11 @@ I am a test from the implementation_2!
         <TestCase name="executable" filename="main.cpp" line="0">
     I am a test from the executable!
           <Exception crash="false">
    -        char: 97
    +        unknown exception
           </Exception>
           <OverallResultsAsserts successes="0" failures="0"/>
         </TestCase>
       </TestSuite>
    -  <TestSuite name="some test suite">
    -    <TestCase name="test case in a plugin" filename="plugin.cpp" line="0">
    -      <SubCase name="some subcase" filename="plugin.cpp" line="0">
    -        <Message type="WARNING" filename="plugin.cpp" line="0">
    -          <Text>
    -            triggering the INFO above to be printed
    -          </Text>
    -          <Info>
    -            some info
    -          </Info>
    -        </Message>
    -        <Expression success="false" type="CHECK" filename="plugin.cpp" line="0">
    -          <Original>
    -            1 == 2
    -          </Original>
    -          <Expanded>
    -            1 == 2
    -          </Expanded>
    -          <Info>
    -            some info
    -          </Info>
    -        </Expression>
    -        <Message type="FATAL ERROR" filename="plugin.cpp" line="0">
    -          <Text>
    -            certain death!
    -          </Text>
    -          <Info>
    -            some info
    -          </Info>
    -        </Message>
    -      </SubCase>
    -      <OverallResultsAsserts successes="0" failures="2"/>
    -    </TestCase>
    -  </TestSuite>
    -  <OverallResultsAsserts successes="0" failures="2"/>
    -  <OverallResultsTestCases successes="3" failures="2" skipped="0"/>
    +  <OverallResultsAsserts successes="0" failures="0"/>
    +  <OverallResultsTestCases successes="3" failures="1" skipped="0"/>
     </doctest>
    
    CMake Error at /home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/scripts/cmake/exec_test.cmake:69 (message):
      Running
      '/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/executable_dll_and_plugin
      --no-version --reporters=xml --dt-no-path-filenames=1
      --dt-no-line-numbers=1 --dt-no-exitcode=1 --dt-gnu-file-line=0
      --dt-no-time-in-output=1' ended with code 'Output is different from
      reference file!'
    
    
    
    134/135 Test #127: executable_dll_and_plugin ..................***Failed    0.07 sec
    -- Found Git: /nix/store/32r66ar7hxcc4a6hh26yx49w79bjhnw7-git-2.33.0/bin/git (found version "2.33.0") 
    diff --git a/home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin.txt b/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/CMakeFiles/temp_test_output_executable_dll_and_plugin.txt
    index ea9bdeb..51fb4fb 100644
    --- a/home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin.txt
    +++ b/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/CMakeFiles/temp_test_output_executable_dll_and_plugin.txt
    @@ -7,25 +7,9 @@ I am a test from the executable!
     main.cpp(0):
     TEST CASE:  executable
     
    -main.cpp(0): ERROR: test case THREW exception: char: 97
    +main.cpp(0): ERROR: test case THREW exception: unknown exception
     
     ===============================================================================
    -plugin.cpp(0):
    -TEST SUITE: some test suite
    -TEST CASE:  test case in a plugin
    -  some subcase
    -
    -plugin.cpp(0): MESSAGE: triggering the INFO above to be printed
    -  logged: some info
    -
    -plugin.cpp(0): ERROR: CHECK( 1 == 2 ) is NOT correct!
    -  values: CHECK( 1 == 2 )
    -  logged: some info
    -
    -plugin.cpp(0): FATAL ERROR: certain death!
    -  logged: some info
    -
    -===============================================================================
    -[doctest] test cases: 5 | 3 passed | 2 failed | 0 skipped
    -[doctest] assertions: 2 | 0 passed | 2 failed |
    +[doctest] test cases: 4 | 3 passed | 1 failed | 0 skipped
    +[doctest] assertions: 0 | 0 passed | 0 failed |
     [doctest] Status: FAILURE!
    
    CMake Error at /home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/scripts/cmake/exec_test.cmake:69 (message):
      Running
      '/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/executable_dll_and_plugin
      --no-version --dt-no-path-filenames=1 --dt-no-line-numbers=1
      --dt-no-exitcode=1 --dt-gnu-file-line=0 --dt-no-time-in-output=1' ended
      with code 'Output is different from reference file!'
    
    
    
    135/135 Test #129: executable_dll_and_plugin_junit ............***Failed    0.06 sec
    -- Found Git: /nix/store/32r66ar7hxcc4a6hh26yx49w79bjhnw7-git-2.33.0/bin/git (found version "2.33.0") 
    diff --git a/home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_junit.txt b/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/CMakeFiles/temp_test_output_executable_dll_and_plugin_junit.txt
    index deb65a4..1a54555 100644
    --- a/home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/examples/executable_dll_and_plugin/test_output/executable_dll_and_plugin_junit.txt
    +++ b/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/CMakeFiles/temp_test_output_executable_dll_and_plugin_junit.txt
    @@ -4,23 +4,14 @@ I am a test from the implementation!
     I am a test from the implementation_2!
     I am a test from the executable!
     <testsuites>
    -  <testsuite name="executable_dll_and_plugin" errors="1" failures="1" tests="2">
    +  <testsuite name="executable_dll_and_plugin" errors="1" failures="0" tests="0">
         <testcase classname="dll.cpp" name="dll" status="run"/>
         <testcase classname="implementation.cpp" name="implementation" status="run"/>
         <testcase classname="implementation_2.cpp" name="implementation_2" status="run"/>
         <testcase classname="main.cpp" name="executable" status="run">
           <error message="exception">
    -        char: 97
    +        unknown exception
           </error>
         </testcase>
    -    <testcase classname="plugin.cpp" name="test case in a plugin/some subcase" status="run">
    -      <failure message="1 == 2" type="CHECK">
    -plugin.cpp(0):
    -CHECK( 1 == 2 ) is NOT correct!
    -  values: CHECK( 1 == 2 )
    -  logged: some info
    -
    -      </failure>
    -    </testcase>
       </testsuite>
     </testsuites>
    
    CMake Error at /home/jkt/work/cesnet/gerrit/CzechLight/cla-sysrepo/submodules/dependencies/doctest/scripts/cmake/exec_test.cmake:69 (message):
      Running
      '/home/jkt/work/prog/_build/czechlight-gcc-11-asan-ubsan/doctest/examples/executable_dll_and_plugin/executable_dll_and_plugin
      --no-version --reporters=junit --dt-no-path-filenames=1
      --dt-no-line-numbers=1 --dt-no-exitcode=1 --dt-gnu-file-line=0
      --dt-no-time-in-output=1' ended with code 'Output is different from
      reference file!'
    
    
    
    
    98% tests passed, 3 tests failed out of 135
    
    Total Test time (real) =   0.55 sec
    
    The following tests FAILED:
            127 - executable_dll_and_plugin (Failed)
            128 - executable_dll_and_plugin_xml (Failed)
            129 - executable_dll_and_plugin_junit (Failed)
    Errors while running CTest
    
    opened by jktjkt 2
  • build failure with gcc-11.2 when using user declared operator<<(ostream, vector)

    build failure with gcc-11.2 when using user declared operator<<(ostream, vector)

    Description

    When using a user declared operator<<(std::ostream, const std::vector<int>& v), and compiling with the latest gcc version ( 11.2.0 ), I get this compiler error:

    /usr/include/doctest/doctest.h:835:39: error: no match for ‘operator<<’ (operand types are ‘std::ostream’
        {aka ‘std::basic_ostream<char, std::char_traits<char> >’} and ‘const std::vector<int>’)
    

    Steps to reproduce

    With this errordemo.cpp file:

    #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
    #include <doctest/doctest.h>
    
    std::ostream& operator<<(std::ostream& os, const std::vector<int>& v)
    {
    	return os << "intvector";
    }
    
    TEST_CASE("test") {
    	std::vector<int> v;
    	CHECK( v == v );
    }
    

    and compile with:

    g++-11  errordemo.cpp
    

    And you will get lots of compiler errors, the full log is here: x-errors.txt.

    Extra information

    • On the other hand, compiling the same with any of these compilers works just fine:

      • g++-10
      • clang++-11
      • clang++-12
      • clang++-13
      • msvc 19.29
    • When commenting out the operator<< function the problem disappears.

    • When using catch instead of doctest, this works even with g++ 11.2.

    Only the combination doctest, g++ 11.2 and the user defined operator will produce the error. Note that this also fails when using other templated types, like std::array, std::tuple, or std::optional.

    I am not sure if this is a problem with gcc, or with doctest.

    • doctest version: v2.4.6
    • Operating System: Debian testing, linux 5.14.0-4-amd64
    • Compiler+version: GCC 11.2.0 for amd64
    opened by nlitsme 5
Releases(2.4.6)
Owner
Viktor Kirilov
Working on Nimbus - an Ethereum 1.0 & 2.0 Client for Resource-Restricted Devices.
Viktor Kirilov
A unit testing framework for C

Check Table of Contents About Installing Linking Packaging About Check is a unit testing framework for C. It features a simple interface for defining

null 794 Nov 29, 2021
CppUTest unit testing and mocking framework for C/C++

CppUTest CppUTest unit testing and mocking framework for C/C++ More information on the project page Slack channel: Join if link not expired Getting St

CppUTest 981 Dec 2, 2021
A testing micro framework for creating function test doubles

Fake Function Framework (fff) A Fake Function Framework for C Hello Fake World! Capturing Arguments Return Values Resetting a Fake Call History Defaul

Mike Long 453 Nov 28, 2021
Googletest - Google Testing and Mocking Framework

GoogleTest OSS Builds Status Announcements Release 1.10.x Release 1.10.x is now available. Coming Soon Post 1.10.x googletest will follow Abseil Live

Google 24.3k Dec 5, 2021
Minimal unit testing framework for C

MinUnit Minunit is a minimal unit testing framework for C/C++ self-contained in a single header file. It provides a way to define and configure test s

David Siñuela Pastor 385 Dec 1, 2021
A lightweight unit testing framework for C++

Maintenance of UnitTest++, recently sporadic, is officially on hiatus until 26 November 2020. Subscribe to https://github.com/unittest-cpp/unittest-cp

UnitTest++ 474 Nov 10, 2021
UT: C++20 μ(micro)/Unit Testing Framework

"If you liked it then you "should have put a"_test on it", Beyonce rule [Boost::ext].UT / μt | Motivation | Quick Start | Overview | Tutorial | Exampl

boost::ext 705 Nov 28, 2021
🍦IceCream-Cpp is a little (single header) library to help with the print debugging on C++11 and forward.

??IceCream-Cpp is a little (single header) library to help with the print debugging on C++11 and forward.

Renato Garcia 325 Nov 28, 2021
Simple Unit Testing for C

Unity Test Copyright (c) 2007 - 2021 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams Welcome to the Unity Test Project, one of the

Throw The Switch 2.2k Dec 3, 2021
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 14.3k Dec 1, 2021
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 14.3k Dec 6, 2021
Single C file, Realtime CPU/GPU Profiler with Remote Web Viewer

Remotery A realtime CPU/GPU profiler hosted in a single C file with a viewer that runs in a web browser. Supported Platforms: Windows Windows UWP (Hol

Celtoys 1.9k Nov 29, 2021
C++ Benchmark Authoring Library/Framework

Celero C++ Benchmarking Library Copyright 2017-2019 John Farrier Apache 2.0 License Community Support A Special Thanks to the following corporations f

John Farrier 665 Dec 5, 2021
A C++ micro-benchmarking framework

Nonius What is nonius? Nonius is an open-source framework for benchmarking small snippets of C++ code. It is very heavily inspired by Criterion, a sim

Nonius 328 Dec 2, 2021
test framework

Photesthesis This is a small, experimental parameterized-testing tool. It is intended to be used in concert with another unit-testing framework (eg. C

Graydon Hoare 11 Jun 2, 2021
The fastest feature-rich C++11/14/17/20 single-header testing framework

master branch Windows All dev branch Windows All doctest is a new C++ testing framework but is by far the fastest both in compile times (by orders of

Viktor Kirilov 3.6k Dec 7, 2021
✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

null 5.8k Nov 28, 2021
CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface.

CLI11: Command line parser for C++11 What's new • Documentation • API Reference CLI11 is a command line parser for C++11 and beyond that provides a ri

null 1.9k Dec 6, 2021
Feature-rich C99 library for memory scanning purposes, designed for Windows running machines, meant to work on both 32-bit and 64-bit portable executables. Has a modern C++ wrapper.

memscan Feature-rich C99 library for memory scanning purposes, designed for Windows running machines, meant to work on both 32-bit and 64-bit portable

cristei 7 Nov 16, 2021
C++ Unit Testing Easier: A Header-only C++ unit testing framework

CUTE C++ Unit Testing Easier: A Header-only C++ unit testing framework usually available as part of the Cevelop C++ IDE (http://cevelop.com) Dependenc

Peter Sommerlad 32 Nov 9, 2021
Rule Engine (RE) creates an interpretable anomaly classifier from many one-feature and two-feature decision rules

Rule Engine (RE) creates an interpretable anomaly classifier from many one-feature and two-feature decision rules

James Thomas 13 Aug 19, 2021
🧪 single header unit testing framework for C and C++

?? utest.h A simple one header solution to unit testing for C/C++. Usage Just #include "utest.h" in your code! The current supported platforms are Lin

Neil Henning 398 Dec 3, 2021
The C Unit Testing Library on GitHub is a library designed for easy unit testing in C

The C Unit Testing Library on GitHub is a library designed for easy unit testing in C. It was written by Brennan Hurst for the purpose of providing a J-Unit-like testing framework within C for personal projects.

null 1 Oct 11, 2021
A complete unit testing framework in a header

liblittletest A complete unit testing framework in a header liblittletest is an easy to use all-in-an-header testing framework; all you have to do in

Sebastiano Merlino 13 Nov 11, 2021
Rich text library supporting customizable Markdown formatting

Rich text library supporting customizable Markdown formatting

Brace Yourself Games 60 Dec 3, 2021
Typewriter Effect with Rich Text + *Correct* Text Wrapping

Typewriter Effect with Rich Text + Correct Text Wrapping I've spent way too long getting this right. This is meant as a base class for a UMG dialogue

Sam Bloomberg 15 Nov 27, 2021
Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.

Pavel Stehule 1.7k Nov 26, 2021
TIDAL - Discord Rich Presence plug-in (UNOFFICIAL)

TIDAL - Discord Rich Presence plug-in (UNOFFICIAL) Unofficial plug in to obtain Discord Rich Presence. Feel free to report any bugs or make suggestion

Rares Sarmasag 2 Nov 12, 2021
A single file, single function, header to make notifications on the PS4 easier

Notifi Synopsis Adds a single function notifi(). It functions like printf however the first arg is the image to use (NULL and any invalid input should

Al Azif 4 Nov 2, 2021