Welcome to mirror list, hosted at ThFree Co, Russian Federation.

assertion_macros.cpp.txt « test_output « all_features « examples - github.com/onqtam/doctest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7adbf8cb404aab28a0c8158ff174fd330d1161fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
[doctest] run with "--help" for options
===============================================================================
assertion_macros.cpp(0):
TEST CASE:  normal macros

assertion_macros.cpp(0): ERROR: CHECK( throw_if(true, std::runtime_error("whops!")) == 42 ) THREW exception: "whops!"

assertion_macros.cpp(0): ERROR: CHECK( doctest::Approx(0.502) == 0.501 ) is NOT correct!
  values: CHECK( Approx( 0.502 ) == 0.501 )

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  exceptions-related macros

assertion_macros.cpp(0): ERROR: CHECK_THROWS( throw_if(false, 0) ) did NOT throw at all!

assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(true, 0), char ) threw a DIFFERENT exception: "0"

assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(false, 0), int ) did NOT throw at all!

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(true, "whops!"), "whops! no match!" ) threw a DIFFERENT exception: "whops!"

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(true, "whops! does it match?"), "whops! no match!" ) threw a DIFFERENT exception: "whops! does it match?"

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, "whops!"), "whops! no match!", bool ) threw a DIFFERENT exception! (contents: "whops!")

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, "whops!"), "whops!", int ) threw a DIFFERENT exception! (contents: "whops!")

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, "whops! does it match?"), "whops! no match!", int ) threw a DIFFERENT exception! (contents: "whops! does it match?")

assertion_macros.cpp(0): ERROR: CHECK_NOTHROW( throw_if(true, 0) ) THREW exception: "0"

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  exceptions-related macros for std::exception

assertion_macros.cpp(0): ERROR: CHECK_THROWS( throw_if(false, 0) ) did NOT throw at all!

assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(false, std::runtime_error("whops!")), std::exception ) did NOT throw at all!

assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(true, std::runtime_error("whops!")), int ) threw a DIFFERENT exception: "whops!"

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(false, ""), "whops!" ) did NOT throw at all!

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_NOTHROW( throw_if(true, std::runtime_error("whops!")) ) THREW exception: "whops!"

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  WARN level of asserts don't fail the test case

assertion_macros.cpp(0): WARNING: WARN( 0 ) is NOT correct!
  values: WARN( 0 )

assertion_macros.cpp(0): WARNING: WARN_FALSE( 1 ) is NOT correct!
  values: WARN_FALSE( 1 )

assertion_macros.cpp(0): WARNING: WARN_THROWS( throw_if(false, 0) ) did NOT throw at all!

assertion_macros.cpp(0): WARNING: WARN_THROWS_WITH( throw_if(true, ""), "whops!" ) threw a DIFFERENT exception: 

assertion_macros.cpp(0): WARNING: WARN_THROWS_WITH( throw_if(false, ""), "whops!" ) did NOT throw at all!

assertion_macros.cpp(0): WARNING: WARN_THROWS_AS( throw_if(false, 0), bool ) did NOT throw at all!

assertion_macros.cpp(0): WARNING: WARN_THROWS_AS( throw_if(true, 0), bool ) threw a DIFFERENT exception: "0"

assertion_macros.cpp(0): WARNING: WARN_THROWS_WITH_AS( throw_if(false, ""), "whops!", int ) did NOT throw at all!

assertion_macros.cpp(0): WARNING: WARN_THROWS_WITH_AS( throw_if(true, ""), "whops!", int ) threw a DIFFERENT exception! (contents: )

assertion_macros.cpp(0): WARNING: WARN_NOTHROW( throw_if(true, 0) ) THREW exception: "0"

assertion_macros.cpp(0): WARNING: WARN_EQ( 1, 0 ) is NOT correct!
  values: WARN_EQ( 1, 0 )

assertion_macros.cpp(0): WARNING: WARN_UNARY( 0 ) is NOT correct!
  values: WARN_UNARY( 0 )

assertion_macros.cpp(0): WARNING: WARN_UNARY_FALSE( 1 ) is NOT correct!
  values: WARN_UNARY_FALSE( 1 )

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  CHECK level of asserts fail the test case but don't abort it

assertion_macros.cpp(0): ERROR: CHECK( 0 ) is NOT correct!
  values: CHECK( 0 )

assertion_macros.cpp(0): ERROR: CHECK_FALSE( 1 ) is NOT correct!
  values: CHECK_FALSE( 1 )

assertion_macros.cpp(0): ERROR: CHECK_THROWS( throw_if(false, 0) ) did NOT throw at all!

assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(false, 0), bool ) did NOT throw at all!

assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(true, 0), bool ) threw a DIFFERENT exception: "0"

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(true, 0), "unrecognized" ) threw a DIFFERENT exception: "0"

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, 0), "unrecognized", int ) threw a DIFFERENT exception! (contents: "0")

assertion_macros.cpp(0): ERROR: CHECK_NOTHROW( throw_if(true, 0) ) THREW exception: "0"

assertion_macros.cpp(0): ERROR: CHECK_EQ( 1, 0 ) is NOT correct!
  values: CHECK_EQ( 1, 0 )

assertion_macros.cpp(0): ERROR: CHECK_UNARY( 0 ) is NOT correct!
  values: CHECK_UNARY( 0 )

assertion_macros.cpp(0): ERROR: CHECK_UNARY_FALSE( 1 ) is NOT correct!
  values: CHECK_UNARY_FALSE( 1 )

assertion_macros.cpp(0): MESSAGE: reached!

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 1

assertion_macros.cpp(0): FATAL ERROR: REQUIRE( 0 ) is NOT correct!
  values: REQUIRE( 0 )

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 2

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_FALSE( 1 ) is NOT correct!
  values: REQUIRE_FALSE( 1 )

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 3

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS( throw_if(false, 0) ) did NOT throw at all!

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 4

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_AS( throw_if(false, 0), bool ) did NOT throw at all!

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 5

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_AS( throw_if(true, 0), bool ) threw a DIFFERENT exception: "0"

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 6

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_WITH( throw_if(false, ""), "whops!" ) did NOT throw at all!

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 7

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_WITH( throw_if(true, ""), "whops!" ) threw a DIFFERENT exception: 

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 8

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_WITH_AS( throw_if(false, ""), "whops!", bool ) did NOT throw at all!

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 9

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_WITH_AS( throw_if(true, ""), "whops!", bool ) threw a DIFFERENT exception! (contents: )

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 10

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_NOTHROW( throw_if(true, 0) ) THREW exception: "0"

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 11

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_EQ( 1, 0 ) is NOT correct!
  values: REQUIRE_EQ( 1, 0 )

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 12

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_UNARY( 0 ) is NOT correct!
  values: REQUIRE_UNARY( 0 )

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  REQUIRE level of asserts fail and abort the test case - 13

assertion_macros.cpp(0): FATAL ERROR: REQUIRE_UNARY_FALSE( 1 ) is NOT correct!
  values: REQUIRE_UNARY_FALSE( 1 )

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  some asserts used in a function called by a test case

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, false), "unknown exception", int ) threw a DIFFERENT exception! (contents: "unknown exception")

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  check return values

assertion_macros.cpp(0): MESSAGE: :D

assertion_macros.cpp(0): MESSAGE: :D

assertion_macros.cpp(0): MESSAGE: :D

assertion_macros.cpp(0): MESSAGE: :D

assertion_macros.cpp(0): MESSAGE: :D

assertion_macros.cpp(0): MESSAGE: :D

assertion_macros.cpp(0): MESSAGE: :D

assertion_macros.cpp(0): MESSAGE: :D

assertion_macros.cpp(0): MESSAGE: :D

===============================================================================
assertion_macros.cpp(0):
TEST CASE:  check return values no print

assertion_macros.cpp(0): ERROR: CHECK( a == b ) is NOT correct!
  values: CHECK( 4 == 2 )

assertion_macros.cpp(0): ERROR: CHECK_FALSE( a != b ) is NOT correct!
  values: CHECK_FALSE( 4 != 2 )

assertion_macros.cpp(0): ERROR: CHECK_EQ( a, b ) is NOT correct!
  values: CHECK_EQ( 4, 2 )

assertion_macros.cpp(0): ERROR: CHECK_UNARY( a == b ) is NOT correct!
  values: CHECK_UNARY( false )

assertion_macros.cpp(0): ERROR: CHECK_UNARY_FALSE( a != b ) is NOT correct!
  values: CHECK_UNARY_FALSE( true )

assertion_macros.cpp(0): ERROR: CHECK_THROWS( throw_if(false, false) ) did NOT throw at all!

assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(true, 2), doctest::Approx ) threw a DIFFERENT exception: "2"

assertion_macros.cpp(0): ERROR: CHECK_NOTHROW( throw_if(true, 2) ) THREW exception: "2"

assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(true, 2), "1" ) threw a DIFFERENT exception: "2"

===============================================================================
[doctest] test cases:  24 |  5 passed | 19 failed |
[doctest] assertions: 100 | 50 passed | 50 failed |
[doctest] Status: FAILURE!
Program code.