blob: 4e6107306d10ac466cbb843b8e33ae72a75e0379 [file] [log] [blame]
onqtam2c100d62017-04-16 22:47:28 +03001[doctest] run with "--help" for options
onqtam35c14cd2017-04-24 12:54:03 +03002===============================================================================
onqtam1655b242018-05-10 15:29:21 +03003logging.cpp(0):
onqtam35c14cd2017-04-24 12:54:03 +03004TEST CASE: logging the counter of a loop
onqtamcb7bad62017-04-19 11:19:57 +03005
onqtam1655b242018-05-10 15:29:21 +03006logging.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
onqtamcb7bad62017-04-19 11:19:57 +030010
onqtam1655b242018-05-10 15:29:21 +030011logging.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
onqtamcb7bad62017-04-19 11:19:57 +030015
onqtam1655b242018-05-10 15:29:21 +030016logging.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
onqtamcb7bad62017-04-19 11:19:57 +030020
onqtam1655b242018-05-10 15:29:21 +030021logging.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
onqtamcb7bad62017-04-19 11:19:57 +030025
onqtam1655b242018-05-10 15:29:21 +030026logging.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
onqtamcb7bad62017-04-19 11:19:57 +030030
onqtam35c14cd2017-04-24 12:54:03 +030031===============================================================================
onqtam1655b242018-05-10 15:29:21 +030032logging.cpp(0):
onqtam35c14cd2017-04-24 12:54:03 +030033TEST CASE: a test case that will end from an exception
onqtamcb7bad62017-04-19 11:19:57 +030034
onqtam1655b242018-05-10 15:29:21 +030035logging.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;
onqtam321f2702017-05-01 19:14:58 +030037
onqtam1655b242018-05-10 15:29:21 +030038logging.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 ?!
onqtamcb7bad62017-04-19 11:19:57 +030044
onqtam1655b242018-05-10 15:29:21 +030045logging.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
onqtamcb7bad62017-04-19 11:19:57 +030049
onqtam35c14cd2017-04-24 12:54:03 +030050===============================================================================
onqtam1655b242018-05-10 15:29:21 +030051logging.cpp(0):
onqtam76305352017-05-01 20:25:09 +030052TEST CASE: a test case that will end from an exception and should print the unprinted context
53
onqtam1655b242018-05-10 15:29:21 +030054logging.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
onqtam76305352017-05-01 20:25:09 +030056
57===============================================================================
onqtam1655b242018-05-10 15:29:21 +030058logging.cpp(0):
onqtam35c14cd2017-04-24 12:54:03 +030059TEST CASE: third party asserts can report failures to doctest
onqtamcb7bad62017-04-19 11:19:57 +030060
onqtam1655b242018-05-10 15:29:21 +030061logging.cpp(0): ERROR: MY_ASSERT(false)
onqtamcb7bad62017-04-19 11:19:57 +030062
onqtam1655b242018-05-10 15:29:21 +030063logging.cpp(0): FATAL ERROR: MY_ASSERT_FATAL(false)
onqtamcb7bad62017-04-19 11:19:57 +030064
onqtam35c14cd2017-04-24 12:54:03 +030065===============================================================================
onqtam1655b242018-05-10 15:29:21 +030066logging.cpp(0):
onqtam35c14cd2017-04-24 12:54:03 +030067TEST CASE: explicit failures 1
onqtamcb7bad62017-04-19 11:19:57 +030068
onqtam1655b242018-05-10 15:29:21 +030069logging.cpp(0): ERROR: this should not end the test case, but mark it as failing
onqtamcb7bad62017-04-19 11:19:57 +030070
onqtam1655b242018-05-10 15:29:21 +030071logging.cpp(0): MESSAGE: reached!
onqtam378d6702017-04-19 11:30:03 +030072
onqtam35c14cd2017-04-24 12:54:03 +030073===============================================================================
onqtam1655b242018-05-10 15:29:21 +030074logging.cpp(0):
onqtam35c14cd2017-04-24 12:54:03 +030075TEST CASE: explicit failures 2
onqtamcb7bad62017-04-19 11:19:57 +030076
onqtam1655b242018-05-10 15:29:21 +030077logging.cpp(0): FATAL ERROR: fail the test case and also end it
onqtamcb7bad62017-04-19 11:19:57 +030078
onqtam2c100d62017-04-16 22:47:28 +030079===============================================================================
onqtam68d0f1d2017-05-07 20:45:09 +030080[doctest] test cases: 6 | 0 passed | 6 failed |
81[doctest] assertions: 11 | 0 passed | 11 failed |
onqtam754f4022017-05-06 20:07:49 +030082[doctest] Status: FAILURE!
onqtam2c100d62017-04-16 22:47:28 +030083Program code.