blob: 5c362940f4ae29bff89881a68632c9d364c24b27 [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
Viktor Kirilov17d984c2020-12-04 15:13:33 +020035logging.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
onqtam321f2702017-05-01 19:14:58 +030038
onqtam1655b242018-05-10 15:29:21 +030039logging.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 ?!
onqtamcb7bad62017-04-19 11:19:57 +030045
onqtam1655b242018-05-10 15:29:21 +030046logging.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
onqtamcb7bad62017-04-19 11:19:57 +030050
onqtam35c14cd2017-04-24 12:54:03 +030051===============================================================================
onqtam1655b242018-05-10 15:29:21 +030052logging.cpp(0):
onqtam76305352017-05-01 20:25:09 +030053TEST CASE: a test case that will end from an exception and should print the unprinted context
54
onqtam1655b242018-05-10 15:29:21 +030055logging.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
onqtam76305352017-05-01 20:25:09 +030057
58===============================================================================
onqtam1655b242018-05-10 15:29:21 +030059logging.cpp(0):
onqtam35c14cd2017-04-24 12:54:03 +030060TEST CASE: third party asserts can report failures to doctest
onqtamcb7bad62017-04-19 11:19:57 +030061
onqtam1655b242018-05-10 15:29:21 +030062logging.cpp(0): ERROR: MY_ASSERT(false)
onqtamcb7bad62017-04-19 11:19:57 +030063
onqtam1655b242018-05-10 15:29:21 +030064logging.cpp(0): FATAL ERROR: MY_ASSERT_FATAL(false)
onqtamcb7bad62017-04-19 11:19:57 +030065
onqtam35c14cd2017-04-24 12:54:03 +030066===============================================================================
onqtam1655b242018-05-10 15:29:21 +030067logging.cpp(0):
onqtam35c14cd2017-04-24 12:54:03 +030068TEST CASE: explicit failures 1
onqtamcb7bad62017-04-19 11:19:57 +030069
onqtam1655b242018-05-10 15:29:21 +030070logging.cpp(0): ERROR: this should not end the test case, but mark it as failing
onqtamcb7bad62017-04-19 11:19:57 +030071
onqtam1655b242018-05-10 15:29:21 +030072logging.cpp(0): MESSAGE: reached!
onqtam378d6702017-04-19 11:30:03 +030073
onqtam35c14cd2017-04-24 12:54:03 +030074===============================================================================
onqtam1655b242018-05-10 15:29:21 +030075logging.cpp(0):
onqtam35c14cd2017-04-24 12:54:03 +030076TEST CASE: explicit failures 2
onqtamcb7bad62017-04-19 11:19:57 +030077
onqtam1655b242018-05-10 15:29:21 +030078logging.cpp(0): FATAL ERROR: fail the test case and also end it
onqtamcb7bad62017-04-19 11:19:57 +030079
onqtam2c100d62017-04-16 22:47:28 +030080===============================================================================
Nick Black74b8ac42020-09-06 13:01:26 -040081[doctest] test cases: 6 | 0 passed | 6 failed |
82[doctest] assertions: 11 | 0 passed | 11 failed |
onqtam754f4022017-05-06 20:07:49 +030083[doctest] Status: FAILURE!
onqtam2c100d62017-04-16 22:47:28 +030084Program code.