blob: 5e2b391187a0f3bce40795eceb92ce4af971f1db [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!
51 CHECK( some_var == 666 )
52with expansion:
53 CHECK( 42 == 666 )
54with context:
55 someTests() returned: 42
56 this should be printed if an exception is thrown even if no assert has failed: 42
57 in a nested scope this should be printed as well: 42
58 why is this not 666 ?!
59
60TEST CASE FAILED!
61threw exception:
62 0
63
onqtam35c14cd2017-04-24 12:54:03 +030064===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030065logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +030066TEST CASE: third party asserts can report failures to doctest
onqtamcb7bad62017-04-19 11:19:57 +030067
68logging.cpp(0) ERROR!
69 MY_ASSERT(false)
70
71logging.cpp(0) FATAL ERROR!
72 MY_ASSERT_FATAL(false)
73
onqtam35c14cd2017-04-24 12:54:03 +030074===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030075logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +030076TEST CASE: explicit failures 1
onqtamcb7bad62017-04-19 11:19:57 +030077
78logging.cpp(0) ERROR!
79 this should not end the test case, but mark it as failing
80
onqtam378d6702017-04-19 11:30:03 +030081logging.cpp(0) MESSAGE!
82 reached!
83
onqtam35c14cd2017-04-24 12:54:03 +030084===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030085logging.cpp(0)
onqtam35c14cd2017-04-24 12:54:03 +030086TEST CASE: explicit failures 2
onqtamcb7bad62017-04-19 11:19:57 +030087
88logging.cpp(0) FATAL ERROR!
89 fail the test case and also end it
90
onqtam2c100d62017-04-16 22:47:28 +030091===============================================================================
onqtamcb7bad62017-04-19 11:19:57 +030092[doctest] test cases: 5 | 0 passed | 5 failed |
93[doctest] assertions: 6 | 0 passed | 6 failed |
onqtam2c100d62017-04-16 22:47:28 +030094Program code.