For example:
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
using namespace Catch;
TEST_CASE( "show current matchers", "" )
{
REQUIRE_THAT( "abc",
AllOf(
StartsWith("a")
, Contains("b")
, Equals("abc")
// , EndsWith("c" ) // up to 3 arguments
) );
REQUIRE_THAT( "abc",
AnyOf(
StartsWith("c")
, Contains("b")
, Equals("cba")
// , EndsWith("a" ) // up to 3 arguments
) );
}
// cl -nologo -EHsc -I$(CATCH_HOME) match.cpp && match.exe
// g++ -I$(CATCH_HOME) -o match.exe match.cpp && match.exe
Gives:
match.exe is a Catch v1.0 b8 host application.
Run with -? for options
-------------------------------------------------------------------------------
show current matchers
-------------------------------------------------------------------------------
match.cpp:7
...............................................................................
match.cpp:15:
PASSED:
REQUIRE_THAT( "abc" AllOf( StartsWith("a") , Contains("b") , Equals("abc") ) )
with expansion:
"abc" ( starts with: "a" and contains: "b" and equals: "abc" )
match.cpp:23:
PASSED:
REQUIRE_THAT( "abc" AnyOf( StartsWith("c") , Contains("b") , Equals("cba") ) )
with expansion:
"abc" ( starts with: "c" or contains: "b" or equals: "cba" )
===============================================================================
All tests passed (2 assertions in 1 test case)