| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 1 | /* |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 2 | * Created by Phil on 22/10/2010. |
| 3 | * Copyright 2010 Two Blue Cubes Ltd |
| 4 | * |
| 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 9 | #ifndef TWOBLUECUBES_CATCH_HPP_INCLUDED |
| 10 | #define TWOBLUECUBES_CATCH_HPP_INCLUDED |
| Phil Nash | 0f9c551 | 2012-06-02 23:12:42 +0100 | [diff] [blame] | 11 | |
| Phil Nash | cda2149 | 2012-08-16 18:47:41 +0100 | [diff] [blame] | 12 | #ifdef __clang__ |
| Phil Nash | 778f9c4 | 2012-10-30 09:09:30 +0000 | [diff] [blame] | 13 | #pragma clang diagnostic ignored "-Wglobal-constructors" |
| Phil Nash | c0b6980 | 2013-03-16 20:18:52 +0000 | [diff] [blame] | 14 | #pragma clang diagnostic ignored "-Wvariadic-macros" |
| Phil Nash | a695eb9 | 2012-08-13 07:46:10 +0100 | [diff] [blame] | 15 | |
| 16 | #pragma clang diagnostic push |
| 17 | #pragma clang diagnostic ignored "-Wpadded" |
| Phil Nash | cda2149 | 2012-08-16 18:47:41 +0100 | [diff] [blame] | 18 | #endif |
| Phil Nash | a695eb9 | 2012-08-13 07:46:10 +0100 | [diff] [blame] | 19 | |
| Phil Nash | 1091ca8 | 2012-08-06 20:16:53 +0100 | [diff] [blame] | 20 | #include "internal/catch_notimplemented_exception.h" |
| Phil Nash | 5ec53b2 | 2012-05-10 07:58:48 +0100 | [diff] [blame] | 21 | #include "internal/catch_context.h" |
| Phil Nash | 896a04f | 2011-01-05 21:16:54 +0000 | [diff] [blame] | 22 | #include "internal/catch_test_registry.hpp" |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 23 | #include "internal/catch_capture.hpp" |
| 24 | #include "internal/catch_section.hpp" |
| Phil Nash | 5cad9d5 | 2011-01-27 22:29:36 +0000 | [diff] [blame] | 25 | #include "internal/catch_generators.hpp" |
| Phil Nash | 9430a2c | 2011-04-20 15:40:40 +0100 | [diff] [blame] | 26 | #include "internal/catch_interfaces_exception.h" |
| Phil Nash | d7c203c | 2011-04-28 08:03:28 +0100 | [diff] [blame] | 27 | #include "internal/catch_approx.hpp" |
| Phil Nash | a6a40b3 | 2012-03-04 20:10:36 +0000 | [diff] [blame] | 28 | #include "internal/catch_matchers.hpp" |
| Phil Nash | 4dd3f68 | 2013-04-22 08:19:17 +0100 | [diff] [blame^] | 29 | #include "internal/catch_compiler_capabilities.h" |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 30 | |
| Phil Nash | 0f9c551 | 2012-06-02 23:12:42 +0100 | [diff] [blame] | 31 | // These files are included here so the single_include script doesn't put them |
| 32 | // in the conditionally compiled sections |
| Phil Nash | ddfe963 | 2012-08-14 19:30:30 +0100 | [diff] [blame] | 33 | #include "internal/catch_test_case_info.h" |
| Phil Nash | 0f9c551 | 2012-06-02 23:12:42 +0100 | [diff] [blame] | 34 | #include "internal/catch_interfaces_runner.h" |
| 35 | |
| Phil Nash | 8350ef6 | 2011-08-12 18:52:10 +0100 | [diff] [blame] | 36 | #ifdef __OBJC__ |
| 37 | #include "internal/catch_objc.hpp" |
| 38 | #endif |
| 39 | |
| Phil Nash | 89d1e6c | 2011-05-24 08:23:02 +0100 | [diff] [blame] | 40 | #if defined( CATCH_CONFIG_MAIN ) || defined( CATCH_CONFIG_RUNNER ) |
| Phil Nash | 1091ca8 | 2012-08-06 20:16:53 +0100 | [diff] [blame] | 41 | #include "internal/catch_impl.hpp" |
| Phil Nash | 89d1e6c | 2011-05-24 08:23:02 +0100 | [diff] [blame] | 42 | #endif |
| 43 | |
| 44 | #ifdef CATCH_CONFIG_MAIN |
| 45 | #include "internal/catch_default_main.hpp" |
| 46 | #endif |
| 47 | |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 48 | ////// |
| 49 | |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 50 | // If this config identifier is defined then all CATCH macros are prefixed with CATCH_ |
| 51 | #ifdef CATCH_CONFIG_PREFIX_ALL |
| 52 | |
| Phil Nash | b2ef998 | 2012-11-10 10:35:09 +0000 | [diff] [blame] | 53 | #define CATCH_REQUIRE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal, "CATCH_REQUIRE" ) |
| 54 | #define CATCH_REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal | Catch::ResultDisposition::NegateResult, "CATCH_REQUIRE_FALSE" ) |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 55 | |
| Phil Nash | 1af13db | 2012-11-10 10:20:08 +0000 | [diff] [blame] | 56 | #define CATCH_REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THROWS" ) |
| 57 | #define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THROWS_AS" ) |
| 58 | #define CATCH_REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_NOTHROW" ) |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 59 | |
| Phil Nash | b2ef998 | 2012-11-10 10:35:09 +0000 | [diff] [blame] | 60 | #define CATCH_CHECK( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK" ) |
| 61 | #define CATCH_CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::NegateResult, "CATCH_CHECK_FALSE" ) |
| 62 | #define CATCH_CHECKED_IF( expr ) INTERNAL_CATCH_IF( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_IF" ) |
| 63 | #define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_ELSE" ) |
| Phil Nash | 7717c29 | 2012-11-13 09:45:29 +0000 | [diff] [blame] | 64 | #define CATCH_CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CATCH_CHECK_NOFAIL" ) |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 65 | |
| Phil Nash | 1af13db | 2012-11-10 10:20:08 +0000 | [diff] [blame] | 66 | #define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS" ) |
| 67 | #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS_AS" ) |
| 68 | #define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_NOTHROW" ) |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 69 | |
| Phil Nash | 1af13db | 2012-11-10 10:20:08 +0000 | [diff] [blame] | 70 | #define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THAT" ) |
| 71 | #define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THAT" ) |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 72 | |
| Phil Nash | 207b27b | 2013-02-02 19:58:04 +0000 | [diff] [blame] | 73 | #define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( msg, "CATCH_INFO" ) |
| Phil Nash | 1af13db | 2012-11-10 10:20:08 +0000 | [diff] [blame] | 74 | #define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "CATCH_WARN" ) |
| 75 | #define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL" ) |
| 76 | #define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED" ) |
| Phil Nash | e04e74f | 2012-10-24 21:59:47 +0100 | [diff] [blame] | 77 | #define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_SCOPED_INFO( msg, "CATCH_SCOPED_INFO" ) |
| Phil Nash | 207b27b | 2013-02-02 19:58:04 +0000 | [diff] [blame] | 78 | #define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CATCH_CAPTURE" ) |
| Phil Nash | e04e74f | 2012-10-24 21:59:47 +0100 | [diff] [blame] | 79 | #define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_SCOPED_INFO( #msg " := " << msg, "CATCH_SCOPED_CAPTURE" ) |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 80 | |
| Phil Nash | c0b6980 | 2013-03-16 20:18:52 +0000 | [diff] [blame] | 81 | #ifdef CATCH_CONFIG_VARIADIC_MACROS |
| 82 | #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) |
| 83 | #define CATCH_TEST_CASE_NORETURN( ... ) INTERNAL_CATCH_TESTCASE_NORETURN( __VA_ARGS__ ) |
| 84 | #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) |
| 85 | #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) |
| 86 | #else |
| 87 | #define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description ) |
| 88 | #define CATCH_TEST_CASE_NORETURN( name, description ) INTERNAL_CATCH_TESTCASE_NORETURN( name, description ) |
| 89 | #define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description ) |
| 90 | #define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description ) |
| 91 | #endif |
| 92 | #define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" ) |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 93 | |
| 94 | #define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) |
| Phil Nash | 8255acf | 2012-11-30 19:29:03 +0000 | [diff] [blame] | 95 | #define CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 96 | |
| 97 | #define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr ) |
| 98 | |
| Phil Nash | 37186a1 | 2013-03-13 12:19:30 +0000 | [diff] [blame] | 99 | // "BDD-style" convenience wrappers |
| Phil Nash | 444f4dd | 2013-03-16 20:39:19 +0000 | [diff] [blame] | 100 | #ifdef CATCH_CONFIG_VARIADIC_MACROS |
| 101 | #define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ ) |
| 102 | #else |
| Phil Nash | 37186a1 | 2013-03-13 12:19:30 +0000 | [diff] [blame] | 103 | #define CATCH_SCENARIO( name, tags ) CATCH_TEST_CASE( "Scenario: " name, tags ) |
| Phil Nash | 444f4dd | 2013-03-16 20:39:19 +0000 | [diff] [blame] | 104 | #endif |
| Phil Nash | 37186a1 | 2013-03-13 12:19:30 +0000 | [diff] [blame] | 105 | #define CATCH_GIVEN( desc ) CATCH_SECTION( "Given: " desc, "" ) |
| 106 | #define CATCH_WHEN( desc ) CATCH_SECTION( " When: " desc, "" ) |
| 107 | #define CATCH_AND_WHEN( desc ) CATCH_SECTION( " And: " desc, "" ) |
| 108 | #define CATCH_THEN( desc ) CATCH_SECTION( " Then: " desc, "" ) |
| 109 | #define CATCH_AND_THEN( desc ) CATCH_SECTION( " And: " desc, "" ) |
| 110 | |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 111 | // If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required |
| 112 | #else |
| 113 | |
| Phil Nash | b2ef998 | 2012-11-10 10:35:09 +0000 | [diff] [blame] | 114 | #define REQUIRE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal, "REQUIRE" ) |
| 115 | #define REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal | Catch::ResultDisposition::NegateResult, "REQUIRE_FALSE" ) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 116 | |
| Phil Nash | 1af13db | 2012-11-10 10:20:08 +0000 | [diff] [blame] | 117 | #define REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., Catch::ResultDisposition::Normal, "REQUIRE_THROWS" ) |
| 118 | #define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::Normal, "REQUIRE_THROWS_AS" ) |
| 119 | #define REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::Normal, "REQUIRE_NOTHROW" ) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 120 | |
| Phil Nash | b2ef998 | 2012-11-10 10:35:09 +0000 | [diff] [blame] | 121 | #define CHECK( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECK" ) |
| 122 | #define CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::NegateResult, "CHECK_FALSE" ) |
| 123 | #define CHECKED_IF( expr ) INTERNAL_CATCH_IF( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECKED_IF" ) |
| 124 | #define CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECKED_ELSE" ) |
| Phil Nash | d539da9 | 2012-11-13 09:44:52 +0000 | [diff] [blame] | 125 | #define CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CHECK_NOFAIL" ) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 126 | |
| Phil Nash | 1af13db | 2012-11-10 10:20:08 +0000 | [diff] [blame] | 127 | #define CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., Catch::ResultDisposition::ContinueOnFailure, "CHECK_THROWS" ) |
| 128 | #define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CHECK_THROWS_AS" ) |
| 129 | #define CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECK_NOTHROW" ) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 130 | |
| Phil Nash | 1af13db | 2012-11-10 10:20:08 +0000 | [diff] [blame] | 131 | #define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CHECK_THAT" ) |
| 132 | #define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "REQUIRE_THAT" ) |
| Phil Nash | eca5637 | 2012-03-04 11:14:21 +0000 | [diff] [blame] | 133 | |
| Phil Nash | 207b27b | 2013-02-02 19:58:04 +0000 | [diff] [blame] | 134 | #define INFO( msg ) INTERNAL_CATCH_INFO( msg, "INFO" ) |
| Phil Nash | 1af13db | 2012-11-10 10:20:08 +0000 | [diff] [blame] | 135 | #define WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "WARN" ) |
| 136 | #define FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL" ) |
| 137 | #define SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED" ) |
| Phil Nash | e04e74f | 2012-10-24 21:59:47 +0100 | [diff] [blame] | 138 | #define SCOPED_INFO( msg ) INTERNAL_CATCH_SCOPED_INFO( msg, "SCOPED_INFO" ) |
| Phil Nash | 207b27b | 2013-02-02 19:58:04 +0000 | [diff] [blame] | 139 | #define CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CAPTURE" ) |
| Phil Nash | e04e74f | 2012-10-24 21:59:47 +0100 | [diff] [blame] | 140 | #define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_SCOPED_INFO( #msg " := " << msg, "SCOPED_CAPTURE" ) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 141 | |
| Phil Nash | c0b6980 | 2013-03-16 20:18:52 +0000 | [diff] [blame] | 142 | #ifdef CATCH_CONFIG_VARIADIC_MACROS |
| 143 | #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) |
| 144 | #define TEST_CASE_NORETURN( ... ) INTERNAL_CATCH_TESTCASE_NORETURN( __VA_ARGS__ ) |
| 145 | #define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) |
| 146 | #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) |
| 147 | #else |
| 148 | #define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description ) |
| 149 | #define TEST_CASE_NORETURN( name, description ) INTERNAL_CATCH_TESTCASE_NORETURN( name, description ) |
| 150 | #define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description ) |
| 151 | #define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description ) |
| 152 | #endif |
| 153 | #define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" ) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 154 | |
| Phil Nash | 5cad9d5 | 2011-01-27 22:29:36 +0000 | [diff] [blame] | 155 | #define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) |
| Phil Nash | 8255acf | 2012-11-30 19:29:03 +0000 | [diff] [blame] | 156 | #define REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) |
| Phil Nash | 5cad9d5 | 2011-01-27 22:29:36 +0000 | [diff] [blame] | 157 | |
| 158 | #define GENERATE( expr) INTERNAL_CATCH_GENERATE( expr ) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 159 | |
| Phil Nash | 46bcd4b | 2012-07-20 18:43:48 +0100 | [diff] [blame] | 160 | #endif |
| 161 | |
| 162 | #define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 163 | |
| Phil Nash | 37186a1 | 2013-03-13 12:19:30 +0000 | [diff] [blame] | 164 | // "BDD-style" convenience wrappers |
| Phil Nash | 444f4dd | 2013-03-16 20:39:19 +0000 | [diff] [blame] | 165 | #ifdef CATCH_CONFIG_VARIADIC_MACROS |
| 166 | #define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ ) |
| 167 | #else |
| Phil Nash | 37186a1 | 2013-03-13 12:19:30 +0000 | [diff] [blame] | 168 | #define SCENARIO( name, tags ) TEST_CASE( "Scenario: " name, tags ) |
| Phil Nash | 444f4dd | 2013-03-16 20:39:19 +0000 | [diff] [blame] | 169 | #endif |
| Phil Nash | 15fd032 | 2013-03-28 22:13:31 +0000 | [diff] [blame] | 170 | #define GIVEN( desc ) SECTION( " Given: " desc, "" ) |
| 171 | #define WHEN( desc ) SECTION( " When: " desc, "" ) |
| 172 | #define AND_WHEN( desc ) SECTION( "And when: " desc, "" ) |
| 173 | #define THEN( desc ) SECTION( " Then: " desc, "" ) |
| 174 | #define AND_THEN( desc ) SECTION( " And: " desc, "" ) |
| Phil Nash | 37186a1 | 2013-03-13 12:19:30 +0000 | [diff] [blame] | 175 | |
| Phil Nash | 01db6c4 | 2011-04-04 07:56:44 +0100 | [diff] [blame] | 176 | using Catch::Detail::Approx; |
| Phil Nash | d802600 | 2010-11-09 23:24:00 +0000 | [diff] [blame] | 177 | |
| Phil Nash | cda2149 | 2012-08-16 18:47:41 +0100 | [diff] [blame] | 178 | #ifdef __clang__ |
| Phil Nash | a695eb9 | 2012-08-13 07:46:10 +0100 | [diff] [blame] | 179 | #pragma clang diagnostic pop |
| Phil Nash | cda2149 | 2012-08-16 18:47:41 +0100 | [diff] [blame] | 180 | #endif |
| Phil Nash | a695eb9 | 2012-08-13 07:46:10 +0100 | [diff] [blame] | 181 | |
| Phil Nash | 73acd94 | 2011-02-16 19:02:09 +0000 | [diff] [blame] | 182 | #endif // TWOBLUECUBES_CATCH_HPP_INCLUDED |