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