2010-11-10 00:24:00 +01:00
|
|
|
/*
|
|
|
|
* Created by Phil on 22/10/2010.
|
|
|
|
* Copyright 2010 Two Blue Cubes Ltd
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TWOBLUECUBES_CATCH_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_HPP_INCLUDED
|
2012-06-03 00:12:42 +02:00
|
|
|
|
2018-01-26 20:27:19 +01:00
|
|
|
#define CATCH_VERSION_MAJOR 2
|
2019-10-13 23:44:18 +02:00
|
|
|
#define CATCH_VERSION_MINOR 10
|
|
|
|
#define CATCH_VERSION_PATCH 0
|
2017-11-14 21:04:36 +01:00
|
|
|
|
2015-05-21 07:15:53 +02:00
|
|
|
#ifdef __clang__
|
|
|
|
# pragma clang system_header
|
|
|
|
#elif defined __GNUC__
|
|
|
|
# pragma GCC system_header
|
|
|
|
#endif
|
|
|
|
|
2014-05-19 19:57:14 +02:00
|
|
|
#include "internal/catch_suppress_warnings.h"
|
2012-08-13 08:46:10 +02:00
|
|
|
|
2014-12-19 18:52:33 +01:00
|
|
|
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
|
|
|
|
# define CATCH_IMPL
|
2017-11-14 21:04:36 +01:00
|
|
|
# define CATCH_CONFIG_ALL_PARTS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// In the impl file, we want to have access to all parts of the headers
|
|
|
|
// Can also be used to sanely support PCHs
|
|
|
|
#if defined(CATCH_CONFIG_ALL_PARTS)
|
2017-08-17 20:21:06 +02:00
|
|
|
# define CATCH_CONFIG_EXTERNAL_INTERFACES
|
2017-08-30 18:06:48 +02:00
|
|
|
# if defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
|
|
# undef CATCH_CONFIG_DISABLE_MATCHERS
|
|
|
|
# endif
|
2018-07-03 09:25:34 +02:00
|
|
|
# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
|
|
|
|
# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
|
|
|
|
# endif
|
2014-03-10 19:02:18 +01:00
|
|
|
#endif
|
|
|
|
|
2017-11-14 21:04:36 +01:00
|
|
|
#if !defined(CATCH_CONFIG_IMPL_ONLY)
|
2017-08-21 14:58:50 +02:00
|
|
|
#include "internal/catch_platform.h"
|
|
|
|
|
2014-12-19 18:52:33 +01:00
|
|
|
#ifdef CATCH_IMPL
|
2014-03-06 22:53:34 +01:00
|
|
|
# ifndef CLARA_CONFIG_MAIN
|
|
|
|
# define CLARA_CONFIG_MAIN_NOT_DEFINED
|
|
|
|
# define CLARA_CONFIG_MAIN
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2017-11-21 11:10:07 +01:00
|
|
|
#include "internal/catch_user_interfaces.h"
|
2017-07-27 11:55:30 +02:00
|
|
|
#include "internal/catch_tag_alias_autoregistrar.h"
|
2017-09-07 12:24:33 +02:00
|
|
|
#include "internal/catch_test_registry.h"
|
2010-11-10 00:24:00 +01:00
|
|
|
#include "internal/catch_capture.hpp"
|
2013-12-03 19:52:41 +01:00
|
|
|
#include "internal/catch_section.h"
|
2011-04-20 16:40:40 +02:00
|
|
|
#include "internal/catch_interfaces_exception.h"
|
2017-09-07 12:24:33 +02:00
|
|
|
#include "internal/catch_approx.h"
|
2013-04-22 09:19:17 +02:00
|
|
|
#include "internal/catch_compiler_capabilities.h"
|
2017-09-06 16:43:26 +02:00
|
|
|
#include "internal/catch_string_manip.h"
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2017-08-09 13:10:14 +02:00
|
|
|
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
|
|
#include "internal/catch_capture_matchers.h"
|
|
|
|
#endif
|
2018-06-12 18:50:39 +02:00
|
|
|
#include "internal/catch_generators.hpp"
|
2019-02-23 20:22:46 +01:00
|
|
|
#include "internal/catch_generators_generic.hpp"
|
2019-02-19 22:09:14 +01:00
|
|
|
#include "internal/catch_generators_specific.hpp"
|
2017-08-09 13:10:14 +02:00
|
|
|
|
2012-06-03 00:12:42 +02:00
|
|
|
// These files are included here so the single_include script doesn't put them
|
|
|
|
// in the conditionally compiled sections
|
2012-08-14 20:30:30 +02:00
|
|
|
#include "internal/catch_test_case_info.h"
|
2012-06-03 00:12:42 +02:00
|
|
|
#include "internal/catch_interfaces_runner.h"
|
|
|
|
|
2011-08-12 19:52:10 +02:00
|
|
|
#ifdef __OBJC__
|
|
|
|
#include "internal/catch_objc.hpp"
|
|
|
|
#endif
|
|
|
|
|
2019-06-17 11:58:40 +02:00
|
|
|
// Benchmarking needs the externally-facing parts of reporters to work
|
|
|
|
#if defined(CATCH_CONFIG_EXTERNAL_INTERFACES) || defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
2017-08-17 20:21:06 +02:00
|
|
|
#include "internal/catch_external_interfaces.h"
|
|
|
|
#endif
|
|
|
|
|
2019-05-19 20:54:44 +02:00
|
|
|
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
|
|
|
#include "internal/benchmark/catch_benchmark.hpp"
|
|
|
|
#endif
|
|
|
|
|
2017-11-14 21:04:36 +01:00
|
|
|
#endif // ! CATCH_CONFIG_IMPL_ONLY
|
|
|
|
|
2014-12-19 18:52:33 +01:00
|
|
|
#ifdef CATCH_IMPL
|
2012-08-06 21:16:53 +02:00
|
|
|
#include "internal/catch_impl.hpp"
|
2014-03-06 22:53:34 +01:00
|
|
|
#endif
|
2011-05-24 09:23:02 +02:00
|
|
|
|
|
|
|
#ifdef CATCH_CONFIG_MAIN
|
|
|
|
#include "internal/catch_default_main.hpp"
|
2014-03-06 22:53:34 +01:00
|
|
|
#endif
|
|
|
|
|
2019-04-23 23:41:13 +02:00
|
|
|
|
2017-11-14 21:04:36 +01:00
|
|
|
#if !defined(CATCH_CONFIG_IMPL_ONLY)
|
2014-03-06 22:53:34 +01:00
|
|
|
|
|
|
|
#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED
|
|
|
|
# undef CLARA_CONFIG_MAIN
|
|
|
|
#endif
|
2011-05-24 09:23:02 +02:00
|
|
|
|
2017-08-27 17:03:32 +02:00
|
|
|
#if !defined(CATCH_CONFIG_DISABLE)
|
2010-11-10 00:24:00 +01:00
|
|
|
//////
|
2012-07-20 19:43:48 +02:00
|
|
|
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
|
|
|
|
#ifdef CATCH_CONFIG_PREFIX_ALL
|
|
|
|
|
2017-04-25 20:20:46 +02:00
|
|
|
#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
|
|
|
#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
|
2012-07-20 19:43:48 +02:00
|
|
|
|
2019-02-08 20:10:46 +01:00
|
|
|
#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
2017-03-21 14:22:39 +01:00
|
|
|
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
|
2017-07-28 21:04:18 +02:00
|
|
|
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
|
2017-08-09 13:10:14 +02:00
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
2017-07-28 21:04:18 +02:00
|
|
|
#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
|
2017-07-28 21:34:34 +02:00
|
|
|
#endif// CATCH_CONFIG_DISABLE_MATCHERS
|
2017-04-25 20:20:46 +02:00
|
|
|
#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
2012-07-20 19:43:48 +02:00
|
|
|
|
2017-04-25 20:20:46 +02:00
|
|
|
#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
|
|
|
|
#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
|
2012-07-20 19:43:48 +02:00
|
|
|
|
2019-02-08 20:10:46 +01:00
|
|
|
#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
2017-03-21 14:22:39 +01:00
|
|
|
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
|
2017-07-28 21:04:18 +02:00
|
|
|
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
2017-08-09 13:10:14 +02:00
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
2017-07-28 21:04:18 +02:00
|
|
|
#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
2017-07-28 21:34:34 +02:00
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
2017-04-25 20:20:46 +02:00
|
|
|
#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
2012-07-20 19:43:48 +02:00
|
|
|
|
2017-07-29 08:43:32 +02:00
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
2017-03-21 14:22:39 +01:00
|
|
|
#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
|
2017-03-17 13:21:40 +01:00
|
|
|
|
2017-03-21 14:22:39 +01:00
|
|
|
#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
2017-07-28 21:34:34 +02:00
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
2012-07-20 19:43:48 +02:00
|
|
|
|
2017-03-21 14:22:39 +01:00
|
|
|
#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
|
2019-04-24 21:51:21 +02:00
|
|
|
#define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "CATCH_UNSCOPED_INFO", msg )
|
2017-03-21 14:22:39 +01:00
|
|
|
#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
|
2018-06-27 22:34:35 +02:00
|
|
|
#define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CATCH_CAPTURE",__VA_ARGS__ )
|
2012-07-20 19:43:48 +02:00
|
|
|
|
2017-04-25 12:41:30 +02:00
|
|
|
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
|
|
|
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
|
|
|
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
|
|
|
#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
|
|
|
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
2018-06-25 20:19:21 +02:00
|
|
|
#define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )
|
2017-04-28 18:33:52 +02:00
|
|
|
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
2017-04-25 12:41:30 +02:00
|
|
|
#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
2012-07-20 19:43:48 +02:00
|
|
|
|
2018-11-08 07:26:39 +01:00
|
|
|
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
|
|
|
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ )
|
2018-11-08 07:26:39 +01:00
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )
|
2018-11-08 07:26:39 +01:00
|
|
|
#else
|
|
|
|
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) )
|
2018-11-08 07:26:39 +01:00
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )
|
2018-11-08 07:26:39 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2018-10-13 21:29:59 +02:00
|
|
|
#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
|
|
|
|
#define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ )
|
|
|
|
#define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ )
|
|
|
|
#else
|
|
|
|
#define CATCH_STATIC_REQUIRE( ... ) CATCH_REQUIRE( __VA_ARGS__ )
|
|
|
|
#define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ )
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-03-13 13:19:30 +01:00
|
|
|
// "BDD-style" convenience wrappers
|
2013-03-16 21:39:19 +01:00
|
|
|
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
2014-07-10 11:22:20 +02:00
|
|
|
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
2018-08-14 11:49:55 +02:00
|
|
|
#define CATCH_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc )
|
|
|
|
#define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc )
|
|
|
|
#define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc )
|
|
|
|
#define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc )
|
|
|
|
#define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc )
|
|
|
|
#define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc )
|
2013-03-13 13:19:30 +01:00
|
|
|
|
2019-05-19 20:54:44 +02:00
|
|
|
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
2019-04-23 23:41:13 +02:00
|
|
|
#define CATCH_BENCHMARK(...) \
|
|
|
|
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
|
|
|
|
#define CATCH_BENCHMARK_ADVANCED(name) \
|
|
|
|
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name)
|
2019-05-19 20:54:44 +02:00
|
|
|
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
2019-04-23 23:41:13 +02:00
|
|
|
|
2012-07-20 19:43:48 +02:00
|
|
|
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
|
|
|
|
#else
|
|
|
|
|
2017-04-25 20:20:46 +02:00
|
|
|
#define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
|
|
|
#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2017-06-26 20:48:41 +02:00
|
|
|
#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
2017-03-21 14:22:39 +01:00
|
|
|
#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
|
2017-06-26 20:48:41 +02:00
|
|
|
#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
|
2017-08-09 13:10:14 +02:00
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
2017-06-05 18:40:50 +02:00
|
|
|
#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
|
2017-07-28 21:34:34 +02:00
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
2017-04-25 20:20:46 +02:00
|
|
|
#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2017-04-25 20:20:46 +02:00
|
|
|
#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
|
|
|
|
#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2017-06-26 20:48:41 +02:00
|
|
|
#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
2017-03-21 14:22:39 +01:00
|
|
|
#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
|
2017-06-26 20:48:41 +02:00
|
|
|
#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
2017-08-09 13:10:14 +02:00
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
2017-06-05 18:40:50 +02:00
|
|
|
#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
2017-07-28 21:34:34 +02:00
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
2017-04-25 20:20:46 +02:00
|
|
|
#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2017-07-28 21:34:34 +02:00
|
|
|
|
2017-07-29 08:43:32 +02:00
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
2017-03-21 14:22:39 +01:00
|
|
|
#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
|
2017-03-17 13:21:40 +01:00
|
|
|
|
2017-03-21 14:22:39 +01:00
|
|
|
#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
2017-07-28 21:34:34 +02:00
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
2012-03-04 12:14:21 +01:00
|
|
|
|
2017-03-21 14:22:39 +01:00
|
|
|
#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
|
2019-02-01 16:11:30 +01:00
|
|
|
#define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg )
|
2017-03-21 14:22:39 +01:00
|
|
|
#define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
|
2018-06-27 22:34:35 +02:00
|
|
|
#define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CAPTURE",__VA_ARGS__ )
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2017-03-08 16:40:20 +01:00
|
|
|
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
|
|
|
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
|
|
|
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
|
|
|
#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
|
|
|
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
2018-06-25 20:19:21 +02:00
|
|
|
#define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )
|
2017-03-21 14:22:39 +01:00
|
|
|
#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
|
|
|
#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
|
|
|
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
2017-07-13 10:20:37 +02:00
|
|
|
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2018-11-08 07:26:39 +01:00
|
|
|
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
|
|
|
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ )
|
2018-11-08 07:26:39 +01:00
|
|
|
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )
|
2019-05-27 17:24:16 +02:00
|
|
|
#define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__)
|
|
|
|
#define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2018-11-08 07:26:39 +01:00
|
|
|
#else
|
|
|
|
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) )
|
2018-11-08 07:26:39 +01:00
|
|
|
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )
|
2019-05-27 17:24:16 +02:00
|
|
|
#define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) )
|
|
|
|
#define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
2018-11-08 07:26:39 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2018-10-13 21:29:59 +02:00
|
|
|
#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
|
|
|
|
#define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ )
|
|
|
|
#define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" )
|
|
|
|
#else
|
|
|
|
#define STATIC_REQUIRE( ... ) REQUIRE( __VA_ARGS__ )
|
|
|
|
#define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ )
|
|
|
|
#endif
|
|
|
|
|
2012-07-20 19:43:48 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2013-03-13 13:19:30 +01:00
|
|
|
// "BDD-style" convenience wrappers
|
2013-03-16 21:39:19 +01:00
|
|
|
#define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ )
|
2014-07-10 11:22:20 +02:00
|
|
|
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
2017-04-25 12:41:30 +02:00
|
|
|
|
2018-08-14 11:49:55 +02:00
|
|
|
#define GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc )
|
|
|
|
#define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc )
|
|
|
|
#define WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc )
|
|
|
|
#define AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc )
|
|
|
|
#define THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc )
|
|
|
|
#define AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc )
|
2013-03-13 13:19:30 +01:00
|
|
|
|
2019-05-19 20:54:44 +02:00
|
|
|
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
2019-04-23 23:41:13 +02:00
|
|
|
#define BENCHMARK(...) \
|
|
|
|
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
|
|
|
|
#define BENCHMARK_ADVANCED(name) \
|
|
|
|
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name)
|
2019-05-19 20:54:44 +02:00
|
|
|
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
2019-04-23 23:41:13 +02:00
|
|
|
|
2011-04-04 08:56:44 +02:00
|
|
|
using Catch::Detail::Approx;
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2018-06-25 20:22:57 +02:00
|
|
|
#else // CATCH_CONFIG_DISABLE
|
|
|
|
|
2017-08-27 17:03:32 +02:00
|
|
|
//////
|
|
|
|
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
|
|
|
|
#ifdef CATCH_CONFIG_PREFIX_ALL
|
|
|
|
|
|
|
|
#define CATCH_REQUIRE( ... ) (void)(0)
|
|
|
|
#define CATCH_REQUIRE_FALSE( ... ) (void)(0)
|
|
|
|
|
|
|
|
#define CATCH_REQUIRE_THROWS( ... ) (void)(0)
|
|
|
|
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
|
|
|
|
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
|
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
|
|
#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
|
|
|
#endif// CATCH_CONFIG_DISABLE_MATCHERS
|
|
|
|
#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)
|
|
|
|
|
|
|
|
#define CATCH_CHECK( ... ) (void)(0)
|
|
|
|
#define CATCH_CHECK_FALSE( ... ) (void)(0)
|
|
|
|
#define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__)
|
|
|
|
#define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
|
|
|
|
#define CATCH_CHECK_NOFAIL( ... ) (void)(0)
|
|
|
|
|
|
|
|
#define CATCH_CHECK_THROWS( ... ) (void)(0)
|
|
|
|
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
|
|
|
|
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0)
|
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
|
|
#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
|
|
#define CATCH_CHECK_NOTHROW( ... ) (void)(0)
|
|
|
|
|
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
|
|
#define CATCH_CHECK_THAT( arg, matcher ) (void)(0)
|
|
|
|
|
|
|
|
#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)
|
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
|
|
|
2019-04-24 21:51:21 +02:00
|
|
|
#define CATCH_INFO( msg ) (void)(0)
|
|
|
|
#define CATCH_UNSCOPED_INFO( msg ) (void)(0)
|
|
|
|
#define CATCH_WARN( msg ) (void)(0)
|
|
|
|
#define CATCH_CAPTURE( msg ) (void)(0)
|
2017-08-27 17:03:32 +02:00
|
|
|
|
|
|
|
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
|
|
|
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
|
|
|
#define CATCH_METHOD_AS_TEST_CASE( method, ... )
|
|
|
|
#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
|
|
|
#define CATCH_SECTION( ... )
|
2018-06-25 20:22:57 +02:00
|
|
|
#define CATCH_DYNAMIC_SECTION( ... )
|
2017-08-27 17:03:32 +02:00
|
|
|
#define CATCH_FAIL( ... ) (void)(0)
|
|
|
|
#define CATCH_FAIL_CHECK( ... ) (void)(0)
|
|
|
|
#define CATCH_SUCCEED( ... ) (void)(0)
|
|
|
|
|
|
|
|
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
|
|
|
|
2018-11-08 07:26:39 +01:00
|
|
|
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)
|
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__)
|
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__)
|
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2018-11-08 07:26:39 +01:00
|
|
|
#else
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) )
|
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) )
|
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) )
|
|
|
|
#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2018-11-08 07:26:39 +01:00
|
|
|
#endif
|
|
|
|
|
2017-08-27 17:03:32 +02:00
|
|
|
// "BDD-style" convenience wrappers
|
|
|
|
#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
|
|
|
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
|
|
|
|
#define CATCH_GIVEN( desc )
|
2018-08-14 11:49:55 +02:00
|
|
|
#define CATCH_AND_GIVEN( desc )
|
2017-08-27 17:03:32 +02:00
|
|
|
#define CATCH_WHEN( desc )
|
|
|
|
#define CATCH_AND_WHEN( desc )
|
|
|
|
#define CATCH_THEN( desc )
|
|
|
|
#define CATCH_AND_THEN( desc )
|
|
|
|
|
2018-10-13 21:29:59 +02:00
|
|
|
#define CATCH_STATIC_REQUIRE( ... ) (void)(0)
|
|
|
|
#define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0)
|
|
|
|
|
2017-08-27 17:03:32 +02:00
|
|
|
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define REQUIRE( ... ) (void)(0)
|
|
|
|
#define REQUIRE_FALSE( ... ) (void)(0)
|
|
|
|
|
|
|
|
#define REQUIRE_THROWS( ... ) (void)(0)
|
|
|
|
#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
|
|
|
|
#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
|
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
|
|
#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
|
|
#define REQUIRE_NOTHROW( ... ) (void)(0)
|
|
|
|
|
|
|
|
#define CHECK( ... ) (void)(0)
|
|
|
|
#define CHECK_FALSE( ... ) (void)(0)
|
|
|
|
#define CHECKED_IF( ... ) if (__VA_ARGS__)
|
|
|
|
#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
|
|
|
|
#define CHECK_NOFAIL( ... ) (void)(0)
|
|
|
|
|
|
|
|
#define CHECK_THROWS( ... ) (void)(0)
|
|
|
|
#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
|
|
|
|
#define CHECK_THROWS_WITH( expr, matcher ) (void)(0)
|
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
|
|
#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
|
|
#define CHECK_NOTHROW( ... ) (void)(0)
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
|
|
#define CHECK_THAT( arg, matcher ) (void)(0)
|
|
|
|
|
|
|
|
#define REQUIRE_THAT( arg, matcher ) (void)(0)
|
|
|
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
|
|
|
|
|
|
#define INFO( msg ) (void)(0)
|
2019-04-24 21:51:21 +02:00
|
|
|
#define UNSCOPED_INFO( msg ) (void)(0)
|
2017-08-27 17:03:32 +02:00
|
|
|
#define WARN( msg ) (void)(0)
|
|
|
|
#define CAPTURE( msg ) (void)(0)
|
|
|
|
|
|
|
|
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
|
|
|
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
|
|
|
#define METHOD_AS_TEST_CASE( method, ... )
|
|
|
|
#define REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
|
|
|
#define SECTION( ... )
|
2018-06-25 20:22:57 +02:00
|
|
|
#define DYNAMIC_SECTION( ... )
|
2017-08-27 17:03:32 +02:00
|
|
|
#define FAIL( ... ) (void)(0)
|
|
|
|
#define FAIL_CHECK( ... ) (void)(0)
|
|
|
|
#define SUCCEED( ... ) (void)(0)
|
|
|
|
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
|
|
|
|
2018-11-08 07:26:39 +01:00
|
|
|
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)
|
|
|
|
#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__)
|
|
|
|
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__)
|
|
|
|
#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2018-11-08 07:26:39 +01:00
|
|
|
#else
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) )
|
|
|
|
#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) )
|
|
|
|
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) )
|
|
|
|
#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
(std::tuple, std::pair, std::map),
((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
2018-12-06 19:27:33 +01:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2019-04-17 20:23:24 +02:00
|
|
|
#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
2018-11-08 07:26:39 +01:00
|
|
|
#endif
|
2018-10-13 21:29:59 +02:00
|
|
|
|
|
|
|
#define STATIC_REQUIRE( ... ) (void)(0)
|
|
|
|
#define STATIC_REQUIRE_FALSE( ... ) (void)(0)
|
|
|
|
|
2017-08-27 17:03:32 +02:00
|
|
|
#endif
|
|
|
|
|
2017-08-29 09:52:25 +02:00
|
|
|
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
|
2017-08-27 17:03:32 +02:00
|
|
|
|
|
|
|
// "BDD-style" convenience wrappers
|
|
|
|
#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )
|
|
|
|
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
|
|
|
|
|
|
|
|
#define GIVEN( desc )
|
2018-08-14 11:49:55 +02:00
|
|
|
#define AND_GIVEN( desc )
|
2017-08-27 17:03:32 +02:00
|
|
|
#define WHEN( desc )
|
|
|
|
#define AND_WHEN( desc )
|
|
|
|
#define THEN( desc )
|
|
|
|
#define AND_THEN( desc )
|
|
|
|
|
|
|
|
using Catch::Detail::Approx;
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2017-11-14 21:04:36 +01:00
|
|
|
#endif // ! CATCH_CONFIG_IMPL_ONLY
|
|
|
|
|
2014-05-19 19:57:14 +02:00
|
|
|
#include "internal/catch_reenable_warnings.h"
|
2012-08-13 08:46:10 +02:00
|
|
|
|
2011-02-16 20:02:09 +01:00
|
|
|
#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
|