1 This would not be caught previously 2 Nor would this 3 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 <exe-name> is a <version> host application. 6 Run with -? for options 7 8 Randomness seeded to: 1 9 10 ------------------------------------------------------------------------------- 11 #1514: stderr/stdout is not captured in tests aborted by an exception 12 ------------------------------------------------------------------------------- 13 Tricky.tests.cpp:<line number> 14 ............................................................................... 15 16 Tricky.tests.cpp:<line number>: FAILED: 17 explicitly with message: 18 1514 19 20 ------------------------------------------------------------------------------- 21 #748 - captures with unexpected exceptions 22 outside assertions 23 ------------------------------------------------------------------------------- 24 Exception.tests.cpp:<line number> 25 ............................................................................... 26 27 Exception.tests.cpp:<line number>: FAILED: 28 due to unexpected exception with messages: 29 answer := 42 30 expected exception 31 32 ------------------------------------------------------------------------------- 33 #748 - captures with unexpected exceptions 34 inside REQUIRE_NOTHROW 35 ------------------------------------------------------------------------------- 36 Exception.tests.cpp:<line number> 37 ............................................................................... 38 39 Exception.tests.cpp:<line number>: FAILED: 40 REQUIRE_NOTHROW( thisThrows() ) 41 due to unexpected exception with messages: 42 answer := 42 43 expected exception 44 45 ------------------------------------------------------------------------------- 46 #835 -- errno should not be touched by Catch 47 ------------------------------------------------------------------------------- 48 Misc.tests.cpp:<line number> 49 ............................................................................... 50 51 Misc.tests.cpp:<line number>: FAILED: 52 CHECK( f() == 0 ) 53 with expansion: 54 1 == 0 55 56 ------------------------------------------------------------------------------- 57 'Not' checks that should fail 58 ------------------------------------------------------------------------------- 59 Condition.tests.cpp:<line number> 60 ............................................................................... 61 62 Condition.tests.cpp:<line number>: FAILED: 63 CHECK( false != false ) 64 65 Condition.tests.cpp:<line number>: FAILED: 66 CHECK( true != true ) 67 68 Condition.tests.cpp:<line number>: FAILED: 69 CHECK( !true ) 70 with expansion: 71 false 72 73 Condition.tests.cpp:<line number>: FAILED: 74 CHECK_FALSE( true ) 75 with expansion: 76 !true 77 78 Condition.tests.cpp:<line number>: FAILED: 79 CHECK( !trueValue ) 80 with expansion: 81 false 82 83 Condition.tests.cpp:<line number>: FAILED: 84 CHECK_FALSE( trueValue ) 85 with expansion: 86 !true 87 88 Condition.tests.cpp:<line number>: FAILED: 89 CHECK( !(1 == 1) ) 90 with expansion: 91 false 92 93 Condition.tests.cpp:<line number>: FAILED: 94 CHECK_FALSE( 1 == 1 ) 95 96 ------------------------------------------------------------------------------- 97 A METHOD_AS_TEST_CASE based test run that fails 98 ------------------------------------------------------------------------------- 99 Class.tests.cpp:<line number> 100 ............................................................................... 101 102 Class.tests.cpp:<line number>: FAILED: 103 REQUIRE( s == "world" ) 104 with expansion: 105 "hello" == "world" 106 107 ------------------------------------------------------------------------------- 108 A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo 109 <float> 110 ------------------------------------------------------------------------------- 111 Class.tests.cpp:<line number> 112 ............................................................................... 113 114 Class.tests.cpp:<line number>: FAILED: 115 REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) 116 with expansion: 117 0 == 1 118 119 ------------------------------------------------------------------------------- 120 A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo 121 <int> 122 ------------------------------------------------------------------------------- 123 Class.tests.cpp:<line number> 124 ............................................................................... 125 126 Class.tests.cpp:<line number>: FAILED: 127 REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) 128 with expansion: 129 0 == 1 130 131 ------------------------------------------------------------------------------- 132 A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector 133 <float> 134 ------------------------------------------------------------------------------- 135 Class.tests.cpp:<line number> 136 ............................................................................... 137 138 Class.tests.cpp:<line number>: FAILED: 139 REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) 140 with expansion: 141 0 == 1 142 143 ------------------------------------------------------------------------------- 144 A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector 145 <int> 146 ------------------------------------------------------------------------------- 147 Class.tests.cpp:<line number> 148 ............................................................................... 149 150 Class.tests.cpp:<line number>: FAILED: 151 REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) 152 with expansion: 153 0 == 1 154 155 ------------------------------------------------------------------------------- 156 A TEMPLATE_TEST_CASE_METHOD based test run that fails - double 157 ------------------------------------------------------------------------------- 158 Class.tests.cpp:<line number> 159 ............................................................................... 160 161 Class.tests.cpp:<line number>: FAILED: 162 REQUIRE( Template_Fixture<TestType>::m_a == 2 ) 163 with expansion: 164 1.0 == 2 165 166 ------------------------------------------------------------------------------- 167 A TEMPLATE_TEST_CASE_METHOD based test run that fails - float 168 ------------------------------------------------------------------------------- 169 Class.tests.cpp:<line number> 170 ............................................................................... 171 172 Class.tests.cpp:<line number>: FAILED: 173 REQUIRE( Template_Fixture<TestType>::m_a == 2 ) 174 with expansion: 175 1.0f == 2 176 177 ------------------------------------------------------------------------------- 178 A TEMPLATE_TEST_CASE_METHOD based test run that fails - int 179 ------------------------------------------------------------------------------- 180 Class.tests.cpp:<line number> 181 ............................................................................... 182 183 Class.tests.cpp:<line number>: FAILED: 184 REQUIRE( Template_Fixture<TestType>::m_a == 2 ) 185 with expansion: 186 1 == 2 187 188 ------------------------------------------------------------------------------- 189 A TEST_CASE_METHOD based test run that fails 190 ------------------------------------------------------------------------------- 191 Class.tests.cpp:<line number> 192 ............................................................................... 193 194 Class.tests.cpp:<line number>: FAILED: 195 REQUIRE( m_a == 2 ) 196 with expansion: 197 1 == 2 198 199 ------------------------------------------------------------------------------- 200 A couple of nested sections followed by a failure 201 ------------------------------------------------------------------------------- 202 Misc.tests.cpp:<line number> 203 ............................................................................... 204 205 Misc.tests.cpp:<line number>: FAILED: 206 explicitly with message: 207 to infinity and beyond 208 209 ------------------------------------------------------------------------------- 210 A failing expression with a non streamable type is still captured 211 ------------------------------------------------------------------------------- 212 Tricky.tests.cpp:<line number> 213 ............................................................................... 214 215 Tricky.tests.cpp:<line number>: FAILED: 216 CHECK( &o1 == &o2 ) 217 with expansion: 218 0x<hex digits> == 0x<hex digits> 219 220 Tricky.tests.cpp:<line number>: FAILED: 221 CHECK( o1 == o2 ) 222 with expansion: 223 {?} == {?} 224 225 ------------------------------------------------------------------------------- 226 An unchecked exception reports the line of the last assertion 227 ------------------------------------------------------------------------------- 228 Exception.tests.cpp:<line number> 229 ............................................................................... 230 231 Exception.tests.cpp:<line number>: FAILED: 232 {Unknown expression after the reported line} 233 due to unexpected exception with message: 234 unexpected exception 235 236 ------------------------------------------------------------------------------- 237 Contains string matcher 238 ------------------------------------------------------------------------------- 239 Matchers.tests.cpp:<line number> 240 ............................................................................... 241 242 Matchers.tests.cpp:<line number>: FAILED: 243 CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) ) 244 with expansion: 245 "this string contains 'abc' as a substring" contains: "not there" (case 246 insensitive) 247 248 Matchers.tests.cpp:<line number>: FAILED: 249 CHECK_THAT( testStringForMatching(), Contains("STRING") ) 250 with expansion: 251 "this string contains 'abc' as a substring" contains: "STRING" 252 253 ------------------------------------------------------------------------------- 254 Custom exceptions can be translated when testing for nothrow 255 ------------------------------------------------------------------------------- 256 Exception.tests.cpp:<line number> 257 ............................................................................... 258 259 Exception.tests.cpp:<line number>: FAILED: 260 REQUIRE_NOTHROW( throwCustom() ) 261 due to unexpected exception with message: 262 custom exception - not std 263 264 ------------------------------------------------------------------------------- 265 Custom exceptions can be translated when testing for throwing as something else 266 ------------------------------------------------------------------------------- 267 Exception.tests.cpp:<line number> 268 ............................................................................... 269 270 Exception.tests.cpp:<line number>: FAILED: 271 REQUIRE_THROWS_AS( throwCustom(), std::exception ) 272 due to unexpected exception with message: 273 custom exception - not std 274 275 ------------------------------------------------------------------------------- 276 Custom std-exceptions can be custom translated 277 ------------------------------------------------------------------------------- 278 Exception.tests.cpp:<line number> 279 ............................................................................... 280 281 Exception.tests.cpp:<line number>: FAILED: 282 due to unexpected exception with message: 283 custom std exception 284 285 ------------------------------------------------------------------------------- 286 EndsWith string matcher 287 ------------------------------------------------------------------------------- 288 Matchers.tests.cpp:<line number> 289 ............................................................................... 290 291 Matchers.tests.cpp:<line number>: FAILED: 292 CHECK_THAT( testStringForMatching(), EndsWith("Substring") ) 293 with expansion: 294 "this string contains 'abc' as a substring" ends with: "Substring" 295 296 Matchers.tests.cpp:<line number>: FAILED: 297 CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) ) 298 with expansion: 299 "this string contains 'abc' as a substring" ends with: "this" (case 300 insensitive) 301 302 ------------------------------------------------------------------------------- 303 Equality checks that should fail 304 ------------------------------------------------------------------------------- 305 Condition.tests.cpp:<line number> 306 ............................................................................... 307 308 Condition.tests.cpp:<line number>: FAILED: 309 CHECK( data.int_seven == 6 ) 310 with expansion: 311 7 == 6 312 313 Condition.tests.cpp:<line number>: FAILED: 314 CHECK( data.int_seven == 8 ) 315 with expansion: 316 7 == 8 317 318 Condition.tests.cpp:<line number>: FAILED: 319 CHECK( data.int_seven == 0 ) 320 with expansion: 321 7 == 0 322 323 Condition.tests.cpp:<line number>: FAILED: 324 CHECK( data.float_nine_point_one == Approx( 9.11f ) ) 325 with expansion: 326 9.1f == Approx( 9.1099996567 ) 327 328 Condition.tests.cpp:<line number>: FAILED: 329 CHECK( data.float_nine_point_one == Approx( 9.0f ) ) 330 with expansion: 331 9.1f == Approx( 9.0 ) 332 333 Condition.tests.cpp:<line number>: FAILED: 334 CHECK( data.float_nine_point_one == Approx( 1 ) ) 335 with expansion: 336 9.1f == Approx( 1.0 ) 337 338 Condition.tests.cpp:<line number>: FAILED: 339 CHECK( data.float_nine_point_one == Approx( 0 ) ) 340 with expansion: 341 9.1f == Approx( 0.0 ) 342 343 Condition.tests.cpp:<line number>: FAILED: 344 CHECK( data.double_pi == Approx( 3.1415 ) ) 345 with expansion: 346 3.1415926535 == Approx( 3.1415 ) 347 348 Condition.tests.cpp:<line number>: FAILED: 349 CHECK( data.str_hello == "goodbye" ) 350 with expansion: 351 "hello" == "goodbye" 352 353 Condition.tests.cpp:<line number>: FAILED: 354 CHECK( data.str_hello == "hell" ) 355 with expansion: 356 "hello" == "hell" 357 358 Condition.tests.cpp:<line number>: FAILED: 359 CHECK( data.str_hello == "hello1" ) 360 with expansion: 361 "hello" == "hello1" 362 363 Condition.tests.cpp:<line number>: FAILED: 364 CHECK( data.str_hello.size() == 6 ) 365 with expansion: 366 5 == 6 367 368 Condition.tests.cpp:<line number>: FAILED: 369 CHECK( x == Approx( 1.301 ) ) 370 with expansion: 371 1.3 == Approx( 1.301 ) 372 373 ------------------------------------------------------------------------------- 374 Equals string matcher 375 ------------------------------------------------------------------------------- 376 Matchers.tests.cpp:<line number> 377 ............................................................................... 378 379 Matchers.tests.cpp:<line number>: FAILED: 380 CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring") ) 381 with expansion: 382 "this string contains 'abc' as a substring" equals: "this string contains 383 'ABC' as a substring" 384 385 Matchers.tests.cpp:<line number>: FAILED: 386 CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) ) 387 with expansion: 388 "this string contains 'abc' as a substring" equals: "something else" (case 389 insensitive) 390 391 ------------------------------------------------------------------------------- 392 Exception matchers that fail 393 No exception 394 ------------------------------------------------------------------------------- 395 Matchers.tests.cpp:<line number> 396 ............................................................................... 397 398 Matchers.tests.cpp:<line number>: FAILED: 399 CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) 400 because no exception was thrown where one was expected: 401 402 Matchers.tests.cpp:<line number>: FAILED: 403 REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) 404 because no exception was thrown where one was expected: 405 406 ------------------------------------------------------------------------------- 407 Exception matchers that fail 408 Type mismatch 409 ------------------------------------------------------------------------------- 410 Matchers.tests.cpp:<line number> 411 ............................................................................... 412 413 Matchers.tests.cpp:<line number>: FAILED: 414 CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) 415 due to unexpected exception with message: 416 Unknown exception 417 418 Matchers.tests.cpp:<line number>: FAILED: 419 REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) 420 due to unexpected exception with message: 421 Unknown exception 422 423 ------------------------------------------------------------------------------- 424 Exception matchers that fail 425 Contents are wrong 426 ------------------------------------------------------------------------------- 427 Matchers.tests.cpp:<line number> 428 ............................................................................... 429 430 Matchers.tests.cpp:<line number>: FAILED: 431 CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} ) 432 with expansion: 433 SpecialException::what special exception has value of 1 434 435 Matchers.tests.cpp:<line number>: FAILED: 436 REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} ) 437 with expansion: 438 SpecialException::what special exception has value of 1 439 440 ------------------------------------------------------------------------------- 441 Expected exceptions that don't throw or unexpected exceptions fail the test 442 ------------------------------------------------------------------------------- 443 Exception.tests.cpp:<line number> 444 ............................................................................... 445 446 Exception.tests.cpp:<line number>: FAILED: 447 CHECK_THROWS_AS( thisThrows(), std::string ) 448 due to unexpected exception with message: 449 expected exception 450 451 Exception.tests.cpp:<line number>: FAILED: 452 CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) 453 because no exception was thrown where one was expected: 454 455 Exception.tests.cpp:<line number>: FAILED: 456 CHECK_NOTHROW( thisThrows() ) 457 due to unexpected exception with message: 458 expected exception 459 460 ------------------------------------------------------------------------------- 461 FAIL aborts the test 462 ------------------------------------------------------------------------------- 463 Message.tests.cpp:<line number> 464 ............................................................................... 465 466 Message.tests.cpp:<line number>: FAILED: 467 explicitly with message: 468 This is a failure 469 470 ------------------------------------------------------------------------------- 471 FAIL does not require an argument 472 ------------------------------------------------------------------------------- 473 Message.tests.cpp:<line number> 474 ............................................................................... 475 476 Message.tests.cpp:<line number>: FAILED: 477 478 ------------------------------------------------------------------------------- 479 FAIL_CHECK does not abort the test 480 ------------------------------------------------------------------------------- 481 Message.tests.cpp:<line number> 482 ............................................................................... 483 484 Message.tests.cpp:<line number>: FAILED: 485 explicitly with message: 486 This is a failure 487 488 Message.tests.cpp:<line number>: warning: 489 This message appears in the output 490 491 ------------------------------------------------------------------------------- 492 INFO and WARN do not abort tests 493 ------------------------------------------------------------------------------- 494 Message.tests.cpp:<line number> 495 ............................................................................... 496 497 Message.tests.cpp:<line number>: warning: 498 this is a warning 499 500 ------------------------------------------------------------------------------- 501 INFO gets logged on failure 502 ------------------------------------------------------------------------------- 503 Message.tests.cpp:<line number> 504 ............................................................................... 505 506 Message.tests.cpp:<line number>: FAILED: 507 REQUIRE( a == 1 ) 508 with expansion: 509 2 == 1 510 with messages: 511 this message should be logged 512 so should this 513 514 ------------------------------------------------------------------------------- 515 INFO gets logged on failure, even if captured before successful assertions 516 ------------------------------------------------------------------------------- 517 Message.tests.cpp:<line number> 518 ............................................................................... 519 520 Message.tests.cpp:<line number>: FAILED: 521 CHECK( a == 1 ) 522 with expansion: 523 2 == 1 524 with messages: 525 this message may be logged later 526 this message should be logged 527 528 Message.tests.cpp:<line number>: FAILED: 529 CHECK( a == 0 ) 530 with expansion: 531 2 == 0 532 with messages: 533 this message may be logged later 534 this message should be logged 535 and this, but later 536 537 ------------------------------------------------------------------------------- 538 INFO is reset for each loop 539 ------------------------------------------------------------------------------- 540 Message.tests.cpp:<line number> 541 ............................................................................... 542 543 Message.tests.cpp:<line number>: FAILED: 544 REQUIRE( i < 10 ) 545 with expansion: 546 10 < 10 547 with messages: 548 current counter 10 549 i := 10 550 551 ------------------------------------------------------------------------------- 552 Inequality checks that should fail 553 ------------------------------------------------------------------------------- 554 Condition.tests.cpp:<line number> 555 ............................................................................... 556 557 Condition.tests.cpp:<line number>: FAILED: 558 CHECK( data.int_seven != 7 ) 559 with expansion: 560 7 != 7 561 562 Condition.tests.cpp:<line number>: FAILED: 563 CHECK( data.float_nine_point_one != Approx( 9.1f ) ) 564 with expansion: 565 9.1f != Approx( 9.1000003815 ) 566 567 Condition.tests.cpp:<line number>: FAILED: 568 CHECK( data.double_pi != Approx( 3.1415926535 ) ) 569 with expansion: 570 3.1415926535 != Approx( 3.1415926535 ) 571 572 Condition.tests.cpp:<line number>: FAILED: 573 CHECK( data.str_hello != "hello" ) 574 with expansion: 575 "hello" != "hello" 576 577 Condition.tests.cpp:<line number>: FAILED: 578 CHECK( data.str_hello.size() != 5 ) 579 with expansion: 580 5 != 5 581 582 ------------------------------------------------------------------------------- 583 Matchers can be composed with both && and || - failing 584 ------------------------------------------------------------------------------- 585 Matchers.tests.cpp:<line number> 586 ............................................................................... 587 588 Matchers.tests.cpp:<line number>: FAILED: 589 CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") ) 590 with expansion: 591 "this string contains 'abc' as a substring" ( ( contains: "string" or 592 contains: "different" ) and contains: "random" ) 593 594 ------------------------------------------------------------------------------- 595 Matchers can be negated (Not) with the ! operator - failing 596 ------------------------------------------------------------------------------- 597 Matchers.tests.cpp:<line number> 598 ............................................................................... 599 600 Matchers.tests.cpp:<line number>: FAILED: 601 CHECK_THAT( testStringForMatching(), !Contains("substring") ) 602 with expansion: 603 "this string contains 'abc' as a substring" not contains: "substring" 604 605 ------------------------------------------------------------------------------- 606 Mismatching exception messages failing the test 607 ------------------------------------------------------------------------------- 608 Exception.tests.cpp:<line number> 609 ............................................................................... 610 611 Exception.tests.cpp:<line number>: FAILED: 612 REQUIRE_THROWS_WITH( thisThrows(), "should fail" ) 613 with expansion: 614 "expected exception" equals: "should fail" 615 616 ------------------------------------------------------------------------------- 617 Nice descriptive name 618 ------------------------------------------------------------------------------- 619 Misc.tests.cpp:<line number> 620 ............................................................................... 621 622 Misc.tests.cpp:<line number>: warning: 623 This one ran 624 625 ------------------------------------------------------------------------------- 626 Non-std exceptions can be translated 627 ------------------------------------------------------------------------------- 628 Exception.tests.cpp:<line number> 629 ............................................................................... 630 631 Exception.tests.cpp:<line number>: FAILED: 632 due to unexpected exception with message: 633 custom exception 634 635 ------------------------------------------------------------------------------- 636 Ordering comparison checks that should fail 637 ------------------------------------------------------------------------------- 638 Condition.tests.cpp:<line number> 639 ............................................................................... 640 641 Condition.tests.cpp:<line number>: FAILED: 642 CHECK( data.int_seven > 7 ) 643 with expansion: 644 7 > 7 645 646 Condition.tests.cpp:<line number>: FAILED: 647 CHECK( data.int_seven < 7 ) 648 with expansion: 649 7 < 7 650 651 Condition.tests.cpp:<line number>: FAILED: 652 CHECK( data.int_seven > 8 ) 653 with expansion: 654 7 > 8 655 656 Condition.tests.cpp:<line number>: FAILED: 657 CHECK( data.int_seven < 6 ) 658 with expansion: 659 7 < 6 660 661 Condition.tests.cpp:<line number>: FAILED: 662 CHECK( data.int_seven < 0 ) 663 with expansion: 664 7 < 0 665 666 Condition.tests.cpp:<line number>: FAILED: 667 CHECK( data.int_seven < -1 ) 668 with expansion: 669 7 < -1 670 671 Condition.tests.cpp:<line number>: FAILED: 672 CHECK( data.int_seven >= 8 ) 673 with expansion: 674 7 >= 8 675 676 Condition.tests.cpp:<line number>: FAILED: 677 CHECK( data.int_seven <= 6 ) 678 with expansion: 679 7 <= 6 680 681 Condition.tests.cpp:<line number>: FAILED: 682 CHECK( data.float_nine_point_one < 9 ) 683 with expansion: 684 9.1f < 9 685 686 Condition.tests.cpp:<line number>: FAILED: 687 CHECK( data.float_nine_point_one > 10 ) 688 with expansion: 689 9.1f > 10 690 691 Condition.tests.cpp:<line number>: FAILED: 692 CHECK( data.float_nine_point_one > 9.2 ) 693 with expansion: 694 9.1f > 9.2 695 696 Condition.tests.cpp:<line number>: FAILED: 697 CHECK( data.str_hello > "hello" ) 698 with expansion: 699 "hello" > "hello" 700 701 Condition.tests.cpp:<line number>: FAILED: 702 CHECK( data.str_hello < "hello" ) 703 with expansion: 704 "hello" < "hello" 705 706 Condition.tests.cpp:<line number>: FAILED: 707 CHECK( data.str_hello > "hellp" ) 708 with expansion: 709 "hello" > "hellp" 710 711 Condition.tests.cpp:<line number>: FAILED: 712 CHECK( data.str_hello > "z" ) 713 with expansion: 714 "hello" > "z" 715 716 Condition.tests.cpp:<line number>: FAILED: 717 CHECK( data.str_hello < "hellm" ) 718 with expansion: 719 "hello" < "hellm" 720 721 Condition.tests.cpp:<line number>: FAILED: 722 CHECK( data.str_hello < "a" ) 723 with expansion: 724 "hello" < "a" 725 726 Condition.tests.cpp:<line number>: FAILED: 727 CHECK( data.str_hello >= "z" ) 728 with expansion: 729 "hello" >= "z" 730 731 Condition.tests.cpp:<line number>: FAILED: 732 CHECK( data.str_hello <= "a" ) 733 with expansion: 734 "hello" <= "a" 735 736 ------------------------------------------------------------------------------- 737 Output from all sections is reported 738 one 739 ------------------------------------------------------------------------------- 740 Message.tests.cpp:<line number> 741 ............................................................................... 742 743 Message.tests.cpp:<line number>: FAILED: 744 explicitly with message: 745 Message from section one 746 747 ------------------------------------------------------------------------------- 748 Output from all sections is reported 749 two 750 ------------------------------------------------------------------------------- 751 Message.tests.cpp:<line number> 752 ............................................................................... 753 754 Message.tests.cpp:<line number>: FAILED: 755 explicitly with message: 756 Message from section two 757 758 ------------------------------------------------------------------------------- 759 Reconstruction should be based on stringification: #914 760 ------------------------------------------------------------------------------- 761 Decomposition.tests.cpp:<line number> 762 ............................................................................... 763 764 Decomposition.tests.cpp:<line number>: FAILED: 765 CHECK( truthy(false) ) 766 with expansion: 767 Hey, its truthy! 768 769 ------------------------------------------------------------------------------- 770 Regex string matcher 771 ------------------------------------------------------------------------------- 772 Matchers.tests.cpp:<line number> 773 ............................................................................... 774 775 Matchers.tests.cpp:<line number>: FAILED: 776 CHECK_THAT( testStringForMatching(), Matches("this STRING contains 'abc' as a substring") ) 777 with expansion: 778 "this string contains 'abc' as a substring" matches "this STRING contains 779 'abc' as a substring" case sensitively 780 781 Matchers.tests.cpp:<line number>: FAILED: 782 CHECK_THAT( testStringForMatching(), Matches("contains 'abc' as a substring") ) 783 with expansion: 784 "this string contains 'abc' as a substring" matches "contains 'abc' as a 785 substring" case sensitively 786 787 Matchers.tests.cpp:<line number>: FAILED: 788 CHECK_THAT( testStringForMatching(), Matches("this string contains 'abc' as a") ) 789 with expansion: 790 "this string contains 'abc' as a substring" matches "this string contains 791 'abc' as a" case sensitively 792 793 A string sent directly to stdout 794 A string sent directly to stderr 795 A string sent to stderr via clog 796 Message from section one 797 Message from section two 798 ------------------------------------------------------------------------------- 799 StartsWith string matcher 800 ------------------------------------------------------------------------------- 801 Matchers.tests.cpp:<line number> 802 ............................................................................... 803 804 Matchers.tests.cpp:<line number>: FAILED: 805 CHECK_THAT( testStringForMatching(), StartsWith("This String") ) 806 with expansion: 807 "this string contains 'abc' as a substring" starts with: "This String" 808 809 Matchers.tests.cpp:<line number>: FAILED: 810 CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) ) 811 with expansion: 812 "this string contains 'abc' as a substring" starts with: "string" (case 813 insensitive) 814 815 ------------------------------------------------------------------------------- 816 Tabs and newlines show in output 817 ------------------------------------------------------------------------------- 818 Misc.tests.cpp:<line number> 819 ............................................................................... 820 821 Misc.tests.cpp:<line number>: FAILED: 822 CHECK( s1 == s2 ) 823 with expansion: 824 "if ($b == 10) { 825 $a = 20; 826 }" 827 == 828 "if ($b == 10) { 829 $a = 20; 830 } 831 " 832 833 ------------------------------------------------------------------------------- 834 Thrown string literals are translated 835 ------------------------------------------------------------------------------- 836 Exception.tests.cpp:<line number> 837 ............................................................................... 838 839 Exception.tests.cpp:<line number>: FAILED: 840 due to unexpected exception with message: 841 For some reason someone is throwing a string literal! 842 843 ------------------------------------------------------------------------------- 844 Unexpected exceptions can be translated 845 ------------------------------------------------------------------------------- 846 Exception.tests.cpp:<line number> 847 ............................................................................... 848 849 Exception.tests.cpp:<line number>: FAILED: 850 due to unexpected exception with message: 851 3.14 852 853 ------------------------------------------------------------------------------- 854 Vector matchers that fail 855 Contains (element) 856 ------------------------------------------------------------------------------- 857 Matchers.tests.cpp:<line number> 858 ............................................................................... 859 860 Matchers.tests.cpp:<line number>: FAILED: 861 CHECK_THAT( v, VectorContains(-1) ) 862 with expansion: 863 { 1, 2, 3 } Contains: -1 864 865 Matchers.tests.cpp:<line number>: FAILED: 866 CHECK_THAT( empty, VectorContains(1) ) 867 with expansion: 868 { } Contains: 1 869 870 ------------------------------------------------------------------------------- 871 Vector matchers that fail 872 Contains (vector) 873 ------------------------------------------------------------------------------- 874 Matchers.tests.cpp:<line number> 875 ............................................................................... 876 877 Matchers.tests.cpp:<line number>: FAILED: 878 CHECK_THAT( empty, Contains(v) ) 879 with expansion: 880 { } Contains: { 1, 2, 3 } 881 882 Matchers.tests.cpp:<line number>: FAILED: 883 CHECK_THAT( v, Contains(v2) ) 884 with expansion: 885 { 1, 2, 3 } Contains: { 1, 2, 4 } 886 887 ------------------------------------------------------------------------------- 888 Vector matchers that fail 889 Equals 890 ------------------------------------------------------------------------------- 891 Matchers.tests.cpp:<line number> 892 ............................................................................... 893 894 Matchers.tests.cpp:<line number>: FAILED: 895 CHECK_THAT( v, Equals(v2) ) 896 with expansion: 897 { 1, 2, 3 } Equals: { 1, 2 } 898 899 Matchers.tests.cpp:<line number>: FAILED: 900 CHECK_THAT( v2, Equals(v) ) 901 with expansion: 902 { 1, 2 } Equals: { 1, 2, 3 } 903 904 Matchers.tests.cpp:<line number>: FAILED: 905 CHECK_THAT( empty, Equals(v) ) 906 with expansion: 907 { } Equals: { 1, 2, 3 } 908 909 Matchers.tests.cpp:<line number>: FAILED: 910 CHECK_THAT( v, Equals(empty) ) 911 with expansion: 912 { 1, 2, 3 } Equals: { } 913 914 ------------------------------------------------------------------------------- 915 Vector matchers that fail 916 UnorderedEquals 917 ------------------------------------------------------------------------------- 918 Matchers.tests.cpp:<line number> 919 ............................................................................... 920 921 Matchers.tests.cpp:<line number>: FAILED: 922 CHECK_THAT( v, UnorderedEquals(empty) ) 923 with expansion: 924 { 1, 2, 3 } UnorderedEquals: { } 925 926 Matchers.tests.cpp:<line number>: FAILED: 927 CHECK_THAT( empty, UnorderedEquals(v) ) 928 with expansion: 929 { } UnorderedEquals: { 1, 2, 3 } 930 931 Matchers.tests.cpp:<line number>: FAILED: 932 CHECK_THAT( permuted, UnorderedEquals(v) ) 933 with expansion: 934 { 1, 3 } UnorderedEquals: { 1, 2, 3 } 935 936 Matchers.tests.cpp:<line number>: FAILED: 937 CHECK_THAT( permuted, UnorderedEquals(v) ) 938 with expansion: 939 { 3, 1 } UnorderedEquals: { 1, 2, 3 } 940 941 ------------------------------------------------------------------------------- 942 When unchecked exceptions are thrown directly they are always failures 943 ------------------------------------------------------------------------------- 944 Exception.tests.cpp:<line number> 945 ............................................................................... 946 947 Exception.tests.cpp:<line number>: FAILED: 948 due to unexpected exception with message: 949 unexpected exception 950 951 ------------------------------------------------------------------------------- 952 When unchecked exceptions are thrown during a CHECK the test should continue 953 ------------------------------------------------------------------------------- 954 Exception.tests.cpp:<line number> 955 ............................................................................... 956 957 Exception.tests.cpp:<line number>: FAILED: 958 CHECK( thisThrows() == 0 ) 959 due to unexpected exception with message: 960 expected exception 961 962 ------------------------------------------------------------------------------- 963 When unchecked exceptions are thrown during a REQUIRE the test should abort 964 fail 965 ------------------------------------------------------------------------------- 966 Exception.tests.cpp:<line number> 967 ............................................................................... 968 969 Exception.tests.cpp:<line number>: FAILED: 970 REQUIRE( thisThrows() == 0 ) 971 due to unexpected exception with message: 972 expected exception 973 974 ------------------------------------------------------------------------------- 975 When unchecked exceptions are thrown from functions they are always failures 976 ------------------------------------------------------------------------------- 977 Exception.tests.cpp:<line number> 978 ............................................................................... 979 980 Exception.tests.cpp:<line number>: FAILED: 981 CHECK( thisThrows() == 0 ) 982 due to unexpected exception with message: 983 expected exception 984 985 ------------------------------------------------------------------------------- 986 When unchecked exceptions are thrown from sections they are always failures 987 section name 988 ------------------------------------------------------------------------------- 989 Exception.tests.cpp:<line number> 990 ............................................................................... 991 992 Exception.tests.cpp:<line number>: FAILED: 993 due to unexpected exception with message: 994 unexpected exception 995 996 ------------------------------------------------------------------------------- 997 Where the LHS is not a simple value 998 ------------------------------------------------------------------------------- 999 Tricky.tests.cpp:<line number> 1000 ............................................................................... 1001 1002 Tricky.tests.cpp:<line number>: warning: 1003 Uncomment the code in this test to check that it gives a sensible compiler 1004 error 1005 1006 ------------------------------------------------------------------------------- 1007 Where there is more to the expression after the RHS 1008 ------------------------------------------------------------------------------- 1009 Tricky.tests.cpp:<line number> 1010 ............................................................................... 1011 1012 Tricky.tests.cpp:<line number>: warning: 1013 Uncomment the code in this test to check that it gives a sensible compiler 1014 error 1015 1016 ------------------------------------------------------------------------------- 1017 checkedElse, failing 1018 ------------------------------------------------------------------------------- 1019 Misc.tests.cpp:<line number> 1020 ............................................................................... 1021 1022 Misc.tests.cpp:<line number>: FAILED: 1023 CHECKED_ELSE( flag ) 1024 with expansion: 1025 false 1026 1027 Misc.tests.cpp:<line number>: FAILED: 1028 REQUIRE( testCheckedElse( false ) ) 1029 with expansion: 1030 false 1031 1032 ------------------------------------------------------------------------------- 1033 checkedIf, failing 1034 ------------------------------------------------------------------------------- 1035 Misc.tests.cpp:<line number> 1036 ............................................................................... 1037 1038 Misc.tests.cpp:<line number>: FAILED: 1039 CHECKED_IF( flag ) 1040 with expansion: 1041 false 1042 1043 Misc.tests.cpp:<line number>: FAILED: 1044 REQUIRE( testCheckedIf( false ) ) 1045 with expansion: 1046 false 1047 1048 loose text artifact 1049 ------------------------------------------------------------------------------- 1050 just failure 1051 ------------------------------------------------------------------------------- 1052 Message.tests.cpp:<line number> 1053 ............................................................................... 1054 1055 Message.tests.cpp:<line number>: FAILED: 1056 explicitly with message: 1057 Previous info should not be seen 1058 1059 ------------------------------------------------------------------------------- 1060 just failure after unscoped info 1061 ------------------------------------------------------------------------------- 1062 Message.tests.cpp:<line number> 1063 ............................................................................... 1064 1065 Message.tests.cpp:<line number>: FAILED: 1066 explicitly with message: 1067 previous unscoped info SHOULD not be seen 1068 1069 ------------------------------------------------------------------------------- 1070 looped SECTION tests 1071 b is currently: 0 1072 ------------------------------------------------------------------------------- 1073 Misc.tests.cpp:<line number> 1074 ............................................................................... 1075 1076 Misc.tests.cpp:<line number>: FAILED: 1077 CHECK( b > a ) 1078 with expansion: 1079 0 > 1 1080 1081 ------------------------------------------------------------------------------- 1082 looped SECTION tests 1083 b is currently: 1 1084 ------------------------------------------------------------------------------- 1085 Misc.tests.cpp:<line number> 1086 ............................................................................... 1087 1088 Misc.tests.cpp:<line number>: FAILED: 1089 CHECK( b > a ) 1090 with expansion: 1091 1 > 1 1092 1093 ------------------------------------------------------------------------------- 1094 looped tests 1095 ------------------------------------------------------------------------------- 1096 Misc.tests.cpp:<line number> 1097 ............................................................................... 1098 1099 Misc.tests.cpp:<line number>: FAILED: 1100 CHECK( ( fib[i] % 2 ) == 0 ) 1101 with expansion: 1102 1 == 0 1103 with message: 1104 Testing if fib[0] (1) is even 1105 1106 Misc.tests.cpp:<line number>: FAILED: 1107 CHECK( ( fib[i] % 2 ) == 0 ) 1108 with expansion: 1109 1 == 0 1110 with message: 1111 Testing if fib[1] (1) is even 1112 1113 Misc.tests.cpp:<line number>: FAILED: 1114 CHECK( ( fib[i] % 2 ) == 0 ) 1115 with expansion: 1116 1 == 0 1117 with message: 1118 Testing if fib[3] (3) is even 1119 1120 Misc.tests.cpp:<line number>: FAILED: 1121 CHECK( ( fib[i] % 2 ) == 0 ) 1122 with expansion: 1123 1 == 0 1124 with message: 1125 Testing if fib[4] (5) is even 1126 1127 Misc.tests.cpp:<line number>: FAILED: 1128 CHECK( ( fib[i] % 2 ) == 0 ) 1129 with expansion: 1130 1 == 0 1131 with message: 1132 Testing if fib[6] (13) is even 1133 1134 Misc.tests.cpp:<line number>: FAILED: 1135 CHECK( ( fib[i] % 2 ) == 0 ) 1136 with expansion: 1137 1 == 0 1138 with message: 1139 Testing if fib[7] (21) is even 1140 1141 ------------------------------------------------------------------------------- 1142 mix info, unscoped info and warning 1143 ------------------------------------------------------------------------------- 1144 Message.tests.cpp:<line number> 1145 ............................................................................... 1146 1147 Message.tests.cpp:<line number>: warning: 1148 and warn may mix 1149 1150 Message.tests.cpp:<line number>: warning: 1151 they are not cleared after warnings 1152 1153 ------------------------------------------------------------------------------- 1154 more nested SECTION tests 1155 doesn't equal 1156 equal 1157 ------------------------------------------------------------------------------- 1158 Misc.tests.cpp:<line number> 1159 ............................................................................... 1160 1161 Misc.tests.cpp:<line number>: FAILED: 1162 REQUIRE( a == b ) 1163 with expansion: 1164 1 == 2 1165 1166 ------------------------------------------------------------------------------- 1167 not prints unscoped info from previous failures 1168 ------------------------------------------------------------------------------- 1169 Message.tests.cpp:<line number> 1170 ............................................................................... 1171 1172 Message.tests.cpp:<line number>: FAILED: 1173 REQUIRE( false ) 1174 with message: 1175 this SHOULD be seen 1176 1177 ------------------------------------------------------------------------------- 1178 prints unscoped info on failure 1179 ------------------------------------------------------------------------------- 1180 Message.tests.cpp:<line number> 1181 ............................................................................... 1182 1183 Message.tests.cpp:<line number>: FAILED: 1184 REQUIRE( false ) 1185 with messages: 1186 this SHOULD be seen 1187 this SHOULD also be seen 1188 1189 ------------------------------------------------------------------------------- 1190 prints unscoped info only for the first assertion 1191 ------------------------------------------------------------------------------- 1192 Message.tests.cpp:<line number> 1193 ............................................................................... 1194 1195 Message.tests.cpp:<line number>: FAILED: 1196 CHECK( false ) 1197 with message: 1198 this SHOULD be seen only ONCE 1199 1200 ------------------------------------------------------------------------------- 1201 send a single char to INFO 1202 ------------------------------------------------------------------------------- 1203 Misc.tests.cpp:<line number> 1204 ............................................................................... 1205 1206 Misc.tests.cpp:<line number>: FAILED: 1207 REQUIRE( false ) 1208 with message: 1209 3 1210 1211 ------------------------------------------------------------------------------- 1212 sends information to INFO 1213 ------------------------------------------------------------------------------- 1214 Message.tests.cpp:<line number> 1215 ............................................................................... 1216 1217 Message.tests.cpp:<line number>: FAILED: 1218 REQUIRE( false ) 1219 with messages: 1220 hi 1221 i := 7 1222 1223 ------------------------------------------------------------------------------- 1224 stacks unscoped info in loops 1225 ------------------------------------------------------------------------------- 1226 Message.tests.cpp:<line number> 1227 ............................................................................... 1228 1229 Message.tests.cpp:<line number>: FAILED: 1230 CHECK( false ) 1231 with messages: 1232 Count 1 to 3... 1233 1 1234 2 1235 3 1236 1237 Message.tests.cpp:<line number>: FAILED: 1238 CHECK( false ) 1239 with messages: 1240 Count 4 to 6... 1241 4 1242 5 1243 6 1244 1245 ------------------------------------------------------------------------------- 1246 string literals of different sizes can be compared 1247 ------------------------------------------------------------------------------- 1248 Tricky.tests.cpp:<line number> 1249 ............................................................................... 1250 1251 Tricky.tests.cpp:<line number>: FAILED: 1252 REQUIRE( std::string( "first" ) == "second" ) 1253 with expansion: 1254 "first" == "second" 1255 1256 ------------------------------------------------------------------------------- 1257 thrown std::strings are translated 1258 ------------------------------------------------------------------------------- 1259 Exception.tests.cpp:<line number> 1260 ............................................................................... 1261 1262 Exception.tests.cpp:<line number>: FAILED: 1263 due to unexpected exception with message: 1264 Why would you throw a std::string? 1265 1266 =============================================================================== 1267 test cases: 255 | 189 passed | 62 failed | 4 failed as expected 1268 assertions: 1393 | 1250 passed | 122 failed | 21 failed as expected 1269 1270