assertion_macros.cpp.txt (11172B)
1 [doctest] run with "--help" for options 2 =============================================================================== 3 assertion_macros.cpp(0): 4 TEST CASE: normal macros 5 6 assertion_macros.cpp(0): ERROR: CHECK( throw_if(true, std::runtime_error("whops!")) == 42 ) THREW exception: "whops!" 7 8 assertion_macros.cpp(0): ERROR: CHECK( doctest::Approx(0.502) == 0.501 ) is NOT correct! 9 values: CHECK( Approx( 0.502 ) == 0.501 ) 10 11 =============================================================================== 12 assertion_macros.cpp(0): 13 TEST CASE: exceptions-related macros 14 15 assertion_macros.cpp(0): ERROR: CHECK_THROWS( throw_if(false, 0) ) did NOT throw at all! 16 17 assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(true, 0), char ) threw a DIFFERENT exception: "0" 18 19 assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(false, 0), int ) did NOT throw at all! 20 21 assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(true, "whops!"), "whops! no match!" ) threw a DIFFERENT exception: "whops!" 22 23 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?" 24 25 assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, "whops!"), "whops! no match!", bool ) threw a DIFFERENT exception! (contents: "whops!") 26 27 assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, "whops!"), "whops!", int ) threw a DIFFERENT exception! (contents: "whops!") 28 29 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?") 30 31 assertion_macros.cpp(0): ERROR: CHECK_NOTHROW( throw_if(true, 0) ) THREW exception: "0" 32 33 =============================================================================== 34 assertion_macros.cpp(0): 35 TEST CASE: exceptions-related macros for std::exception 36 37 assertion_macros.cpp(0): ERROR: CHECK_THROWS( throw_if(false, 0) ) did NOT throw at all! 38 39 assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(false, std::runtime_error("whops!")), std::exception ) did NOT throw at all! 40 41 assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(true, std::runtime_error("whops!")), int ) threw a DIFFERENT exception: "whops!" 42 43 assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(false, ""), "whops!" ) did NOT throw at all! 44 45 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_NOTHROW( throw_if(true, std::runtime_error("whops!")) ) THREW exception: "whops!" 46 47 =============================================================================== 48 assertion_macros.cpp(0): 49 TEST CASE: WARN level of asserts don't fail the test case 50 51 assertion_macros.cpp(0): WARNING: WARN( 0 ) is NOT correct! 52 values: WARN( 0 ) 53 54 assertion_macros.cpp(0): WARNING: WARN_FALSE( 1 ) is NOT correct! 55 values: WARN_FALSE( 1 ) 56 57 assertion_macros.cpp(0): WARNING: WARN_THROWS( throw_if(false, 0) ) did NOT throw at all! 58 59 assertion_macros.cpp(0): WARNING: WARN_THROWS_WITH( throw_if(true, ""), "whops!" ) threw a DIFFERENT exception: 60 61 assertion_macros.cpp(0): WARNING: WARN_THROWS_WITH( throw_if(false, ""), "whops!" ) did NOT throw at all! 62 63 assertion_macros.cpp(0): WARNING: WARN_THROWS_AS( throw_if(false, 0), bool ) did NOT throw at all! 64 65 assertion_macros.cpp(0): WARNING: WARN_THROWS_AS( throw_if(true, 0), bool ) threw a DIFFERENT exception: "0" 66 67 assertion_macros.cpp(0): WARNING: WARN_THROWS_WITH_AS( throw_if(false, ""), "whops!", int ) did NOT throw at all! 68 69 assertion_macros.cpp(0): WARNING: WARN_THROWS_WITH_AS( throw_if(true, ""), "whops!", int ) threw a DIFFERENT exception! (contents: ) 70 71 assertion_macros.cpp(0): WARNING: WARN_NOTHROW( throw_if(true, 0) ) THREW exception: "0" 72 73 assertion_macros.cpp(0): WARNING: WARN_EQ( 1, 0 ) is NOT correct! 74 values: WARN_EQ( 1, 0 ) 75 76 assertion_macros.cpp(0): WARNING: WARN_UNARY( 0 ) is NOT correct! 77 values: WARN_UNARY( 0 ) 78 79 assertion_macros.cpp(0): WARNING: WARN_UNARY_FALSE( 1 ) is NOT correct! 80 values: WARN_UNARY_FALSE( 1 ) 81 82 =============================================================================== 83 assertion_macros.cpp(0): 84 TEST CASE: CHECK level of asserts fail the test case but don't abort it 85 86 assertion_macros.cpp(0): ERROR: CHECK( 0 ) is NOT correct! 87 values: CHECK( 0 ) 88 89 assertion_macros.cpp(0): ERROR: CHECK_FALSE( 1 ) is NOT correct! 90 values: CHECK_FALSE( 1 ) 91 92 assertion_macros.cpp(0): ERROR: CHECK_THROWS( throw_if(false, 0) ) did NOT throw at all! 93 94 assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(false, 0), bool ) did NOT throw at all! 95 96 assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(true, 0), bool ) threw a DIFFERENT exception: "0" 97 98 assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(true, 0), "unrecognized" ) threw a DIFFERENT exception: "0" 99 100 assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, 0), "unrecognized", int ) threw a DIFFERENT exception! (contents: "0") 101 102 assertion_macros.cpp(0): ERROR: CHECK_NOTHROW( throw_if(true, 0) ) THREW exception: "0" 103 104 assertion_macros.cpp(0): ERROR: CHECK_EQ( 1, 0 ) is NOT correct! 105 values: CHECK_EQ( 1, 0 ) 106 107 assertion_macros.cpp(0): ERROR: CHECK_UNARY( 0 ) is NOT correct! 108 values: CHECK_UNARY( 0 ) 109 110 assertion_macros.cpp(0): ERROR: CHECK_UNARY_FALSE( 1 ) is NOT correct! 111 values: CHECK_UNARY_FALSE( 1 ) 112 113 assertion_macros.cpp(0): MESSAGE: reached! 114 115 =============================================================================== 116 assertion_macros.cpp(0): 117 TEST CASE: REQUIRE level of asserts fail and abort the test case - 1 118 119 assertion_macros.cpp(0): FATAL ERROR: REQUIRE( 0 ) is NOT correct! 120 values: REQUIRE( 0 ) 121 122 =============================================================================== 123 assertion_macros.cpp(0): 124 TEST CASE: REQUIRE level of asserts fail and abort the test case - 2 125 126 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_FALSE( 1 ) is NOT correct! 127 values: REQUIRE_FALSE( 1 ) 128 129 =============================================================================== 130 assertion_macros.cpp(0): 131 TEST CASE: REQUIRE level of asserts fail and abort the test case - 3 132 133 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS( throw_if(false, 0) ) did NOT throw at all! 134 135 =============================================================================== 136 assertion_macros.cpp(0): 137 TEST CASE: REQUIRE level of asserts fail and abort the test case - 4 138 139 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_AS( throw_if(false, 0), bool ) did NOT throw at all! 140 141 =============================================================================== 142 assertion_macros.cpp(0): 143 TEST CASE: REQUIRE level of asserts fail and abort the test case - 5 144 145 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_AS( throw_if(true, 0), bool ) threw a DIFFERENT exception: "0" 146 147 =============================================================================== 148 assertion_macros.cpp(0): 149 TEST CASE: REQUIRE level of asserts fail and abort the test case - 6 150 151 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_WITH( throw_if(false, ""), "whops!" ) did NOT throw at all! 152 153 =============================================================================== 154 assertion_macros.cpp(0): 155 TEST CASE: REQUIRE level of asserts fail and abort the test case - 7 156 157 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_WITH( throw_if(true, ""), "whops!" ) threw a DIFFERENT exception: 158 159 =============================================================================== 160 assertion_macros.cpp(0): 161 TEST CASE: REQUIRE level of asserts fail and abort the test case - 8 162 163 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_WITH_AS( throw_if(false, ""), "whops!", bool ) did NOT throw at all! 164 165 =============================================================================== 166 assertion_macros.cpp(0): 167 TEST CASE: REQUIRE level of asserts fail and abort the test case - 9 168 169 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_THROWS_WITH_AS( throw_if(true, ""), "whops!", bool ) threw a DIFFERENT exception! (contents: ) 170 171 =============================================================================== 172 assertion_macros.cpp(0): 173 TEST CASE: REQUIRE level of asserts fail and abort the test case - 10 174 175 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_NOTHROW( throw_if(true, 0) ) THREW exception: "0" 176 177 =============================================================================== 178 assertion_macros.cpp(0): 179 TEST CASE: REQUIRE level of asserts fail and abort the test case - 11 180 181 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_EQ( 1, 0 ) is NOT correct! 182 values: REQUIRE_EQ( 1, 0 ) 183 184 =============================================================================== 185 assertion_macros.cpp(0): 186 TEST CASE: REQUIRE level of asserts fail and abort the test case - 12 187 188 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_UNARY( 0 ) is NOT correct! 189 values: REQUIRE_UNARY( 0 ) 190 191 =============================================================================== 192 assertion_macros.cpp(0): 193 TEST CASE: REQUIRE level of asserts fail and abort the test case - 13 194 195 assertion_macros.cpp(0): FATAL ERROR: REQUIRE_UNARY_FALSE( 1 ) is NOT correct! 196 values: REQUIRE_UNARY_FALSE( 1 ) 197 198 =============================================================================== 199 assertion_macros.cpp(0): 200 TEST CASE: some asserts used in a function called by a test case 201 202 assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH_AS( throw_if(true, false), "unknown exception", int ) threw a DIFFERENT exception! (contents: "unknown exception") 203 204 =============================================================================== 205 assertion_macros.cpp(0): 206 TEST CASE: check return values 207 208 assertion_macros.cpp(0): MESSAGE: :D 209 210 assertion_macros.cpp(0): MESSAGE: :D 211 212 assertion_macros.cpp(0): MESSAGE: :D 213 214 assertion_macros.cpp(0): MESSAGE: :D 215 216 assertion_macros.cpp(0): MESSAGE: :D 217 218 assertion_macros.cpp(0): MESSAGE: :D 219 220 assertion_macros.cpp(0): MESSAGE: :D 221 222 assertion_macros.cpp(0): MESSAGE: :D 223 224 assertion_macros.cpp(0): MESSAGE: :D 225 226 =============================================================================== 227 assertion_macros.cpp(0): 228 TEST CASE: check return values no print 229 230 assertion_macros.cpp(0): ERROR: CHECK( a == b ) is NOT correct! 231 values: CHECK( 4 == 2 ) 232 233 assertion_macros.cpp(0): ERROR: CHECK_FALSE( a != b ) is NOT correct! 234 values: CHECK_FALSE( 4 != 2 ) 235 236 assertion_macros.cpp(0): ERROR: CHECK_EQ( a, b ) is NOT correct! 237 values: CHECK_EQ( 4, 2 ) 238 239 assertion_macros.cpp(0): ERROR: CHECK_UNARY( a == b ) is NOT correct! 240 values: CHECK_UNARY( false ) 241 242 assertion_macros.cpp(0): ERROR: CHECK_UNARY_FALSE( a != b ) is NOT correct! 243 values: CHECK_UNARY_FALSE( true ) 244 245 assertion_macros.cpp(0): ERROR: CHECK_THROWS( throw_if(false, false) ) did NOT throw at all! 246 247 assertion_macros.cpp(0): ERROR: CHECK_THROWS_AS( throw_if(true, 2), doctest::Approx ) threw a DIFFERENT exception: "2" 248 249 assertion_macros.cpp(0): ERROR: CHECK_NOTHROW( throw_if(true, 2) ) THREW exception: "2" 250 251 assertion_macros.cpp(0): ERROR: CHECK_THROWS_WITH( throw_if(true, 2), "1" ) threw a DIFFERENT exception: "2" 252 253 =============================================================================== 254 [doctest] test cases: 23 | 4 passed | 19 failed | 255 [doctest] assertions: 98 | 48 passed | 50 failed | 256 [doctest] Status: FAILURE! 257 Program code.