onqtam | 2c100d6 | 2017-04-16 22:47:28 +0300 | [diff] [blame] | 1 | [doctest] run with "--help" for options |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 2 | =============================================================================== |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 3 | logging.cpp(0): |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 4 | TEST CASE: logging the counter of a loop |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 5 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 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 |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 10 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 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 |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 15 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 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 |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 20 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 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 |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 25 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 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 |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 30 | |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 31 | =============================================================================== |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 32 | logging.cpp(0): |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 33 | TEST CASE: a test case that will end from an exception |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 34 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 35 | logging.cpp(0): ERROR: forcing the many captures (including those on the heap) to be stringified |
| 36 | logged: lots of captures - some on heap: 42 42 42; |
onqtam | 321f270 | 2017-05-01 19:14:58 +0300 | [diff] [blame] | 37 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 38 | logging.cpp(0): ERROR: CHECK( some_var == 666 ) is NOT correct! |
| 39 | values: CHECK( 42 == 666 ) |
| 40 | logged: someTests() returned: 42 |
| 41 | this should be printed if an exception is thrown even if no assert has failed: 42 |
| 42 | in a nested scope this should be printed as well: 42 |
| 43 | why is this not 666 ?! |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 44 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 45 | logging.cpp(0): ERROR: test case THREW exception: 0 |
| 46 | logged: someTests() returned: 42 |
| 47 | this should be printed if an exception is thrown even if no assert has failed: 42 |
| 48 | in a nested scope this should be printed as well: 42 |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 49 | |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 50 | =============================================================================== |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 51 | logging.cpp(0): |
onqtam | 7630535 | 2017-05-01 20:25:09 +0300 | [diff] [blame] | 52 | TEST CASE: a test case that will end from an exception and should print the unprinted context |
| 53 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 54 | logging.cpp(0): ERROR: test case THREW exception: 0 |
| 55 | logged: should be printed even if an exception is thrown and no assert fails before that |
onqtam | 7630535 | 2017-05-01 20:25:09 +0300 | [diff] [blame] | 56 | |
| 57 | =============================================================================== |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 58 | logging.cpp(0): |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 59 | TEST CASE: third party asserts can report failures to doctest |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 60 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 61 | logging.cpp(0): ERROR: MY_ASSERT(false) |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 62 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 63 | logging.cpp(0): FATAL ERROR: MY_ASSERT_FATAL(false) |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 64 | |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 65 | =============================================================================== |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 66 | logging.cpp(0): |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 67 | TEST CASE: explicit failures 1 |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 68 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 69 | logging.cpp(0): ERROR: this should not end the test case, but mark it as failing |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 70 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 71 | logging.cpp(0): MESSAGE: reached! |
onqtam | 378d670 | 2017-04-19 11:30:03 +0300 | [diff] [blame] | 72 | |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 73 | =============================================================================== |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 74 | logging.cpp(0): |
onqtam | 35c14cd | 2017-04-24 12:54:03 +0300 | [diff] [blame] | 75 | TEST CASE: explicit failures 2 |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 76 | |
onqtam | 1655b24 | 2018-05-10 15:29:21 +0300 | [diff] [blame] | 77 | logging.cpp(0): FATAL ERROR: fail the test case and also end it |
onqtam | cb7bad6 | 2017-04-19 11:19:57 +0300 | [diff] [blame] | 78 | |
onqtam | 2c100d6 | 2017-04-16 22:47:28 +0300 | [diff] [blame] | 79 | =============================================================================== |
onqtam | 68d0f1d | 2017-05-07 20:45:09 +0300 | [diff] [blame] | 80 | [doctest] test cases: 6 | 0 passed | 6 failed | |
| 81 | [doctest] assertions: 11 | 0 passed | 11 failed | |
onqtam | 754f402 | 2017-05-06 20:07:49 +0300 | [diff] [blame] | 82 | [doctest] Status: FAILURE! |
onqtam | 2c100d6 | 2017-04-16 22:47:28 +0300 | [diff] [blame] | 83 | Program code. |