2013-09-27 20:01:14 +02:00
|
|
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-09-30 09:05:14 +02:00
|
|
|
CatchSelfTest is a <version> host application.
|
2013-09-27 20:01:14 +02:00
|
|
|
Run with -? for options
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
Some simple comparisons between doubles
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d == Approx( 1.23 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 == Approx( 1.23 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d != Approx( 1.22 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 != Approx( 1.22 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d != Approx( 1.24 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 != Approx( 1.24 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( Approx( d ) == 1.23 )
|
|
|
|
with expansion:
|
|
|
|
Approx( 1.23 ) == 1.23
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( Approx( d ) != 1.22 )
|
|
|
|
with expansion:
|
|
|
|
Approx( 1.23 ) != 1.22
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( Approx( d ) != 1.24 )
|
|
|
|
with expansion:
|
|
|
|
Approx( 1.23 ) != 1.24
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
Approximate comparisons with different epsilons
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d != Approx( 1.231 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 != Approx( 1.231 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d == Approx( 1.231 ).epsilon( 0.1 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 == Approx( 1.231 )
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
Approximate comparisons with floats
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( 1.23f == Approx( 1.23f ) )
|
|
|
|
with expansion:
|
2013-12-19 19:41:55 +01:00
|
|
|
1.23 == Approx( 1.2300000191 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( 0.0f == Approx( 0.0f ) )
|
|
|
|
with expansion:
|
2013-12-19 19:41:55 +01:00
|
|
|
0 == Approx( 0.0 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
Approximate comparisons with ints
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( 1 == Approx( 1 ) )
|
2013-12-19 19:41:55 +01:00
|
|
|
with expansion:
|
|
|
|
1 == Approx( 1.0 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( 0 == Approx( 0 ) )
|
2013-12-19 19:41:55 +01:00
|
|
|
with expansion:
|
|
|
|
0 == Approx( 0.0 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
Approximate comparisons with mixed numeric types
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( 1.0f == Approx( 1 ) )
|
|
|
|
with expansion:
|
2013-12-19 19:41:55 +01:00
|
|
|
1 == Approx( 1.0 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( 0 == Approx( dZero) )
|
|
|
|
with expansion:
|
2013-12-19 19:41:55 +01:00
|
|
|
0 == Approx( 0.0 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) )
|
|
|
|
with expansion:
|
2013-12-19 19:41:55 +01:00
|
|
|
0 == Approx( 0.00001 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( 1.234f == Approx( dMedium ) )
|
|
|
|
with expansion:
|
|
|
|
1.234 == Approx( 1.234 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( dMedium == Approx( 1.234f ) )
|
|
|
|
with expansion:
|
2013-12-19 19:41:55 +01:00
|
|
|
1.234 == Approx( 1.2339999676 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
Use a custom approx
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d == approx( 1.23 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 == Approx( 1.23 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d == approx( 1.22 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 == Approx( 1.22 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d == approx( 1.24 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 == Approx( 1.24 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( d != approx( 1.25 ) )
|
|
|
|
with expansion:
|
|
|
|
1.23 != Approx( 1.25 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( approx( d ) == 1.23 )
|
|
|
|
with expansion:
|
|
|
|
Approx( 1.23 ) == 1.23
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( approx( d ) == 1.22 )
|
|
|
|
with expansion:
|
|
|
|
Approx( 1.23 ) == 1.22
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( approx( d ) == 1.24 )
|
|
|
|
with expansion:
|
|
|
|
Approx( 1.23 ) == 1.24
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( approx( d ) != 1.25 )
|
|
|
|
with expansion:
|
|
|
|
Approx( 1.23 ) != 1.25
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
Approximate PI
|
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) )
|
|
|
|
with expansion:
|
|
|
|
3.1428571429 == Approx( 3.141 )
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ApproxTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) )
|
|
|
|
with expansion:
|
|
|
|
3.1428571429 != Approx( 3.141 )
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
A METHOD_AS_TEST_CASE based test run that succeeds
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ClassTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ClassTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( s == "hello" )
|
|
|
|
with expansion:
|
|
|
|
"hello" == "hello"
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
A METHOD_AS_TEST_CASE based test run that fails
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ClassTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ClassTests.cpp:<line number>: FAILED:
|
2013-09-27 20:01:14 +02:00
|
|
|
REQUIRE( s == "world" )
|
|
|
|
with expansion:
|
|
|
|
"hello" == "world"
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
A TEST_CASE_METHOD based test run that succeeds
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ClassTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ClassTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( m_a == 1 )
|
|
|
|
with expansion:
|
|
|
|
1 == 1
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
A TEST_CASE_METHOD based test run that fails
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ClassTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ClassTests.cpp:<line number>: FAILED:
|
2013-09-27 20:01:14 +02:00
|
|
|
REQUIRE( m_a == 2 )
|
|
|
|
with expansion:
|
|
|
|
1 == 2
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2013-11-19 08:21:03 +01:00
|
|
|
Equality checks that should succeed
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( data.int_seven == 7 )
|
|
|
|
with expansion:
|
|
|
|
7 == 7
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( data.float_nine_point_one == Approx( 9.1f ) )
|
|
|
|
with expansion:
|
2013-12-19 19:41:55 +01:00
|
|
|
9.1 == Approx( 9.1000003815 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( data.double_pi == Approx( 3.1415926535 ) )
|
|
|
|
with expansion:
|
2013-12-19 19:41:55 +01:00
|
|
|
3.1415926535 == Approx( 3.1415926535 )
|
2013-09-27 20:01:14 +02:00
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( data.str_hello == "hello" )
|
|
|
|
with expansion:
|
|
|
|
"hello" == "hello"
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( "hello" == data.str_hello )
|
|
|
|
with expansion:
|
|
|
|
"hello" == "hello"
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( data.str_hello.size() == 5 )
|
|
|
|
with expansion:
|
|
|
|
5 == 5
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>:
|
2013-09-27 20:01:14 +02:00
|
|
|
PASSED:
|
|
|
|
REQUIRE( x == Approx( 1.3 ) )
|
|
|
|
with expansion:
|
|
|
|
1.3 == Approx( 1.3 )
|
|
|
|
|
|
|
|
-------------------------------------------------------------------------------
|
2014-05-20 19:11:43 +02:00
|
|
|
Equality checks that should fail
|
2013-09-27 20:01:14 +02:00
|
|
|
-------------------------------------------------------------------------------
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>
|
2013-09-27 20:01:14 +02:00
|
|
|
...............................................................................
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
2013-09-27 20:01:14 +02:00
|
|
|
CHECK( data.int_seven == 6 )
|
|
|
|
with expansion:
|
|
|
|
7 == 6
|
|
|
|
|
2013-09-30 09:01:10 +02:00
|
|
|
ConditionTests.cpp:<line number>: FAILED:
|
2013-09-27 20:01:14 +02:00
|
|
|
CHECK( data.int_seven == 8 )
|
|
|
|
with expansion:
|
|
|
|
7 == 8
|
|
|
|
|
|
|
|
===============================================================================
|
|
|
|
13 test cases - 3 failed (40 assertions - 4 failed)
|
|
|
|
|