doctest

FORK: The fastest feature-rich C++11/14/17/20 single-header testing framework
git clone https://git.neptards.moe/neptards/doctest.git
Log | Files | Refs | README

logging.cpp.txt (3060B)


      1 [doctest] run with "--help" for options
      2 ===============================================================================
      3 logging.cpp(0):
      4 TEST CASE:  logging the counter of a loop
      5 
      6 logging.cpp(0): ERROR: CHECK( vec[i] != (1 << i) ) is NOT correct!
      7   values: CHECK( 1 != 1 )
      8   logged: current iteration of loop:
      9           i := 0
     10 
     11 logging.cpp(0): ERROR: CHECK( vec[i] != (1 << i) ) is NOT correct!
     12   values: CHECK( 2 != 2 )
     13   logged: current iteration of loop:
     14           i := 1
     15 
     16 logging.cpp(0): ERROR: CHECK( vec[i] != (1 << i) ) is NOT correct!
     17   values: CHECK( 4 != 4 )
     18   logged: current iteration of loop:
     19           i := 2
     20 
     21 logging.cpp(0): ERROR: CHECK( vec[i] != (1 << i) ) is NOT correct!
     22   values: CHECK( 8 != 8 )
     23   logged: current iteration of loop:
     24           i := 3
     25 
     26 logging.cpp(0): ERROR: CHECK( vec[i] != (1 << i) ) is NOT correct!
     27   values: CHECK( 16 != 16 )
     28   logged: current iteration of loop:
     29           i := 4
     30 
     31 ===============================================================================
     32 logging.cpp(0):
     33 TEST CASE:  a test case that will end from an exception
     34 
     35 logging.cpp(0): ERROR: forcing the many captures to be stringified
     36   logged: lots of captures: 42 42 42;
     37           old way of capturing - using the streaming operator: 42 42
     38 
     39 logging.cpp(0): ERROR: CHECK( some_var == 666 ) is NOT correct!
     40   values: CHECK( 42 == 666 )
     41   logged: someTests() returned: 42
     42           this should be printed if an exception is thrown even if no assert has failed: 42
     43           in a nested scope this should be printed as well: 42
     44           why is this not 666 ?!
     45 
     46 logging.cpp(0): ERROR: test case THREW exception: 0
     47   logged: someTests() returned: 42
     48           this should be printed if an exception is thrown even if no assert has failed: 42
     49           in a nested scope this should be printed as well: 42
     50 
     51 ===============================================================================
     52 logging.cpp(0):
     53 TEST CASE:  a test case that will end from an exception and should print the unprinted context
     54 
     55 logging.cpp(0): ERROR: test case THREW exception: 0
     56   logged: should be printed even if an exception is thrown and no assert fails before that
     57 
     58 ===============================================================================
     59 logging.cpp(0):
     60 TEST CASE:  third party asserts can report failures to doctest
     61 
     62 logging.cpp(0): ERROR: MY_ASSERT(false)
     63 
     64 logging.cpp(0): FATAL ERROR: MY_ASSERT_FATAL(false)
     65 
     66 ===============================================================================
     67 logging.cpp(0):
     68 TEST CASE:  explicit failures 1
     69 
     70 logging.cpp(0): ERROR: this should not end the test case, but mark it as failing
     71 
     72 logging.cpp(0): MESSAGE: reached!
     73 
     74 ===============================================================================
     75 logging.cpp(0):
     76 TEST CASE:  explicit failures 2
     77 
     78 logging.cpp(0): FATAL ERROR: fail the test case and also end it
     79 
     80 ===============================================================================
     81 [doctest] test cases:  6 | 0 passed |  6 failed |
     82 [doctest] assertions: 11 | 0 passed | 11 failed |
     83 [doctest] Status: FAILURE!
     84 Program code.