doctest: Update to 2.4.1

Includes a patch for breakpoint inline assembly for macOS.
This commit is contained in:
Andrii Doroshenko (Xrayez) 2020-11-20 13:42:08 +02:00
parent 91dfac244b
commit 282ac09eef
5 changed files with 189 additions and 162 deletions

View File

@ -128,7 +128,7 @@ License: Expat
Files: ./thirdparty/doctest/ Files: ./thirdparty/doctest/
Comment: doctest Comment: doctest
Copyright: 2016-2019, Viktor Kirilov Copyright: 2016-2020, Viktor Kirilov
License: Expat License: Expat
Files: ./thirdparty/enet/ Files: ./thirdparty/enet/

View File

@ -76,15 +76,11 @@ Files extracted from upstream source:
## doctest ## doctest
- Upstream: https://github.com/onqtam/doctest - Upstream: https://github.com/onqtam/doctest
- Version: 1c8da00 (2.4.0) - Version: 8424be5 (2.4.1)
- License: MIT - License: MIT
Extracted from .zip provided. Extracted license and header only. Extracted from .zip provided. Extracted license and header only.
Important: Some files have Godot-made changes.
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
comments.
## enet ## enet
- Upstream: http://enet.bespin.org - Upstream: http://enet.bespin.org

View File

@ -1,6 +1,6 @@
The MIT License (MIT) 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -4,7 +4,7 @@
// //
// doctest.h - the lightest feature-rich C++ single-header testing framework for unit tests and TDD // 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 // Distributed under the MIT Software License
// See accompanying file LICENSE.txt or copy at // See accompanying file LICENSE.txt or copy at
@ -48,8 +48,8 @@
#define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MAJOR 2
#define DOCTEST_VERSION_MINOR 4 #define DOCTEST_VERSION_MINOR 4
#define DOCTEST_VERSION_PATCH 0 #define DOCTEST_VERSION_PATCH 1
#define DOCTEST_VERSION_STR "2.4.0" #define DOCTEST_VERSION_STR "2.4.1"
#define DOCTEST_VERSION \ #define DOCTEST_VERSION \
(DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) (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_NOINLINE __declspec(noinline)
#define DOCTEST_UNUSED #define DOCTEST_UNUSED
#define DOCTEST_ALIGNMENT(x) #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_NOINLINE __attribute__((noinline))
#define DOCTEST_UNUSED __attribute__((unused)) #define DOCTEST_UNUSED __attribute__((unused))
#define DOCTEST_ALIGNMENT(x) __attribute__((aligned(x))) #define DOCTEST_ALIGNMENT(x) __attribute__((aligned(x)))
#endif // MSVC #endif
#ifndef DOCTEST_NORETURN #ifndef DOCTEST_NORETURN
#define DOCTEST_NORETURN [[noreturn]] #define DOCTEST_NORETURN [[noreturn]]
@ -355,14 +359,20 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum'
#ifndef DOCTEST_BREAK_INTO_DEBUGGER #ifndef DOCTEST_BREAK_INTO_DEBUGGER
// should probably take a look at https://github.com/scottt/debugbreak // should probably take a look at https://github.com/scottt/debugbreak
#ifdef DOCTEST_PLATFORM_MAC #ifdef DOCTEST_PLATFORM_LINUX
// -- GODOT start -- #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__) #if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__)
#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :) #define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :)
#else #else
#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("brk #0"); #define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("brk #0");
#endif #endif
// -- GODOT end --
#elif DOCTEST_MSVC #elif DOCTEST_MSVC
#define DOCTEST_BREAK_INTO_DEBUGGER() __debugbreak() #define DOCTEST_BREAK_INTO_DEBUGGER() __debugbreak()
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
@ -371,7 +381,7 @@ extern "C" __declspec(dllimport) void __stdcall DebugBreak();
DOCTEST_GCC_SUPPRESS_WARNING_POP DOCTEST_GCC_SUPPRESS_WARNING_POP
#define DOCTEST_BREAK_INTO_DEBUGGER() ::DebugBreak() #define DOCTEST_BREAK_INTO_DEBUGGER() ::DebugBreak()
#else // linux #else // linux
#define DOCTEST_BREAK_INTO_DEBUGGER() ((void)0) #define DOCTEST_BREAK_INTO_DEBUGGER() (static_cast<void>(0))
#endif // linux #endif // linux
#endif // DOCTEST_BREAK_INTO_DEBUGGER #endif // DOCTEST_BREAK_INTO_DEBUGGER
@ -381,6 +391,9 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP
#endif // DOCTEST_CONFIG_USE_IOSFWD #endif // DOCTEST_CONFIG_USE_IOSFWD
#ifdef DOCTEST_CONFIG_USE_STD_HEADERS #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 <iosfwd>
#include <cstddef> #include <cstddef>
#include <ostream> #include <ostream>
@ -746,7 +759,6 @@ struct ContextOptions //!OCLINT too many fields
}; };
namespace detail { namespace detail {
#if defined(DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING) || defined(DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS)
template <bool CONDITION, typename TYPE = void> template <bool CONDITION, typename TYPE = void>
struct enable_if struct enable_if
{}; {};
@ -754,7 +766,6 @@ namespace detail {
template <typename TYPE> template <typename TYPE>
struct enable_if<true, TYPE> struct enable_if<true, TYPE>
{ typedef TYPE type; }; { typedef TYPE type; };
#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING) || DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
// clang-format off // clang-format off
template<class T> struct remove_reference { typedef T type; }; 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 { typedef T type; };
template<class T> struct remove_const<const T> { 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 // clang-format on
template <typename T> template <typename T>
@ -777,12 +796,12 @@ namespace detail {
template<class, class = void> template<class, class = void>
struct check { struct check {
static constexpr auto value = false; static constexpr bool value = false;
}; };
template<class T> template<class T>
struct check<T, decltype(os() << val<T>(), void())> { struct check<T, decltype(os() << val<T>(), void())> {
static constexpr auto value = true; static constexpr bool value = true;
}; };
} // namespace has_insertion_operator_impl } // 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) { String toString(const DOCTEST_REF_WRAP(T) value) {
return StringMaker<T>::convert(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(int long long unsigned in);
DOCTEST_INTERFACE String toString(std::nullptr_t 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) #if DOCTEST_MSVC >= DOCTEST_COMPILER(19, 20, 0)
// see this issue on why this is needed: https://github.com/onqtam/doctest/issues/183 // see this issue on why this is needed: https://github.com/onqtam/doctest/issues/183
DOCTEST_INTERFACE String toString(const std::string& in); 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); } }; 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 // clang-format on
DOCTEST_BINARY_RELATIONAL_OP(0, eq) DOCTEST_BINARY_RELATIONAL_OP(0, doctest::detail::eq)
DOCTEST_BINARY_RELATIONAL_OP(1, ne) DOCTEST_BINARY_RELATIONAL_OP(1, doctest::detail::ne)
DOCTEST_BINARY_RELATIONAL_OP(2, gt) DOCTEST_BINARY_RELATIONAL_OP(2, doctest::detail::gt)
DOCTEST_BINARY_RELATIONAL_OP(3, lt) DOCTEST_BINARY_RELATIONAL_OP(3, doctest::detail::lt)
DOCTEST_BINARY_RELATIONAL_OP(4, ge) DOCTEST_BINARY_RELATIONAL_OP(4, doctest::detail::ge)
DOCTEST_BINARY_RELATIONAL_OP(5, le) DOCTEST_BINARY_RELATIONAL_OP(5, doctest::detail::le)
struct DOCTEST_INTERFACE ResultBuilder : public AssertData struct DOCTEST_INTERFACE ResultBuilder : public AssertData
{ {
@ -1421,9 +1446,9 @@ namespace detail {
} catch(T ex) { // NOLINT } catch(T ex) { // NOLINT
res = m_translateFunction(ex); //!OCLINT parameter reassignment res = m_translateFunction(ex); //!OCLINT parameter reassignment
return true; return true;
} catch(...) {} //!OCLINT - empty catch statement } catch(...) {} //!OCLINT - empty catch statement
#endif // DOCTEST_CONFIG_NO_EXCEPTIONS #endif // DOCTEST_CONFIG_NO_EXCEPTIONS
((void)res); // to silence -Wunused-parameter static_cast<void>(res); // to silence -Wunused-parameter
return false; return false;
} }
@ -2189,37 +2214,37 @@ int registerReporter(const char* name, int priority, bool isReporter) {
#ifdef DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS #ifdef DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
#define DOCTEST_WARN_THROWS(...) ((void)0) #define DOCTEST_WARN_THROWS(...) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS(...) ((void)0) #define DOCTEST_CHECK_THROWS(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS(...) ((void)0) #define DOCTEST_REQUIRE_THROWS(...) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_AS(expr, ...) ((void)0) #define DOCTEST_WARN_THROWS_AS(expr, ...) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_AS(expr, ...) ((void)0) #define DOCTEST_CHECK_THROWS_AS(expr, ...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) ((void)0) #define DOCTEST_REQUIRE_THROWS_AS(expr, ...) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_WITH(expr, ...) ((void)0) #define DOCTEST_WARN_THROWS_WITH(expr, ...) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_WITH(expr, ...) ((void)0) #define DOCTEST_CHECK_THROWS_WITH(expr, ...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) ((void)0) #define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) ((void)0) #define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) ((void)0) #define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) ((void)0) #define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0))
#define DOCTEST_WARN_NOTHROW(...) ((void)0) #define DOCTEST_WARN_NOTHROW(...) (static_cast<void>(0))
#define DOCTEST_CHECK_NOTHROW(...) ((void)0) #define DOCTEST_CHECK_NOTHROW(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_NOTHROW(...) ((void)0) #define DOCTEST_REQUIRE_NOTHROW(...) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) ((void)0) #define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) ((void)0) #define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) ((void)0) #define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) #define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) #define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) #define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) #define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) #define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) ((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) ((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) ((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) ((void)0) #define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) (static_cast<void>(0))
#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) ((void)0) #define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) ((void)0) #define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) ((void)0) #define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0))
#else // DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS #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_REPORTER(name, priority, reporter)
#define DOCTEST_REGISTER_LISTENER(name, priority, reporter) #define DOCTEST_REGISTER_LISTENER(name, priority, reporter)
#define DOCTEST_INFO(x) ((void)0) #define DOCTEST_INFO(x) (static_cast<void>(0))
#define DOCTEST_CAPTURE(x) ((void)0) #define DOCTEST_CAPTURE(x) (static_cast<void>(0))
#define DOCTEST_ADD_MESSAGE_AT(file, line, x) ((void)0) #define DOCTEST_ADD_MESSAGE_AT(file, line, x) (static_cast<void>(0))
#define DOCTEST_ADD_FAIL_CHECK_AT(file, line, x) ((void)0) #define DOCTEST_ADD_FAIL_CHECK_AT(file, line, x) (static_cast<void>(0))
#define DOCTEST_ADD_FAIL_AT(file, line, x) ((void)0) #define DOCTEST_ADD_FAIL_AT(file, line, x) (static_cast<void>(0))
#define DOCTEST_MESSAGE(x) ((void)0) #define DOCTEST_MESSAGE(x) (static_cast<void>(0))
#define DOCTEST_FAIL_CHECK(x) ((void)0) #define DOCTEST_FAIL_CHECK(x) (static_cast<void>(0))
#define DOCTEST_FAIL(x) ((void)0) #define DOCTEST_FAIL(x) (static_cast<void>(0))
#define DOCTEST_WARN(...) ((void)0) #define DOCTEST_WARN(...) (static_cast<void>(0))
#define DOCTEST_CHECK(...) ((void)0) #define DOCTEST_CHECK(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE(...) ((void)0) #define DOCTEST_REQUIRE(...) (static_cast<void>(0))
#define DOCTEST_WARN_FALSE(...) ((void)0) #define DOCTEST_WARN_FALSE(...) (static_cast<void>(0))
#define DOCTEST_CHECK_FALSE(...) ((void)0) #define DOCTEST_CHECK_FALSE(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_FALSE(...) ((void)0) #define DOCTEST_REQUIRE_FALSE(...) (static_cast<void>(0))
#define DOCTEST_WARN_MESSAGE(cond, msg) ((void)0) #define DOCTEST_WARN_MESSAGE(cond, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_MESSAGE(cond, msg) ((void)0) #define DOCTEST_CHECK_MESSAGE(cond, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_MESSAGE(cond, msg) ((void)0) #define DOCTEST_REQUIRE_MESSAGE(cond, msg) (static_cast<void>(0))
#define DOCTEST_WARN_FALSE_MESSAGE(cond, msg) ((void)0) #define DOCTEST_WARN_FALSE_MESSAGE(cond, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_FALSE_MESSAGE(cond, msg) ((void)0) #define DOCTEST_CHECK_FALSE_MESSAGE(cond, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_FALSE_MESSAGE(cond, msg) ((void)0) #define DOCTEST_REQUIRE_FALSE_MESSAGE(cond, msg) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS(...) ((void)0) #define DOCTEST_WARN_THROWS(...) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS(...) ((void)0) #define DOCTEST_CHECK_THROWS(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS(...) ((void)0) #define DOCTEST_REQUIRE_THROWS(...) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_AS(expr, ...) ((void)0) #define DOCTEST_WARN_THROWS_AS(expr, ...) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_AS(expr, ...) ((void)0) #define DOCTEST_CHECK_THROWS_AS(expr, ...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) ((void)0) #define DOCTEST_REQUIRE_THROWS_AS(expr, ...) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_WITH(expr, ...) ((void)0) #define DOCTEST_WARN_THROWS_WITH(expr, ...) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_WITH(expr, ...) ((void)0) #define DOCTEST_CHECK_THROWS_WITH(expr, ...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) ((void)0) #define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) ((void)0) #define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) ((void)0) #define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) ((void)0) #define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) (static_cast<void>(0))
#define DOCTEST_WARN_NOTHROW(...) ((void)0) #define DOCTEST_WARN_NOTHROW(...) (static_cast<void>(0))
#define DOCTEST_CHECK_NOTHROW(...) ((void)0) #define DOCTEST_CHECK_NOTHROW(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_NOTHROW(...) ((void)0) #define DOCTEST_REQUIRE_NOTHROW(...) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) ((void)0) #define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) ((void)0) #define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) ((void)0) #define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) #define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) #define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0) #define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) (static_cast<void>(0))
#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) #define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0) #define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) ((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) ((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) ((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) ((void)0) #define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) (static_cast<void>(0))
#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) ((void)0) #define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) ((void)0) #define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) ((void)0) #define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) (static_cast<void>(0))
#define DOCTEST_WARN_EQ(...) ((void)0) #define DOCTEST_WARN_EQ(...) (static_cast<void>(0))
#define DOCTEST_CHECK_EQ(...) ((void)0) #define DOCTEST_CHECK_EQ(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_EQ(...) ((void)0) #define DOCTEST_REQUIRE_EQ(...) (static_cast<void>(0))
#define DOCTEST_WARN_NE(...) ((void)0) #define DOCTEST_WARN_NE(...) (static_cast<void>(0))
#define DOCTEST_CHECK_NE(...) ((void)0) #define DOCTEST_CHECK_NE(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_NE(...) ((void)0) #define DOCTEST_REQUIRE_NE(...) (static_cast<void>(0))
#define DOCTEST_WARN_GT(...) ((void)0) #define DOCTEST_WARN_GT(...) (static_cast<void>(0))
#define DOCTEST_CHECK_GT(...) ((void)0) #define DOCTEST_CHECK_GT(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_GT(...) ((void)0) #define DOCTEST_REQUIRE_GT(...) (static_cast<void>(0))
#define DOCTEST_WARN_LT(...) ((void)0) #define DOCTEST_WARN_LT(...) (static_cast<void>(0))
#define DOCTEST_CHECK_LT(...) ((void)0) #define DOCTEST_CHECK_LT(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_LT(...) ((void)0) #define DOCTEST_REQUIRE_LT(...) (static_cast<void>(0))
#define DOCTEST_WARN_GE(...) ((void)0) #define DOCTEST_WARN_GE(...) (static_cast<void>(0))
#define DOCTEST_CHECK_GE(...) ((void)0) #define DOCTEST_CHECK_GE(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_GE(...) ((void)0) #define DOCTEST_REQUIRE_GE(...) (static_cast<void>(0))
#define DOCTEST_WARN_LE(...) ((void)0) #define DOCTEST_WARN_LE(...) (static_cast<void>(0))
#define DOCTEST_CHECK_LE(...) ((void)0) #define DOCTEST_CHECK_LE(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_LE(...) ((void)0) #define DOCTEST_REQUIRE_LE(...) (static_cast<void>(0))
#define DOCTEST_WARN_UNARY(...) ((void)0) #define DOCTEST_WARN_UNARY(...) (static_cast<void>(0))
#define DOCTEST_CHECK_UNARY(...) ((void)0) #define DOCTEST_CHECK_UNARY(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_UNARY(...) ((void)0) #define DOCTEST_REQUIRE_UNARY(...) (static_cast<void>(0))
#define DOCTEST_WARN_UNARY_FALSE(...) ((void)0) #define DOCTEST_WARN_UNARY_FALSE(...) (static_cast<void>(0))
#define DOCTEST_CHECK_UNARY_FALSE(...) ((void)0) #define DOCTEST_CHECK_UNARY_FALSE(...) (static_cast<void>(0))
#define DOCTEST_REQUIRE_UNARY_FALSE(...) ((void)0) #define DOCTEST_REQUIRE_UNARY_FALSE(...) (static_cast<void>(0))
#endif // DOCTEST_CONFIG_DISABLE #endif // DOCTEST_CONFIG_DISABLE
@ -3742,8 +3767,8 @@ namespace {
DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations") DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
void color_to_stream(std::ostream& s, Color::Enum code) { void color_to_stream(std::ostream& s, Color::Enum code) {
((void)s); // for DOCTEST_CONFIG_COLORS_NONE or DOCTEST_CONFIG_COLORS_WINDOWS static_cast<void>(s); // for DOCTEST_CONFIG_COLORS_NONE or DOCTEST_CONFIG_COLORS_WINDOWS
((void)code); // for DOCTEST_CONFIG_COLORS_NONE static_cast<void>(code); // for DOCTEST_CONFIG_COLORS_NONE
#ifdef DOCTEST_CONFIG_COLORS_ANSI #ifdef DOCTEST_CONFIG_COLORS_ANSI
if(g_no_colors || if(g_no_colors ||
(isatty(STDOUT_FILENO) == false && getContextOptions()->force_colors == false)) (isatty(STDOUT_FILENO) == false && getContextOptions()->force_colors == false))
@ -3849,7 +3874,28 @@ namespace detail {
#ifdef DOCTEST_IS_DEBUGGER_ACTIVE #ifdef DOCTEST_IS_DEBUGGER_ACTIVE
bool isDebuggerActive() { return DOCTEST_IS_DEBUGGER_ACTIVE(); } bool isDebuggerActive() { return DOCTEST_IS_DEBUGGER_ACTIVE(); }
#else // 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: // The following function is taken directly from the following technical note:
// https://developer.apple.com/library/archive/qa/qa1361/_index.html // https://developer.apple.com/library/archive/qa/qa1361/_index.html
// Returns true if the current process is being debugged (either // Returns true if the current process is being debugged (either
@ -5460,25 +5506,28 @@ DOCTEST_CLANG_SUPPRESS_WARNING_POP
separator_to_stream(); separator_to_stream();
s << std::dec; 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; 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 << " | "
<< ((p.numTestCasesPassingFilters == 0 || anythingFailed) ? Color::None : << ((p.numTestCasesPassingFilters == 0 || anythingFailed) ? Color::None :
Color::Green) 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) << 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) { if(opt.no_skipped_summary == false) {
const int numSkipped = p.numTestCases - p.numTestCasesPassingFilters; 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; << " skipped" << Color::None;
} }
s << "\n"; 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 << " | "
<< ((p.numAsserts == 0 || anythingFailed) ? Color::None : Color::Green) << ((p.numAsserts == 0 || anythingFailed) ? Color::None : Color::Green)
<< std::setw(6) << (p.numAsserts - p.numAssertsFailed) << " passed" << Color::None << std::setw(passwidth) << (p.numAsserts - p.numAssertsFailed) << " passed" << Color::None
<< " | " << (p.numAssertsFailed > 0 ? Color::Red : Color::None) << std::setw(6) << " | " << (p.numAssertsFailed > 0 ? Color::Red : Color::None) << std::setw(failwidth)
<< p.numAssertsFailed << " failed" << Color::None << " |\n"; << p.numAssertsFailed << " failed" << Color::None << " |\n";
s << Color::Cyan << "[doctest] " << Color::None s << Color::Cyan << "[doctest] " << Color::None
<< "Status: " << (p.numTestCasesFailed > 0 ? Color::Red : Color::Green) << "Status: " << (p.numTestCasesFailed > 0 ? Color::Red : Color::Green)

View File

@ -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__)