mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-27 05:03:30 +01:00
792 lines
25 KiB
Plaintext
792 lines
25 KiB
Plaintext
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
CatchSelfTest is a <version> (develop) host application.
|
|
Run with -? for options
|
|
|
|
-------------------------------------------------------------------------------
|
|
A METHOD_AS_TEST_CASE based test run that fails
|
|
-------------------------------------------------------------------------------
|
|
ClassTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ClassTests.cpp:<line number>: FAILED:
|
|
REQUIRE( s == "world" )
|
|
with expansion:
|
|
"hello" == "world"
|
|
|
|
-------------------------------------------------------------------------------
|
|
A TEST_CASE_METHOD based test run that fails
|
|
-------------------------------------------------------------------------------
|
|
ClassTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ClassTests.cpp:<line number>: FAILED:
|
|
REQUIRE( m_a == 2 )
|
|
with expansion:
|
|
1 == 2
|
|
|
|
-------------------------------------------------------------------------------
|
|
Equality checks that should fail
|
|
-------------------------------------------------------------------------------
|
|
ConditionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven == 6 )
|
|
with expansion:
|
|
7 == 6
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven == 8 )
|
|
with expansion:
|
|
7 == 8
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven == 0 )
|
|
with expansion:
|
|
7 == 0
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.float_nine_point_one == Approx( 9.11f ) )
|
|
with expansion:
|
|
9.1f == Approx( 9.1099996567 )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.float_nine_point_one == Approx( 9.0f ) )
|
|
with expansion:
|
|
9.1f == Approx( 9.0 )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.float_nine_point_one == Approx( 1 ) )
|
|
with expansion:
|
|
9.1f == Approx( 1.0 )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.float_nine_point_one == Approx( 0 ) )
|
|
with expansion:
|
|
9.1f == Approx( 0.0 )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.double_pi == Approx( 3.1415 ) )
|
|
with expansion:
|
|
3.1415926535 == Approx( 3.1415 )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello == "goodbye" )
|
|
with expansion:
|
|
"hello" == "goodbye"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello == "hell" )
|
|
with expansion:
|
|
"hello" == "hell"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello == "hello1" )
|
|
with expansion:
|
|
"hello" == "hello1"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello.size() == 6 )
|
|
with expansion:
|
|
5 == 6
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( x == Approx( 1.301 ) )
|
|
with expansion:
|
|
1.3 == Approx( 1.301 )
|
|
|
|
-------------------------------------------------------------------------------
|
|
Inequality checks that should fail
|
|
-------------------------------------------------------------------------------
|
|
ConditionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven != 7 )
|
|
with expansion:
|
|
7 != 7
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.float_nine_point_one != Approx( 9.1f ) )
|
|
with expansion:
|
|
9.1f != Approx( 9.1000003815 )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.double_pi != Approx( 3.1415926535 ) )
|
|
with expansion:
|
|
3.1415926535 != Approx( 3.1415926535 )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello != "hello" )
|
|
with expansion:
|
|
"hello" != "hello"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello.size() != 5 )
|
|
with expansion:
|
|
5 != 5
|
|
|
|
-------------------------------------------------------------------------------
|
|
Ordering comparison checks that should fail
|
|
-------------------------------------------------------------------------------
|
|
ConditionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven > 7 )
|
|
with expansion:
|
|
7 > 7
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven < 7 )
|
|
with expansion:
|
|
7 < 7
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven > 8 )
|
|
with expansion:
|
|
7 > 8
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven < 6 )
|
|
with expansion:
|
|
7 < 6
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven < 0 )
|
|
with expansion:
|
|
7 < 0
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven < -1 )
|
|
with expansion:
|
|
7 < -1
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven >= 8 )
|
|
with expansion:
|
|
7 >= 8
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.int_seven <= 6 )
|
|
with expansion:
|
|
7 <= 6
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.float_nine_point_one < 9 )
|
|
with expansion:
|
|
9.1f < 9
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.float_nine_point_one > 10 )
|
|
with expansion:
|
|
9.1f > 10
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.float_nine_point_one > 9.2 )
|
|
with expansion:
|
|
9.1f > 9.2
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello > "hello" )
|
|
with expansion:
|
|
"hello" > "hello"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello < "hello" )
|
|
with expansion:
|
|
"hello" < "hello"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello > "hellp" )
|
|
with expansion:
|
|
"hello" > "hellp"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello > "z" )
|
|
with expansion:
|
|
"hello" > "z"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello < "hellm" )
|
|
with expansion:
|
|
"hello" < "hellm"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello < "a" )
|
|
with expansion:
|
|
"hello" < "a"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello >= "z" )
|
|
with expansion:
|
|
"hello" >= "z"
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( data.str_hello <= "a" )
|
|
with expansion:
|
|
"hello" <= "a"
|
|
|
|
-------------------------------------------------------------------------------
|
|
'Not' checks that should fail
|
|
-------------------------------------------------------------------------------
|
|
ConditionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( false != false )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( true != true )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( !true )
|
|
with expansion:
|
|
false
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK_FALSE( true )
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( !trueValue )
|
|
with expansion:
|
|
false
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK_FALSE( trueValue )
|
|
with expansion:
|
|
!true
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK( !(1 == 1) )
|
|
with expansion:
|
|
false
|
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
|
CHECK_FALSE( 1 == 1 )
|
|
with expansion:
|
|
!(1 == 1)
|
|
|
|
-------------------------------------------------------------------------------
|
|
Expected exceptions that don't throw or unexpected exceptions fail the test
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
CHECK_THROWS_AS( thisThrows() )
|
|
due to unexpected exception with message:
|
|
expected exception
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
CHECK_THROWS_AS( thisDoesntThrow() )
|
|
because no exception was thrown where one was expected:
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
CHECK_NOTHROW( thisThrows() )
|
|
due to unexpected exception with message:
|
|
expected exception
|
|
|
|
-------------------------------------------------------------------------------
|
|
When unchecked exceptions are thrown directly they are always failures
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
due to unexpected exception with message:
|
|
unexpected exception
|
|
|
|
-------------------------------------------------------------------------------
|
|
An unchecked exception reports the line of the last assertion
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
{Unknown expression after the reported line}
|
|
due to unexpected exception with message:
|
|
unexpected exception
|
|
|
|
-------------------------------------------------------------------------------
|
|
When unchecked exceptions are thrown from sections they are always failures
|
|
section name
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
due to unexpected exception with message:
|
|
unexpected exception
|
|
|
|
-------------------------------------------------------------------------------
|
|
When unchecked exceptions are thrown from functions they are always failures
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
CHECK( thisThrows() == 0 )
|
|
due to unexpected exception with message:
|
|
expected exception
|
|
|
|
-------------------------------------------------------------------------------
|
|
When unchecked exceptions are thrown during a REQUIRE the test should abort
|
|
fail
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
REQUIRE( thisThrows() == 0 )
|
|
due to unexpected exception with message:
|
|
expected exception
|
|
|
|
-------------------------------------------------------------------------------
|
|
When unchecked exceptions are thrown during a CHECK the test should abort and
|
|
fail
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
CHECK( thisThrows() == 0 )
|
|
due to unexpected exception with message:
|
|
expected exception
|
|
|
|
-------------------------------------------------------------------------------
|
|
Unexpected custom exceptions can be translated
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
due to unexpected exception with message:
|
|
custom exception
|
|
|
|
-------------------------------------------------------------------------------
|
|
Custom exceptions can be translated when testing for nothrow
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
REQUIRE_NOTHROW( throwCustom() )
|
|
due to unexpected exception with message:
|
|
custom exception - not std
|
|
|
|
-------------------------------------------------------------------------------
|
|
Custom exceptions can be translated when testing for throwing as something else
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
REQUIRE_THROWS_AS( throwCustom() )
|
|
due to unexpected exception with message:
|
|
custom exception - not std
|
|
|
|
-------------------------------------------------------------------------------
|
|
Unexpected exceptions can be translated
|
|
-------------------------------------------------------------------------------
|
|
ExceptionTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
ExceptionTests.cpp:<line number>: FAILED:
|
|
due to unexpected exception with message:
|
|
3.14
|
|
|
|
-------------------------------------------------------------------------------
|
|
INFO and WARN do not abort tests
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>:
|
|
warning:
|
|
this is a warning
|
|
|
|
-------------------------------------------------------------------------------
|
|
INFO gets logged on failure
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
REQUIRE( a == 1 )
|
|
with expansion:
|
|
2 == 1
|
|
with messages:
|
|
this message should be logged
|
|
so should this
|
|
|
|
-------------------------------------------------------------------------------
|
|
INFO gets logged on failure, even if captured before successful assertions
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
CHECK( a == 1 )
|
|
with expansion:
|
|
2 == 1
|
|
with messages:
|
|
this message may be logged later
|
|
this message should be logged
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
CHECK( a == 0 )
|
|
with expansion:
|
|
2 == 0
|
|
with message:
|
|
and this, but later
|
|
|
|
-------------------------------------------------------------------------------
|
|
FAIL aborts the test
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
explicitly with message:
|
|
This is a failure
|
|
|
|
-------------------------------------------------------------------------------
|
|
FAIL does not require an argument
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
|
|
-------------------------------------------------------------------------------
|
|
Output from all sections is reported
|
|
one
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
explicitly with message:
|
|
Message from section one
|
|
|
|
-------------------------------------------------------------------------------
|
|
Output from all sections is reported
|
|
two
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
explicitly with message:
|
|
Message from section two
|
|
|
|
Message from section one
|
|
Message from section two
|
|
-------------------------------------------------------------------------------
|
|
SCOPED_INFO is reset for each loop
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
REQUIRE( i < 10 )
|
|
with expansion:
|
|
10 < 10
|
|
with messages:
|
|
current counter 10
|
|
i := 10
|
|
|
|
-------------------------------------------------------------------------------
|
|
just failure
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
explicitly with message:
|
|
Previous info should not be seen
|
|
|
|
-------------------------------------------------------------------------------
|
|
sends information to INFO
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>: FAILED:
|
|
REQUIRE( false )
|
|
with messages:
|
|
hi
|
|
i := 7
|
|
|
|
-------------------------------------------------------------------------------
|
|
Pointers can be converted to strings
|
|
-------------------------------------------------------------------------------
|
|
MessageTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MessageTests.cpp:<line number>:
|
|
warning:
|
|
actual address of p: 0x<hex digits>
|
|
|
|
MessageTests.cpp:<line number>:
|
|
warning:
|
|
toString(p): 0x<hex digits>
|
|
|
|
-------------------------------------------------------------------------------
|
|
more nested SECTION tests
|
|
s1
|
|
s2
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
REQUIRE( a == b )
|
|
with expansion:
|
|
1 == 2
|
|
|
|
-------------------------------------------------------------------------------
|
|
looped SECTION tests
|
|
s1
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK( b > a )
|
|
with expansion:
|
|
0 > 1
|
|
|
|
-------------------------------------------------------------------------------
|
|
looped tests
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK( ( fib[i] % 2 ) == 0 )
|
|
with expansion:
|
|
1 == 0
|
|
with message:
|
|
Testing if fib[0] (1) is even
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK( ( fib[i] % 2 ) == 0 )
|
|
with expansion:
|
|
1 == 0
|
|
with message:
|
|
Testing if fib[1] (1) is even
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK( ( fib[i] % 2 ) == 0 )
|
|
with expansion:
|
|
1 == 0
|
|
with message:
|
|
Testing if fib[3] (3) is even
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK( ( fib[i] % 2 ) == 0 )
|
|
with expansion:
|
|
1 == 0
|
|
with message:
|
|
Testing if fib[4] (5) is even
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK( ( fib[i] % 2 ) == 0 )
|
|
with expansion:
|
|
1 == 0
|
|
with message:
|
|
Testing if fib[6] (13) is even
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK( ( fib[i] % 2 ) == 0 )
|
|
with expansion:
|
|
1 == 0
|
|
with message:
|
|
Testing if fib[7] (21) is even
|
|
|
|
A string sent directly to stdout
|
|
A string sent directly to stderr
|
|
-------------------------------------------------------------------------------
|
|
checkedIf, failing
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECKED_IF( flag )
|
|
with expansion:
|
|
false
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
REQUIRE( testCheckedIf( false ) )
|
|
with expansion:
|
|
false
|
|
|
|
-------------------------------------------------------------------------------
|
|
checkedElse, failing
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECKED_ELSE( flag )
|
|
with expansion:
|
|
false
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
REQUIRE( testCheckedElse( false ) )
|
|
with expansion:
|
|
false
|
|
|
|
-------------------------------------------------------------------------------
|
|
send a single char to INFO
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
REQUIRE( false )
|
|
with message:
|
|
3
|
|
|
|
-------------------------------------------------------------------------------
|
|
Contains string matcher
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK_THAT( testStringForMatching() Contains( "not there" ) )
|
|
with expansion:
|
|
"this string contains 'abc' as a substring" contains: "not there"
|
|
|
|
-------------------------------------------------------------------------------
|
|
StartsWith string matcher
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK_THAT( testStringForMatching() StartsWith( "string" ) )
|
|
with expansion:
|
|
"this string contains 'abc' as a substring" starts with: "string"
|
|
|
|
-------------------------------------------------------------------------------
|
|
EndsWith string matcher
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK_THAT( testStringForMatching() EndsWith( "this" ) )
|
|
with expansion:
|
|
"this string contains 'abc' as a substring" ends with: "this"
|
|
|
|
-------------------------------------------------------------------------------
|
|
Equals string matcher
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK_THAT( testStringForMatching() Equals( "something else" ) )
|
|
with expansion:
|
|
"this string contains 'abc' as a substring" equals: "something else"
|
|
|
|
-------------------------------------------------------------------------------
|
|
Nice descriptive name
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>:
|
|
warning:
|
|
This one ran
|
|
|
|
-------------------------------------------------------------------------------
|
|
A couple of nested sections followed by a failure
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
explicitly with message:
|
|
to infinity and beyond
|
|
|
|
-------------------------------------------------------------------------------
|
|
Tabs and newlines show in output
|
|
-------------------------------------------------------------------------------
|
|
MiscTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
MiscTests.cpp:<line number>: FAILED:
|
|
CHECK( s1 == s2 )
|
|
with expansion:
|
|
"if ($b == 10) {
|
|
$a= 20;
|
|
}"
|
|
==
|
|
"if ($b == 10) {
|
|
$a = 20;
|
|
}
|
|
"
|
|
|
|
hello
|
|
hello
|
|
-------------------------------------------------------------------------------
|
|
Where the is more to the expression after the RHS[failing]
|
|
-------------------------------------------------------------------------------
|
|
TrickyTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
TrickyTests.cpp:<line number>:
|
|
warning:
|
|
Uncomment the code in this test to check that it gives a sensible compiler
|
|
error
|
|
|
|
-------------------------------------------------------------------------------
|
|
Where the LHS is not a simple value[failing]
|
|
-------------------------------------------------------------------------------
|
|
TrickyTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
TrickyTests.cpp:<line number>:
|
|
warning:
|
|
Uncomment the code in this test to check that it gives a sensible compiler
|
|
error
|
|
|
|
-------------------------------------------------------------------------------
|
|
A failing expression with a non streamable type is still captured[failing]
|
|
-------------------------------------------------------------------------------
|
|
TrickyTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
TrickyTests.cpp:<line number>: FAILED:
|
|
CHECK( &o1 == &o2 )
|
|
with expansion:
|
|
0x<hex digits> == 0x<hex digits>
|
|
|
|
TrickyTests.cpp:<line number>: FAILED:
|
|
CHECK( o1 == o2 )
|
|
with expansion:
|
|
{?} == {?}
|
|
|
|
-------------------------------------------------------------------------------
|
|
string literals of different sizes can be compared[failing]
|
|
-------------------------------------------------------------------------------
|
|
TrickyTests.cpp:<line number>
|
|
...............................................................................
|
|
|
|
TrickyTests.cpp:<line number>: FAILED:
|
|
REQUIRE( std::string( "first" ) == "second" )
|
|
with expansion:
|
|
"first" == "second"
|
|
|
|
===============================================================================
|
|
test cases: 148 | 109 passed | 38 failed | 1 failed as expected
|
|
assertions: 739 | 647 passed | 79 failed | 13 failed as expected
|
|
|