// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // The Google C++ Testing and Mocking Framework (Google Test) // // This header file declares functions and macros used internally by // Google Test. They are subject to change without notice. // IWYU pragma: private, include "gtest/gtest.h" // IWYU pragma: friend gtest/.* // IWYU pragma: friend gmock/.* #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #include "gtest/internal/gtest-port.h" #ifdef GTEST_OS_LINUX #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #endif // GTEST_OS_LINUX #if GTEST_HAS_EXCEPTIONS #include <stdexcept> #endif #include <ctype.h> #include <float.h> #include <string.h> #include <cstdint> #include <functional> #include <limits> #include <map> #include <set> #include <string> #include <type_traits> #include <utility> #include <vector> #include "gtest/gtest-message.h" #include "gtest/internal/gtest-filepath.h" #include "gtest/internal/gtest-string.h" #include "gtest/internal/gtest-type-util.h" // Due to C++ preprocessor weirdness, we need double indirection to // concatenate two tokens when one of them is __LINE__. Writing // // foo ## __LINE__ // // will result in the token foo__LINE__, instead of foo followed by // the current line number. For more details, see // https://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6 #define GTEST_CONCAT_TOKEN_(foo, bar) … #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) … // Stringifies its argument. // Work around a bug in visual studio which doesn't accept code like this: // // #define GTEST_STRINGIFY_(name) #name // #define MACRO(a, b, c) ... GTEST_STRINGIFY_(a) ... // MACRO(, x, y) // // Complaining about the argument to GTEST_STRINGIFY_ being empty. // This is allowed by the spec. #define GTEST_STRINGIFY_HELPER_(name, ...) … #define GTEST_STRINGIFY_(...) … namespace proto2 { class MessageLite; } namespace testing { // Forward declarations. class AssertionResult; // Result of an assertion. class Message; // Represents a failure message. class Test; // Represents a test. class TestInfo; // Information about a test. class TestPartResult; // Result of a test part. class UnitTest; // A collection of test suites. template <typename T> ::std::string PrintToString(const T& value); namespace internal { struct TraceInfo; // Information about a trace point. class TestInfoImpl; // Opaque implementation of TestInfo class UnitTestImpl; // Opaque implementation of UnitTest // The text used in failure messages to indicate the start of the // stack trace. GTEST_API_ extern const char kStackTraceMarker[]; // An IgnoredValue object can be implicitly constructed from ANY value. class IgnoredValue { … }; // Appends the user-supplied message to the Google-Test-generated message. GTEST_API_ std::string AppendUserMessage(const std::string& gtest_msg, const Message& user_msg); #if GTEST_HAS_EXCEPTIONS GTEST_DISABLE_MSC_WARNINGS_PUSH_( 4275 /* an exported class was derived from a class that was not exported */) // This exception is thrown by (and only by) a failed Google Test // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions // are enabled). We derive it from std::runtime_error, which is for // errors presumably detectable only at run time. Since // std::runtime_error inherits from std::exception, many testing // frameworks know how to extract and print the message inside it. class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error { public: explicit GoogleTestFailureException(const TestPartResult& failure); }; GTEST_DISABLE_MSC_WARNINGS_POP_() // 4275 #endif // GTEST_HAS_EXCEPTIONS namespace edit_distance { // Returns the optimal edits to go from 'left' to 'right'. // All edits cost the same, with replace having lower priority than // add/remove. // Simple implementation of the Wagner-Fischer algorithm. // See https://en.wikipedia.org/wiki/Wagner-Fischer_algorithm enum EditType { … }; GTEST_API_ std::vector<EditType> CalculateOptimalEdits( const std::vector<size_t>& left, const std::vector<size_t>& right); // Same as above, but the input is represented as strings. GTEST_API_ std::vector<EditType> CalculateOptimalEdits( const std::vector<std::string>& left, const std::vector<std::string>& right); // Create a diff of the input strings in Unified diff format. GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left, const std::vector<std::string>& right, size_t context = 2); } // namespace edit_distance // Constructs and returns the message for an equality assertion // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. // // The first four parameters are the expressions used in the assertion // and their values, as strings. For example, for ASSERT_EQ(foo, bar) // where foo is 5 and bar is 6, we have: // // expected_expression: "foo" // actual_expression: "bar" // expected_value: "5" // actual_value: "6" // // The ignoring_case parameter is true if and only if the assertion is a // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will // be inserted into the message. GTEST_API_ AssertionResult EqFailure(const char* expected_expression, const char* actual_expression, const std::string& expected_value, const std::string& actual_value, bool ignoring_case); // Constructs a failure message for Boolean assertions such as EXPECT_TRUE. GTEST_API_ std::string GetBoolAssertionFailureMessage( const AssertionResult& assertion_result, const char* expression_text, const char* actual_predicate_value, const char* expected_predicate_value); // This template class represents an IEEE floating-point number // (either single-precision or double-precision, depending on the // template parameters). // // The purpose of this class is to do more sophisticated number // comparison. (Due to round-off error, etc, it's very unlikely that // two floating-points will be equal exactly. Hence a naive // comparison by the == operation often doesn't work.) // // Format of IEEE floating-point: // // The most-significant bit being the leftmost, an IEEE // floating-point looks like // // sign_bit exponent_bits fraction_bits // // Here, sign_bit is a single bit that designates the sign of the // number. // // For float, there are 8 exponent bits and 23 fraction bits. // // For double, there are 11 exponent bits and 52 fraction bits. // // More details can be found at // https://en.wikipedia.org/wiki/IEEE_floating-point_standard. // // Template parameter: // // RawType: the raw floating-point type (either float or double) template <typename RawType> class FloatingPoint { … }; // Typedefs the instances of the FloatingPoint template class that we // care to use. Float; Double; // In order to catch the mistake of putting tests that use different // test fixture classes in the same test suite, we need to assign // unique IDs to fixture classes and compare them. The TypeId type is // used to hold such IDs. The user should treat TypeId as an opaque // type: the only operation allowed on TypeId values is to compare // them for equality using the == operator. TypeId; template <typename T> class TypeIdHelper { … }; template <typename T> bool TypeIdHelper<T>::dummy_ = …; // GetTypeId<T>() returns the ID of type T. Different values will be // returned for different types. Calling the function twice with the // same type argument is guaranteed to return the same ID. template <typename T> TypeId GetTypeId() { … } // Returns the type ID of ::testing::Test. Always call this instead // of GetTypeId< ::testing::Test>() to get the type ID of // ::testing::Test, as the latter may give the wrong result due to a // suspected linker bug when compiling Google Test as a Mac OS X // framework. GTEST_API_ TypeId GetTestTypeId(); // Defines the abstract factory interface that creates instances // of a Test object. class TestFactoryBase { … }; // This class provides implementation of TestFactoryBase interface. // It is used in TEST and TEST_F macros. template <class TestClass> class TestFactoryImpl : public TestFactoryBase { … }; #ifdef GTEST_OS_WINDOWS // Predicate-formatters for implementing the HRESULT checking macros // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED} // We pass a long instead of HRESULT to avoid causing an // include dependency for the HRESULT type. GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr, long hr); // NOLINT GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr, long hr); // NOLINT #endif // GTEST_OS_WINDOWS // Types of SetUpTestSuite() and TearDownTestSuite() functions. SetUpTestSuiteFunc; TearDownTestSuiteFunc; struct CodeLocation { … }; // Helper to identify which setup function for TestCase / TestSuite to call. // Only one function is allowed, either TestCase or TestSute but not both. // Utility functions to help SuiteApiResolver SetUpTearDownSuiteFuncType; inline SetUpTearDownSuiteFuncType GetNotDefaultOrNull( SetUpTearDownSuiteFuncType a, SetUpTearDownSuiteFuncType def) { … } template <typename T> // Note that SuiteApiResolver inherits from T because // SetUpTestSuite()/TearDownTestSuite() could be protected. This way // SuiteApiResolver can access them. struct SuiteApiResolver : T { … }; // Creates a new TestInfo object and registers it with Google Test; // returns the created object. // // Arguments: // // test_suite_name: name of the test suite // name: name of the test // type_param: the name of the test's type parameter, or NULL if // this is not a typed or a type-parameterized test. // value_param: text representation of the test's value parameter, // or NULL if this is not a value-parameterized test. // code_location: code location where the test is defined // fixture_class_id: ID of the test fixture class // set_up_tc: pointer to the function that sets up the test suite // tear_down_tc: pointer to the function that tears down the test suite // factory: pointer to the factory that creates a test object. // The newly created TestInfo instance will assume // ownership of the factory object. GTEST_API_ TestInfo* MakeAndRegisterTestInfo( std::string test_suite_name, const char* name, const char* type_param, const char* value_param, CodeLocation code_location, TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory); // If *pstr starts with the given prefix, modifies *pstr to be right // past the prefix and returns true; otherwise leaves *pstr unchanged // and returns false. None of pstr, *pstr, and prefix can be NULL. GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr); GTEST_DISABLE_MSC_WARNINGS_PUSH_(…) // State of the definition of a type-parameterized test suite. class GTEST_API_ TypedTestSuitePState { … }; // Legacy API is deprecated but still available #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ TypedTestCasePState; #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ GTEST_DISABLE_MSC_WARNINGS_POP_(…) // 4251 // Skips to the first non-space char after the first comma in 'str'; // returns NULL if no comma is found in 'str'. inline const char* SkipComma(const char* str) { … } // Returns the prefix of 'str' before the first comma in it; returns // the entire string if it contains no comma. inline std::string GetPrefixUntilComma(const char* str) { … } // Splits a given string on a given delimiter, populating a given // vector with the fields. void SplitString(const ::std::string& str, char delimiter, ::std::vector<::std::string>* dest); // The default argument to the template below for the case when the user does // not provide a name generator. struct DefaultNameGenerator { … }; template <typename Provided = DefaultNameGenerator> struct NameGeneratorSelector { … }; template <typename NameGenerator> void GenerateNamesRecursively(internal::None, std::vector<std::string>*, int) { … } template <typename NameGenerator, typename Types> void GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) { … } template <typename NameGenerator, typename Types> std::vector<std::string> GenerateNames() { … } // TypeParameterizedTest<Fixture, TestSel, Types>::Register() // registers a list of type-parameterized tests with Google Test. The // return value is insignificant - we just need to return something // such that we can call this function in a namespace scope. // // Implementation note: The GTEST_TEMPLATE_ macro declares a template // template parameter. It's defined in gtest-type-util.h. template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types> class TypeParameterizedTest { … }; // The base case for the compile time recursion. TypeParameterizedTest<Fixture, TestSel, internal::None>; GTEST_API_ void RegisterTypeParameterizedTestSuite(const char* test_suite_name, CodeLocation code_location); GTEST_API_ void RegisterTypeParameterizedTestSuiteInstantiation( const char* case_name); // TypeParameterizedTestSuite<Fixture, Tests, Types>::Register() // registers *all combinations* of 'Tests' and 'Types' with Google // Test. The return value is insignificant - we just need to return // something such that we can call this function in a namespace scope. template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types> class TypeParameterizedTestSuite { … }; // The base case for the compile time recursion. TypeParameterizedTestSuite<Fixture, internal::None, Types>; // Returns the current OS stack trace as an std::string. // // The maximum number of stack frames to be included is specified by // the gtest_stack_trace_depth flag. The skip_count parameter // specifies the number of top frames to be skipped, which doesn't // count against the number of frames to be included. // // For example, if Foo() calls Bar(), which in turn calls // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(int skip_count); // Helpers for suppressing warnings on unreachable code or constant // condition. // Always returns true. GTEST_API_ bool AlwaysTrue(); // Always returns false. inline bool AlwaysFalse() { … } // Helper for suppressing false warning from Clang on a const char* // variable declared in a conditional expression always being NULL in // the else branch. struct GTEST_API_ ConstCharPtr { … }; // Helper for declaring std::string within 'if' statement // in pre C++17 build environment. struct TrueWithString { … }; // A simple Linear Congruential Generator for generating random // numbers with a uniform distribution. Unlike rand() and srand(), it // doesn't use global state (and therefore can't interfere with user // code). Unlike rand_r(), it's portable. An LCG isn't very random, // but it's good enough for our purposes. class GTEST_API_ Random { … }; // Turns const U&, U&, const U, and U all into U. #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) … // HasDebugStringAndShortDebugString<T>::value is a compile-time bool constant // that's true if and only if T has methods DebugString() and ShortDebugString() // that return std::string. template <typename T> class HasDebugStringAndShortDebugString { … }; #ifdef GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL template <typename T> constexpr bool HasDebugStringAndShortDebugString<T>::value; #endif // When the compiler sees expression IsContainerTest<C>(0), if C is an // STL-style container class, the first overload of IsContainerTest // will be viable (since both C::iterator* and C::const_iterator* are // valid types and NULL can be implicitly converted to them). It will // be picked over the second overload as 'int' is a perfect match for // the type of argument 0. If C::iterator or C::const_iterator is not // a valid type, the first overload is not viable, and the second // overload will be picked. Therefore, we can determine whether C is // a container class by checking the type of IsContainerTest<C>(0). // The value of the expression is insignificant. // // In C++11 mode we check the existence of a const_iterator and that an // iterator is properly implemented for the container. // // For pre-C++11 that we look for both C::iterator and C::const_iterator. // The reason is that C++ injects the name of a class as a member of the // class itself (e.g. you can refer to class iterator as either // 'iterator' or 'iterator::iterator'). If we look for C::iterator // only, for example, we would mistakenly think that a class named // iterator is an STL container. // // Also note that the simpler approach of overloading // IsContainerTest(typename C::const_iterator*) and // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++. IsContainer; template <class C, class Iterator = decltype(::std::declval<const C&>().begin()), class = decltype(::std::declval<const C&>().end()), class = decltype(++::std::declval<Iterator&>()), class = decltype(*::std::declval<Iterator>()), class = typename C::const_iterator> IsContainer IsContainerTest(int /* dummy */) { … } IsNotContainer; template <class C> IsNotContainer IsContainerTest(long /* dummy */) { … } // Trait to detect whether a type T is a hash table. // The heuristic used is that the type contains an inner type `hasher` and does // not contain an inner type `reverse_iterator`. // If the container is iterable in reverse, then order might actually matter. template <typename T> struct IsHashTable { … }; template <typename T> const bool IsHashTable<T>::value; template <typename C, bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer)> struct IsRecursiveContainerImpl; IsRecursiveContainerImpl<C, false>; // Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to // obey the same inconsistencies as the IsContainerTest, namely check if // something is a container is relying on only const_iterator in C++11 and // is relying on both const_iterator and iterator otherwise IsRecursiveContainerImpl<C, true>; // IsRecursiveContainer<Type> is a unary compile-time predicate that // evaluates whether C is a recursive container type. A recursive container // type is a container type whose value_type is equal to the container type // itself. An example for a recursive container type is // boost::filesystem::path, whose iterator has a value_type that is equal to // boost::filesystem::path. template <typename C> struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type { … }; // Utilities for native arrays. // ArrayEq() compares two k-dimensional native arrays using the // elements' operator==, where k can be any integer >= 0. When k is // 0, ArrayEq() degenerates into comparing a single pair of values. template <typename T, typename U> bool ArrayEq(const T* lhs, size_t size, const U* rhs); // This generic version is used when k is 0. template <typename T, typename U> inline bool ArrayEq(const T& lhs, const U& rhs) { … } // This overload is used when k >= 1. template <typename T, typename U, size_t N> inline bool ArrayEq(const T (&lhs)[N], const U (&rhs)[N]) { … } // This helper reduces code bloat. If we instead put its logic inside // the previous ArrayEq() function, arrays with different sizes would // lead to different copies of the template code. template <typename T, typename U> bool ArrayEq(const T* lhs, size_t size, const U* rhs) { … } // Finds the first element in the iterator range [begin, end) that // equals elem. Element may be a native array type itself. template <typename Iter, typename Element> Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) { … } // CopyArray() copies a k-dimensional native array using the elements' // operator=, where k can be any integer >= 0. When k is 0, // CopyArray() degenerates into copying a single value. template <typename T, typename U> void CopyArray(const T* from, size_t size, U* to); // This generic version is used when k is 0. template <typename T, typename U> inline void CopyArray(const T& from, U* to) { … } // This overload is used when k >= 1. template <typename T, typename U, size_t N> inline void CopyArray(const T (&from)[N], U (*to)[N]) { … } // This helper reduces code bloat. If we instead put its logic inside // the previous CopyArray() function, arrays with different sizes // would lead to different copies of the template code. template <typename T, typename U> void CopyArray(const T* from, size_t size, U* to) { … } // The relation between an NativeArray object (see below) and the // native array it represents. // We use 2 different structs to allow non-copyable types to be used, as long // as RelationToSourceReference() is passed. struct RelationToSourceReference { … }; struct RelationToSourceCopy { … }; // Adapts a native array to a read-only STL-style container. Instead // of the complete STL container concept, this adaptor only implements // members useful for Google Mock's container matchers. New members // should be added as needed. To simplify the implementation, we only // support Element being a raw type (i.e. having no top-level const or // reference modifier). It's the client's responsibility to satisfy // this requirement. Element can be an array type itself (hence // multi-dimensional arrays are supported). template <typename Element> class NativeArray { … }; template <size_t> struct Ignore { … }; template <typename> struct ElemFromListImpl; ElemFromListImpl<std::index_sequence<I...>>; template <size_t N, typename... T> struct ElemFromList { … }; struct FlatTupleConstructTag { … }; template <typename... T> class FlatTuple; template <typename Derived, size_t I> struct FlatTupleElemBase; FlatTupleElemBase<FlatTuple<T...>, I>; template <typename Derived, typename Idx> struct FlatTupleBase; FlatTupleBase<FlatTuple<T...>, std::index_sequence<Idx...>>; // Analog to std::tuple but with different tradeoffs. // This class minimizes the template instantiation depth, thus allowing more // elements than std::tuple would. std::tuple has been seen to require an // instantiation depth of more than 10x the number of elements in some // implementations. // FlatTuple and ElemFromList are not recursive and have a fixed depth // regardless of T... // std::make_index_sequence, on the other hand, it is recursive but with an // instantiation depth of O(ln(N)). template <typename... T> class FlatTuple : private FlatTupleBase<FlatTuple<T...>, std::make_index_sequence<sizeof...(T)>> { … }; // Utility functions to be called with static_assert to induce deprecation // warnings. GTEST_INTERNAL_DEPRECATED( "INSTANTIATE_TEST_CASE_P is deprecated, please use " "INSTANTIATE_TEST_SUITE_P") constexpr bool InstantiateTestCase_P_IsDeprecated() { … } GTEST_INTERNAL_DEPRECATED( "TYPED_TEST_CASE_P is deprecated, please use " "TYPED_TEST_SUITE_P") constexpr bool TypedTestCase_P_IsDeprecated() { … } GTEST_INTERNAL_DEPRECATED( "TYPED_TEST_CASE is deprecated, please use " "TYPED_TEST_SUITE") constexpr bool TypedTestCaseIsDeprecated() { … } GTEST_INTERNAL_DEPRECATED( "REGISTER_TYPED_TEST_CASE_P is deprecated, please use " "REGISTER_TYPED_TEST_SUITE_P") constexpr bool RegisterTypedTestCase_P_IsDeprecated() { … } GTEST_INTERNAL_DEPRECATED( "INSTANTIATE_TYPED_TEST_CASE_P is deprecated, please use " "INSTANTIATE_TYPED_TEST_SUITE_P") constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { … } } // namespace internal } // namespace testing namespace std { // Some standard library implementations use `struct tuple_size` and some use // `class tuple_size`. Clang warns about the mismatch. // https://reviews.llvm.org/D55466 #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmismatched-tags" #endif tuple_size<testing::internal::FlatTuple<Ts...>>; #ifdef __clang__ #pragma clang diagnostic pop #endif } // namespace std #define GTEST_MESSAGE_AT_(file, line, message, result_type) … #define GTEST_MESSAGE_(message, result_type) … #define GTEST_FATAL_FAILURE_(message) … #define GTEST_NONFATAL_FAILURE_(message) … #define GTEST_SUCCESS_(message) … #define GTEST_SKIP_(message) … // Suppress MSVC warning 4072 (unreachable code) for the code following // statement if it returns or throws (or doesn't return or throw in some // situations). // NOTE: The "else" is important to keep this expansion to prevent a top-level // "else" from attaching to our "if". #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) … #if GTEST_HAS_EXCEPTIONS namespace testing { namespace internal { class NeverThrown { public: const char* what() const noexcept { return "this exception should never be thrown"; } }; } // namespace internal } // namespace testing #if GTEST_HAS_RTTI #define GTEST_EXCEPTION_TYPE_ … #else // GTEST_HAS_RTTI #define GTEST_EXCEPTION_TYPE_ … #endif // GTEST_HAS_RTTI #define GTEST_TEST_THROW_CATCH_STD_EXCEPTION_ … #else // GTEST_HAS_EXCEPTIONS #define GTEST_TEST_THROW_CATCH_STD_EXCEPTION_(statement, expected_exception) … #endif // GTEST_HAS_EXCEPTIONS #define GTEST_TEST_THROW_(statement, expected_exception, fail) … #if GTEST_HAS_EXCEPTIONS #define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_ … #else // GTEST_HAS_EXCEPTIONS #define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() … #endif // GTEST_HAS_EXCEPTIONS #define GTEST_TEST_NO_THROW_(statement, fail) … #define GTEST_TEST_ANY_THROW_(statement, fail) … // Implements Boolean test assertions such as EXPECT_TRUE. expression can be // either a boolean expression or an AssertionResult. text is a textual // representation of expression as it was passed into the EXPECT_TRUE. #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) … #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) … // Expands to the name of the class that implements the given test. #define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) … // Helper macro for defining tests. #define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) … #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_