diff options
Diffstat (limited to 'thirdparty/doctest')
-rw-r--r-- | thirdparty/doctest/LICENSE.txt | 2 | ||||
-rw-r--r-- | thirdparty/doctest/doctest.h | 337 | ||||
-rw-r--r-- | thirdparty/doctest/patches/fix-arm64-mac.patch | 18 |
3 files changed, 194 insertions, 163 deletions
diff --git a/thirdparty/doctest/LICENSE.txt b/thirdparty/doctest/LICENSE.txt index a204721468..50a358cd1b 100644 --- a/thirdparty/doctest/LICENSE.txt +++ b/thirdparty/doctest/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2019 Viktor Kirilov +Copyright (c) 2016-2020 Viktor Kirilov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/thirdparty/doctest/doctest.h b/thirdparty/doctest/doctest.h index e4fed12767..acbe6cd321 100644 --- a/thirdparty/doctest/doctest.h +++ b/thirdparty/doctest/doctest.h @@ -4,7 +4,7 @@ // // doctest.h - the lightest feature-rich C++ single-header testing framework for unit tests and TDD // -// Copyright (c) 2016-2019 Viktor Kirilov +// Copyright (c) 2016-2020 Viktor Kirilov // // Distributed under the MIT Software License // See accompanying file LICENSE.txt or copy at @@ -48,8 +48,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 4 -#define DOCTEST_VERSION_PATCH 0 -#define DOCTEST_VERSION_STR "2.4.0" +#define DOCTEST_VERSION_PATCH 1 +#define DOCTEST_VERSION_STR "2.4.1" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) @@ -301,11 +301,15 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum' #define DOCTEST_NOINLINE __declspec(noinline) #define DOCTEST_UNUSED #define DOCTEST_ALIGNMENT(x) -#else // MSVC +#elif DOCTEST_CLANG && DOCTEST_CLANG < DOCTEST_COMPILER(3, 5, 0) +#define DOCTEST_NOINLINE +#define DOCTEST_UNUSED +#define DOCTEST_ALIGNMENT(x) +#else #define DOCTEST_NOINLINE __attribute__((noinline)) #define DOCTEST_UNUSED __attribute__((unused)) #define DOCTEST_ALIGNMENT(x) __attribute__((aligned(x))) -#endif // MSVC +#endif #ifndef DOCTEST_NORETURN #define DOCTEST_NORETURN [[noreturn]] @@ -355,14 +359,20 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum' #ifndef DOCTEST_BREAK_INTO_DEBUGGER // should probably take a look at https://github.com/scottt/debugbreak -#ifdef DOCTEST_PLATFORM_MAC -// -- GODOT start -- +#ifdef DOCTEST_PLATFORM_LINUX +#if defined(__GNUC__) && (defined(__i386) || defined(__x86_64)) +// Break at the location of the failing check if possible +#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :) +#else +#include <signal.h> +#define DOCTEST_BREAK_INTO_DEBUGGER() raise(SIGTRAP) +#endif +#elif defined(DOCTEST_PLATFORM_MAC) #if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__) #define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :) #else #define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("brk #0"); #endif -// -- GODOT end -- #elif DOCTEST_MSVC #define DOCTEST_BREAK_INTO_DEBUGGER() __debugbreak() #elif defined(__MINGW32__) @@ -371,7 +381,7 @@ extern "C" __declspec(dllimport) void __stdcall DebugBreak(); DOCTEST_GCC_SUPPRESS_WARNING_POP #define DOCTEST_BREAK_INTO_DEBUGGER() ::DebugBreak() #else // linux -#define DOCTEST_BREAK_INTO_DEBUGGER() ((void)0) +#define DOCTEST_BREAK_INTO_DEBUGGER() (static_cast<void>(0)) #endif // linux #endif // DOCTEST_BREAK_INTO_DEBUGGER @@ -381,6 +391,9 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP #endif // DOCTEST_CONFIG_USE_IOSFWD #ifdef DOCTEST_CONFIG_USE_STD_HEADERS +#ifndef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS +#define DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS +#endif // DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS #include <iosfwd> #include <cstddef> #include <ostream> @@ -746,7 +759,6 @@ struct ContextOptions //!OCLINT too many fields }; namespace detail { -#if defined(DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING) || defined(DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS) template <bool CONDITION, typename TYPE = void> struct enable_if {}; @@ -754,7 +766,6 @@ namespace detail { template <typename TYPE> struct enable_if<true, TYPE> { typedef TYPE type; }; -#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING) || DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS // clang-format off template<class T> struct remove_reference { typedef T type; }; @@ -763,6 +774,14 @@ namespace detail { template<class T> struct remove_const { typedef T type; }; template<class T> struct remove_const<const T> { typedef T type; }; +#ifdef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS + template<class T> struct is_enum : public std::is_enum<T> {}; + template<class T> struct underlying_type : public std::underlying_type<T> {}; +#else + // Use compiler intrinsics + template<class T> struct is_enum { constexpr static bool value = __is_enum(T); }; + template<class T> struct underlying_type { typedef __underlying_type(T) type; }; +#endif // clang-format on template <typename T> @@ -777,12 +796,12 @@ namespace detail { template<class, class = void> struct check { - static constexpr auto value = false; + static constexpr bool value = false; }; template<class T> struct check<T, decltype(os() << val<T>(), void())> { - static constexpr auto value = true; + static constexpr bool value = true; }; } // namespace has_insertion_operator_impl @@ -851,7 +870,7 @@ struct StringMaker<R C::*> } }; -template <typename T> +template <typename T, typename detail::enable_if<!detail::is_enum<T>::value, bool>::type = true> String toString(const DOCTEST_REF_WRAP(T) value) { return StringMaker<T>::convert(value); } @@ -878,6 +897,12 @@ DOCTEST_INTERFACE String toString(int long long in); DOCTEST_INTERFACE String toString(int long long unsigned in); DOCTEST_INTERFACE String toString(std::nullptr_t in); +template <typename T, typename detail::enable_if<detail::is_enum<T>::value, bool>::type = true> +String toString(const DOCTEST_REF_WRAP(T) value) { + typedef typename detail::underlying_type<T>::type UT; + return toString(static_cast<UT>(value)); +} + #if DOCTEST_MSVC >= DOCTEST_COMPILER(19, 20, 0) // see this issue on why this is needed: https://github.com/onqtam/doctest/issues/183 DOCTEST_INTERFACE String toString(const std::string& in); @@ -1289,12 +1314,12 @@ namespace detail { template <class L, class R> struct RelationalComparator<n, L, R> { bool operator()(const DOCTEST_REF_WRAP(L) lhs, const DOCTEST_REF_WRAP(R) rhs) const { return op(lhs, rhs); } }; // clang-format on - DOCTEST_BINARY_RELATIONAL_OP(0, eq) - DOCTEST_BINARY_RELATIONAL_OP(1, ne) - DOCTEST_BINARY_RELATIONAL_OP(2, gt) - DOCTEST_BINARY_RELATIONAL_OP(3, lt) - DOCTEST_BINARY_RELATIONAL_OP(4, ge) - DOCTEST_BINARY_RELATIONAL_OP(5, le) + DOCTEST_BINARY_RELATIONAL_OP(0, doctest::detail::eq) + DOCTEST_BINARY_RELATIONAL_OP(1, doctest::detail::ne) + DOCTEST_BINARY_RELATIONAL_OP(2, doctest::detail::gt) + DOCTEST_BINARY_RELATIONAL_OP(3, doctest::detail::lt) + DOCTEST_BINARY_RELATIONAL_OP(4, doctest::detail::ge) + DOCTEST_BINARY_RELATIONAL_OP(5, doctest::detail::le) struct DOCTEST_INTERFACE ResultBuilder : public AssertData { @@ -1421,9 +1446,9 @@ namespace detail { } catch(T ex) { // NOLINT res = m_translateFunction(ex); //!OCLINT parameter reassignment return true; - } catch(...) {} //!OCLINT - empty catch statement -#endif // DOCTEST_CONFIG_NO_EXCEPTIONS - ((void)res); // to silence -Wunused-parameter + } catch(...) {} //!OCLINT - empty catch statement +#endif // DOCTEST_CONFIG_NO_EXCEPTIONS + static_cast<void>(res); // to silence -Wunused-parameter return false; } @@ -2189,37 +2214,37 @@ int registerReporter(const char* name, int priority, bool isReporter) { #ifdef DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS -#define DOCTEST_WARN_THROWS(...) ((void)0) -#define DOCTEST_CHECK_THROWS(...) ((void)0) -#define DOCTEST_REQUIRE_THROWS(...) ((void)0) -#define DOCTEST_WARN_THROWS_AS(expr, ...) ((void)0) -#define DOCTEST_CHECK_THROWS_AS(expr, ...) ((void)0) -#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) ((void)0) -#define DOCTEST_WARN_THROWS_WITH(expr, ...) ((void)0) -#define DOCTEST_CHECK_THROWS_WITH(expr, ...) ((void)0) -#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) ((void)0) -#define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) ((void)0) -#define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) ((void)0) -#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) ((void)0) -#define DOCTEST_WARN_NOTHROW(...) ((void)0) -#define DOCTEST_CHECK_NOTHROW(...) ((void)0) -#define DOCTEST_REQUIRE_NOTHROW(...) ((void)0) - -#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) -#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) -#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) -#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) -#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) -#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) -#define DOCTEST_WARN_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0) -#define DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0) -#define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0) -#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) ((void)0) +#define DOCTEST_WARN_THROWS(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS(...) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_AS(expr, ...) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_AS(expr, ...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_WITH(expr, ...) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_WITH(expr, ...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0)) +#define DOCTEST_WARN_NOTHROW(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_NOTHROW(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_NOTHROW(...) (static_cast<void>(0)) + +#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0)) #else // DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS @@ -2310,86 +2335,86 @@ int registerReporter(const char* name, int priority, bool isReporter) { #define DOCTEST_REGISTER_REPORTER(name, priority, reporter) #define DOCTEST_REGISTER_LISTENER(name, priority, reporter) -#define DOCTEST_INFO(x) ((void)0) -#define DOCTEST_CAPTURE(x) ((void)0) -#define DOCTEST_ADD_MESSAGE_AT(file, line, x) ((void)0) -#define DOCTEST_ADD_FAIL_CHECK_AT(file, line, x) ((void)0) -#define DOCTEST_ADD_FAIL_AT(file, line, x) ((void)0) -#define DOCTEST_MESSAGE(x) ((void)0) -#define DOCTEST_FAIL_CHECK(x) ((void)0) -#define DOCTEST_FAIL(x) ((void)0) - -#define DOCTEST_WARN(...) ((void)0) -#define DOCTEST_CHECK(...) ((void)0) -#define DOCTEST_REQUIRE(...) ((void)0) -#define DOCTEST_WARN_FALSE(...) ((void)0) -#define DOCTEST_CHECK_FALSE(...) ((void)0) -#define DOCTEST_REQUIRE_FALSE(...) ((void)0) - -#define DOCTEST_WARN_MESSAGE(cond, msg) ((void)0) -#define DOCTEST_CHECK_MESSAGE(cond, msg) ((void)0) -#define DOCTEST_REQUIRE_MESSAGE(cond, msg) ((void)0) -#define DOCTEST_WARN_FALSE_MESSAGE(cond, msg) ((void)0) -#define DOCTEST_CHECK_FALSE_MESSAGE(cond, msg) ((void)0) -#define DOCTEST_REQUIRE_FALSE_MESSAGE(cond, msg) ((void)0) - -#define DOCTEST_WARN_THROWS(...) ((void)0) -#define DOCTEST_CHECK_THROWS(...) ((void)0) -#define DOCTEST_REQUIRE_THROWS(...) ((void)0) -#define DOCTEST_WARN_THROWS_AS(expr, ...) ((void)0) -#define DOCTEST_CHECK_THROWS_AS(expr, ...) ((void)0) -#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) ((void)0) -#define DOCTEST_WARN_THROWS_WITH(expr, ...) ((void)0) -#define DOCTEST_CHECK_THROWS_WITH(expr, ...) ((void)0) -#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) ((void)0) -#define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) ((void)0) -#define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) ((void)0) -#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) ((void)0) -#define DOCTEST_WARN_NOTHROW(...) ((void)0) -#define DOCTEST_CHECK_NOTHROW(...) ((void)0) -#define DOCTEST_REQUIRE_NOTHROW(...) ((void)0) - -#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) -#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) -#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) -#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) -#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) -#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) -#define DOCTEST_WARN_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0) -#define DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0) -#define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0) -#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) ((void)0) -#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) ((void)0) - -#define DOCTEST_WARN_EQ(...) ((void)0) -#define DOCTEST_CHECK_EQ(...) ((void)0) -#define DOCTEST_REQUIRE_EQ(...) ((void)0) -#define DOCTEST_WARN_NE(...) ((void)0) -#define DOCTEST_CHECK_NE(...) ((void)0) -#define DOCTEST_REQUIRE_NE(...) ((void)0) -#define DOCTEST_WARN_GT(...) ((void)0) -#define DOCTEST_CHECK_GT(...) ((void)0) -#define DOCTEST_REQUIRE_GT(...) ((void)0) -#define DOCTEST_WARN_LT(...) ((void)0) -#define DOCTEST_CHECK_LT(...) ((void)0) -#define DOCTEST_REQUIRE_LT(...) ((void)0) -#define DOCTEST_WARN_GE(...) ((void)0) -#define DOCTEST_CHECK_GE(...) ((void)0) -#define DOCTEST_REQUIRE_GE(...) ((void)0) -#define DOCTEST_WARN_LE(...) ((void)0) -#define DOCTEST_CHECK_LE(...) ((void)0) -#define DOCTEST_REQUIRE_LE(...) ((void)0) - -#define DOCTEST_WARN_UNARY(...) ((void)0) -#define DOCTEST_CHECK_UNARY(...) ((void)0) -#define DOCTEST_REQUIRE_UNARY(...) ((void)0) -#define DOCTEST_WARN_UNARY_FALSE(...) ((void)0) -#define DOCTEST_CHECK_UNARY_FALSE(...) ((void)0) -#define DOCTEST_REQUIRE_UNARY_FALSE(...) ((void)0) +#define DOCTEST_INFO(x) (static_cast<void>(0)) +#define DOCTEST_CAPTURE(x) (static_cast<void>(0)) +#define DOCTEST_ADD_MESSAGE_AT(file, line, x) (static_cast<void>(0)) +#define DOCTEST_ADD_FAIL_CHECK_AT(file, line, x) (static_cast<void>(0)) +#define DOCTEST_ADD_FAIL_AT(file, line, x) (static_cast<void>(0)) +#define DOCTEST_MESSAGE(x) (static_cast<void>(0)) +#define DOCTEST_FAIL_CHECK(x) (static_cast<void>(0)) +#define DOCTEST_FAIL(x) (static_cast<void>(0)) + +#define DOCTEST_WARN(...) (static_cast<void>(0)) +#define DOCTEST_CHECK(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE(...) (static_cast<void>(0)) +#define DOCTEST_WARN_FALSE(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_FALSE(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_FALSE(...) (static_cast<void>(0)) + +#define DOCTEST_WARN_MESSAGE(cond, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_MESSAGE(cond, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_MESSAGE(cond, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_FALSE_MESSAGE(cond, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_FALSE_MESSAGE(cond, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_FALSE_MESSAGE(cond, msg) (static_cast<void>(0)) + +#define DOCTEST_WARN_THROWS(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS(...) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_AS(expr, ...) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_AS(expr, ...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_WITH(expr, ...) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_WITH(expr, ...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0)) +#define DOCTEST_WARN_NOTHROW(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_NOTHROW(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_NOTHROW(...) (static_cast<void>(0)) + +#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) (static_cast<void>(0)) +#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0)) + +#define DOCTEST_WARN_EQ(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_EQ(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_EQ(...) (static_cast<void>(0)) +#define DOCTEST_WARN_NE(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_NE(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_NE(...) (static_cast<void>(0)) +#define DOCTEST_WARN_GT(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_GT(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_GT(...) (static_cast<void>(0)) +#define DOCTEST_WARN_LT(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_LT(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_LT(...) (static_cast<void>(0)) +#define DOCTEST_WARN_GE(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_GE(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_GE(...) (static_cast<void>(0)) +#define DOCTEST_WARN_LE(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_LE(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_LE(...) (static_cast<void>(0)) + +#define DOCTEST_WARN_UNARY(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_UNARY(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_UNARY(...) (static_cast<void>(0)) +#define DOCTEST_WARN_UNARY_FALSE(...) (static_cast<void>(0)) +#define DOCTEST_CHECK_UNARY_FALSE(...) (static_cast<void>(0)) +#define DOCTEST_REQUIRE_UNARY_FALSE(...) (static_cast<void>(0)) #endif // DOCTEST_CONFIG_DISABLE @@ -3742,8 +3767,8 @@ namespace { DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations") void color_to_stream(std::ostream& s, Color::Enum code) { - ((void)s); // for DOCTEST_CONFIG_COLORS_NONE or DOCTEST_CONFIG_COLORS_WINDOWS - ((void)code); // for DOCTEST_CONFIG_COLORS_NONE + static_cast<void>(s); // for DOCTEST_CONFIG_COLORS_NONE or DOCTEST_CONFIG_COLORS_WINDOWS + static_cast<void>(code); // for DOCTEST_CONFIG_COLORS_NONE #ifdef DOCTEST_CONFIG_COLORS_ANSI if(g_no_colors || (isatty(STDOUT_FILENO) == false && getContextOptions()->force_colors == false)) @@ -3849,7 +3874,28 @@ namespace detail { #ifdef DOCTEST_IS_DEBUGGER_ACTIVE bool isDebuggerActive() { return DOCTEST_IS_DEBUGGER_ACTIVE(); } #else // DOCTEST_IS_DEBUGGER_ACTIVE -#ifdef DOCTEST_PLATFORM_MAC +#ifdef DOCTEST_PLATFORM_LINUX + class ErrnoGuard { + public: + ErrnoGuard() : m_oldErrno(errno) {} + ~ErrnoGuard() { errno = m_oldErrno; } + private: + int m_oldErrno; + }; + // See the comments in Catch2 for the reasoning behind this implementation: + // https://github.com/catchorg/Catch2/blob/v2.13.1/include/internal/catch_debugger.cpp#L79-L102 + bool isDebuggerActive() { + ErrnoGuard guard; + std::ifstream in("/proc/self/status"); + for(std::string line; std::getline(in, line);) { + static const int PREFIX_LEN = 11; + if(line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0) { + return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0'; + } + } + return false; + } +#elif defined(DOCTEST_PLATFORM_MAC) // The following function is taken directly from the following technical note: // https://developer.apple.com/library/archive/qa/qa1361/_index.html // Returns true if the current process is being debugged (either @@ -5460,25 +5506,28 @@ DOCTEST_CLANG_SUPPRESS_WARNING_POP separator_to_stream(); s << std::dec; + auto totwidth = int(std::ceil(log10((std::max(p.numTestCasesPassingFilters, static_cast<unsigned>(p.numAsserts))) + 1))); + auto passwidth = int(std::ceil(log10((std::max(p.numTestCasesPassingFilters - p.numTestCasesFailed, static_cast<unsigned>(p.numAsserts - p.numAssertsFailed))) + 1))); + auto failwidth = int(std::ceil(log10((std::max(p.numTestCasesFailed, static_cast<unsigned>(p.numAssertsFailed))) + 1))); const bool anythingFailed = p.numTestCasesFailed > 0 || p.numAssertsFailed > 0; - s << Color::Cyan << "[doctest] " << Color::None << "test cases: " << std::setw(6) + s << Color::Cyan << "[doctest] " << Color::None << "test cases: " << std::setw(totwidth) << p.numTestCasesPassingFilters << " | " << ((p.numTestCasesPassingFilters == 0 || anythingFailed) ? Color::None : Color::Green) - << std::setw(6) << p.numTestCasesPassingFilters - p.numTestCasesFailed << " passed" + << std::setw(passwidth) << p.numTestCasesPassingFilters - p.numTestCasesFailed << " passed" << Color::None << " | " << (p.numTestCasesFailed > 0 ? Color::Red : Color::None) - << std::setw(6) << p.numTestCasesFailed << " failed" << Color::None << " | "; + << std::setw(failwidth) << p.numTestCasesFailed << " failed" << Color::None << " |"; if(opt.no_skipped_summary == false) { const int numSkipped = p.numTestCases - p.numTestCasesPassingFilters; - s << (numSkipped == 0 ? Color::None : Color::Yellow) << std::setw(6) << numSkipped + s << " " << (numSkipped == 0 ? Color::None : Color::Yellow) << numSkipped << " skipped" << Color::None; } s << "\n"; - s << Color::Cyan << "[doctest] " << Color::None << "assertions: " << std::setw(6) + s << Color::Cyan << "[doctest] " << Color::None << "assertions: " << std::setw(totwidth) << p.numAsserts << " | " << ((p.numAsserts == 0 || anythingFailed) ? Color::None : Color::Green) - << std::setw(6) << (p.numAsserts - p.numAssertsFailed) << " passed" << Color::None - << " | " << (p.numAssertsFailed > 0 ? Color::Red : Color::None) << std::setw(6) + << std::setw(passwidth) << (p.numAsserts - p.numAssertsFailed) << " passed" << Color::None + << " | " << (p.numAssertsFailed > 0 ? Color::Red : Color::None) << std::setw(failwidth) << p.numAssertsFailed << " failed" << Color::None << " |\n"; s << Color::Cyan << "[doctest] " << Color::None << "Status: " << (p.numTestCasesFailed > 0 ? Color::Red : Color::Green) diff --git a/thirdparty/doctest/patches/fix-arm64-mac.patch b/thirdparty/doctest/patches/fix-arm64-mac.patch deleted file mode 100644 index f78014534f..0000000000 --- a/thirdparty/doctest/patches/fix-arm64-mac.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/thirdparty/doctest/doctest.h b/thirdparty/doctest/doctest.h -index 9444698286..e4fed12767 100644 ---- a/thirdparty/doctest/doctest.h -+++ b/thirdparty/doctest/doctest.h -@@ -356,7 +356,13 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum' - #ifndef DOCTEST_BREAK_INTO_DEBUGGER - // should probably take a look at https://github.com/scottt/debugbreak - #ifdef DOCTEST_PLATFORM_MAC -+// -- GODOT start -- -+#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__) - #define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :) -+#else -+#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("brk #0"); -+#endif -+// -- GODOT end -- - #elif DOCTEST_MSVC - #define DOCTEST_BREAK_INTO_DEBUGGER() __debugbreak() - #elif defined(__MINGW32__) |