blob: 72e342f69086c9f73965a14384f450f31b088c42 [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)
onqtam35c14cd2017-04-24 12:54:03 +030071TEST CASE: third party asserts can report failures to doctest
onqtamcb7bad62017-04-19 11:19:57 +030072
73logging.cpp(0) ERROR!
74 MY_ASSERT(false)
75
76logging.cpp(0) FATAL ERROR!
77 MY_ASSERT_FATAL(false)
78
onqtam35c14cd2017-04-24 12:54:03 +030079===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030080logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +030081TEST CASE: explicit failures 1
onqtamcb7bad62017-04-19 11:19:57 +030082
83logging.cpp(0) ERROR!
84 this should not end the test case, but mark it as failing
85
onqtam378d6702017-04-19 11:30:03 +030086logging.cpp(0) MESSAGE!
87 reached!
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 2
onqtamcb7bad62017-04-19 11:19:57 +030092
93logging.cpp(0) FATAL ERROR!
94 fail the test case and also end it
95
onqtam2c100d62017-04-16 22:47:28 +030096===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030097[doctest] test cases: 5 | 0 passed | 5 failed |
98[doctest] assertions: 6 | 0 passed | 6 failed |
onqtam2c100d62017-04-16 22:47:28 +030099Program code.