blob: 2fe5fce9d070c75b3db5b8e9ab47f59bf9980cc2 [file] [log] [blame]
onqtam2c100d62017-04-16 22:47:28 +03001[doctest] run with "--help" for options
onqtam35c14cd2017-04-24 12:54:03 +03002===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +03003logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +03004TEST CASE: logging the counter of a loop
onqtamcb7bad62017-04-19 11:19:57 +03005
6logging.cpp(0) ERROR!
7 CHECK( vec[i] != (1 << i) )
8with expansion:
9 CHECK( 1 != 1 )
10with context:
11 current iteration of loop:
12 i := 0
13
14logging.cpp(0) ERROR!
15 CHECK( vec[i] != (1 << i) )
16with expansion:
17 CHECK( 2 != 2 )
18with context:
19 current iteration of loop:
20 i := 1
21
22logging.cpp(0) ERROR!
23 CHECK( vec[i] != (1 << i) )
24with expansion:
25 CHECK( 4 != 4 )
26with context:
27 current iteration of loop:
28 i := 2
29
30logging.cpp(0) ERROR!
31 CHECK( vec[i] != (1 << i) )
32with expansion:
33 CHECK( 8 != 8 )
34with context:
35 current iteration of loop:
36 i := 3
37
38logging.cpp(0) ERROR!
39 CHECK( vec[i] != (1 << i) )
40with expansion:
41 CHECK( 16 != 16 )
42with context:
43 current iteration of loop:
44 i := 4
45
onqtam35c14cd2017-04-24 12:54:03 +030046===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030047logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +030048TEST CASE: a test case that will end from an exception
onqtamcb7bad62017-04-19 11:19:57 +030049
50logging.cpp(0) ERROR!
onqtam321f2702017-05-01 19:14:58 +030051 forcing the many captures (including those on the heap) to be stringified
52with context:
53 lots of captures - some on heap: 42 42 42;
54
55logging.cpp(0) ERROR!
onqtamcb7bad62017-04-19 11:19:57 +030056 CHECK( some_var == 666 )
57with expansion:
58 CHECK( 42 == 666 )
59with context:
60 someTests() returned: 42
61 this should be printed if an exception is thrown even if no assert has failed: 42
62 in a nested scope this should be printed as well: 42
63 why is this not 666 ?!
64
65TEST CASE FAILED!
66threw exception:
67 0
68
onqtam35c14cd2017-04-24 12:54:03 +030069===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030070logging.cpp(0)
onqtam76305352017-05-01 20:25:09 +030071TEST CASE: a test case that will end from an exception and should print the unprinted context
72
73TEST CASE FAILED!
74threw exception:
75 0
76with context:
77 should be printed even if an exception is thrown and no assert fails before that
78
79===============================================================================
80logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +030081TEST CASE: third party asserts can report failures to doctest
onqtamcb7bad62017-04-19 11:19:57 +030082
83logging.cpp(0) ERROR!
84 MY_ASSERT(false)
85
86logging.cpp(0) FATAL ERROR!
87 MY_ASSERT_FATAL(false)
88
onqtam35c14cd2017-04-24 12:54:03 +030089===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030090logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +030091TEST CASE: explicit failures 1
onqtamcb7bad62017-04-19 11:19:57 +030092
93logging.cpp(0) ERROR!
94 this should not end the test case, but mark it as failing
95
onqtam378d6702017-04-19 11:30:03 +030096logging.cpp(0) MESSAGE!
97 reached!
98
onqtam35c14cd2017-04-24 12:54:03 +030099===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +0300100logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +0300101TEST CASE: explicit failures 2
onqtamcb7bad62017-04-19 11:19:57 +0300102
103logging.cpp(0) FATAL ERROR!
104 fail the test case and also end it
105
onqtam2c100d62017-04-16 22:47:28 +0300106===============================================================================
onqtam76305352017-05-01 20:25:09 +0300107[doctest] test cases: 6 | 0 passed | 6 failed |
onqtamcb7bad62017-04-19 11:19:57 +0300108[doctest] assertions: 6 | 0 passed | 6 failed |
onqtam2c100d62017-04-16 22:47:28 +0300109Program code.