|
@@ -27,7 +27,6 @@
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
-//
|
|
|
|
// The Google C++ Testing and Mocking Framework (Google Test)
|
|
// The Google C++ Testing and Mocking Framework (Google Test)
|
|
//
|
|
//
|
|
// This header file defines the public API for Google Test. It should be
|
|
// This header file defines the public API for Google Test. It should be
|
|
@@ -47,8 +46,6 @@
|
|
// registration from Barthelemy Dagenais' ([email protected])
|
|
// registration from Barthelemy Dagenais' ([email protected])
|
|
// easyUnit framework.
|
|
// easyUnit framework.
|
|
|
|
|
|
-// GOOGLETEST_CM0001 DO NOT DELETE
|
|
|
|
-
|
|
|
|
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_H_
|
|
#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_H_
|
|
#define GOOGLETEST_INCLUDE_GTEST_GTEST_H_
|
|
#define GOOGLETEST_INCLUDE_GTEST_GTEST_H_
|
|
|
|
|
|
@@ -59,31 +56,22 @@
|
|
#include <type_traits>
|
|
#include <type_traits>
|
|
#include <vector>
|
|
#include <vector>
|
|
|
|
|
|
-#include "gtest/internal/gtest-internal.h"
|
|
|
|
-#include "gtest/internal/gtest-string.h"
|
|
|
|
|
|
+#include "gtest/gtest-assertion-result.h"
|
|
#include "gtest/gtest-death-test.h"
|
|
#include "gtest/gtest-death-test.h"
|
|
#include "gtest/gtest-matchers.h"
|
|
#include "gtest/gtest-matchers.h"
|
|
#include "gtest/gtest-message.h"
|
|
#include "gtest/gtest-message.h"
|
|
#include "gtest/gtest-param-test.h"
|
|
#include "gtest/gtest-param-test.h"
|
|
#include "gtest/gtest-printers.h"
|
|
#include "gtest/gtest-printers.h"
|
|
-#include "gtest/gtest_prod.h"
|
|
|
|
#include "gtest/gtest-test-part.h"
|
|
#include "gtest/gtest-test-part.h"
|
|
#include "gtest/gtest-typed-test.h"
|
|
#include "gtest/gtest-typed-test.h"
|
|
|
|
+#include "gtest/gtest_pred_impl.h"
|
|
|
|
+#include "gtest/gtest_prod.h"
|
|
|
|
+#include "gtest/internal/gtest-internal.h"
|
|
|
|
+#include "gtest/internal/gtest-string.h"
|
|
|
|
|
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
|
|
|
|
|
-namespace testing {
|
|
|
|
-
|
|
|
|
-// Silence C4100 (unreferenced formal parameter) and 4805
|
|
|
|
-// unsafe mix of type 'const int' and type 'const bool'
|
|
|
|
-#ifdef _MSC_VER
|
|
|
|
-# pragma warning(push)
|
|
|
|
-# pragma warning(disable:4805)
|
|
|
|
-# pragma warning(disable:4100)
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// Declares the flags.
|
|
// Declares the flags.
|
|
|
|
|
|
// This flag temporary enables the disabled tests.
|
|
// This flag temporary enables the disabled tests.
|
|
@@ -138,6 +126,12 @@ GTEST_DECLARE_int32_(random_seed);
|
|
// is 1. If the value is -1 the tests are repeating forever.
|
|
// is 1. If the value is -1 the tests are repeating forever.
|
|
GTEST_DECLARE_int32_(repeat);
|
|
GTEST_DECLARE_int32_(repeat);
|
|
|
|
|
|
|
|
+// This flag controls whether Google Test Environments are recreated for each
|
|
|
|
+// repeat of the tests. The default value is true. If set to false the global
|
|
|
|
+// test Environment objects are only set up once, for the first iteration, and
|
|
|
|
+// only torn down once, for the last.
|
|
|
|
+GTEST_DECLARE_bool_(recreate_environments_when_repeating);
|
|
|
|
+
|
|
// This flag controls whether Google Test includes Google Test internal
|
|
// This flag controls whether Google Test includes Google Test internal
|
|
// stack frames in failure stack traces.
|
|
// stack frames in failure stack traces.
|
|
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
|
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
|
@@ -163,6 +157,16 @@ GTEST_DECLARE_string_(stream_result_to);
|
|
GTEST_DECLARE_string_(flagfile);
|
|
GTEST_DECLARE_string_(flagfile);
|
|
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
|
|
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
|
|
|
|
|
|
|
|
+namespace testing {
|
|
|
|
+
|
|
|
|
+// Silence C4100 (unreferenced formal parameter) and 4805
|
|
|
|
+// unsafe mix of type 'const int' and type 'const bool'
|
|
|
|
+#ifdef _MSC_VER
|
|
|
|
+#pragma warning(push)
|
|
|
|
+#pragma warning(disable : 4805)
|
|
|
|
+#pragma warning(disable : 4100)
|
|
|
|
+#endif
|
|
|
|
+
|
|
// The upper limit for valid stack trace depths.
|
|
// The upper limit for valid stack trace depths.
|
|
const int kMaxStackTraceDepth = 100;
|
|
const int kMaxStackTraceDepth = 100;
|
|
|
|
|
|
@@ -201,193 +205,6 @@ using TestCase = TestSuite;
|
|
class TestInfo;
|
|
class TestInfo;
|
|
class UnitTest;
|
|
class UnitTest;
|
|
|
|
|
|
-// A class for indicating whether an assertion was successful. When
|
|
|
|
-// the assertion wasn't successful, the AssertionResult object
|
|
|
|
-// remembers a non-empty message that describes how it failed.
|
|
|
|
-//
|
|
|
|
-// To create an instance of this class, use one of the factory functions
|
|
|
|
-// (AssertionSuccess() and AssertionFailure()).
|
|
|
|
-//
|
|
|
|
-// This class is useful for two purposes:
|
|
|
|
-// 1. Defining predicate functions to be used with Boolean test assertions
|
|
|
|
-// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
|
|
|
|
-// 2. Defining predicate-format functions to be
|
|
|
|
-// used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
|
|
|
|
-//
|
|
|
|
-// For example, if you define IsEven predicate:
|
|
|
|
-//
|
|
|
|
-// testing::AssertionResult IsEven(int n) {
|
|
|
|
-// if ((n % 2) == 0)
|
|
|
|
-// return testing::AssertionSuccess();
|
|
|
|
-// else
|
|
|
|
-// return testing::AssertionFailure() << n << " is odd";
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
|
|
|
|
-// will print the message
|
|
|
|
-//
|
|
|
|
-// Value of: IsEven(Fib(5))
|
|
|
|
-// Actual: false (5 is odd)
|
|
|
|
-// Expected: true
|
|
|
|
-//
|
|
|
|
-// instead of a more opaque
|
|
|
|
-//
|
|
|
|
-// Value of: IsEven(Fib(5))
|
|
|
|
-// Actual: false
|
|
|
|
-// Expected: true
|
|
|
|
-//
|
|
|
|
-// in case IsEven is a simple Boolean predicate.
|
|
|
|
-//
|
|
|
|
-// If you expect your predicate to be reused and want to support informative
|
|
|
|
-// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
|
|
|
|
-// about half as often as positive ones in our tests), supply messages for
|
|
|
|
-// both success and failure cases:
|
|
|
|
-//
|
|
|
|
-// testing::AssertionResult IsEven(int n) {
|
|
|
|
-// if ((n % 2) == 0)
|
|
|
|
-// return testing::AssertionSuccess() << n << " is even";
|
|
|
|
-// else
|
|
|
|
-// return testing::AssertionFailure() << n << " is odd";
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
|
|
|
|
-//
|
|
|
|
-// Value of: IsEven(Fib(6))
|
|
|
|
-// Actual: true (8 is even)
|
|
|
|
-// Expected: false
|
|
|
|
-//
|
|
|
|
-// NB: Predicates that support negative Boolean assertions have reduced
|
|
|
|
-// performance in positive ones so be careful not to use them in tests
|
|
|
|
-// that have lots (tens of thousands) of positive Boolean assertions.
|
|
|
|
-//
|
|
|
|
-// To use this class with EXPECT_PRED_FORMAT assertions such as:
|
|
|
|
-//
|
|
|
|
-// // Verifies that Foo() returns an even number.
|
|
|
|
-// EXPECT_PRED_FORMAT1(IsEven, Foo());
|
|
|
|
-//
|
|
|
|
-// you need to define:
|
|
|
|
-//
|
|
|
|
-// testing::AssertionResult IsEven(const char* expr, int n) {
|
|
|
|
-// if ((n % 2) == 0)
|
|
|
|
-// return testing::AssertionSuccess();
|
|
|
|
-// else
|
|
|
|
-// return testing::AssertionFailure()
|
|
|
|
-// << "Expected: " << expr << " is even\n Actual: it's " << n;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// If Foo() returns 5, you will see the following message:
|
|
|
|
-//
|
|
|
|
-// Expected: Foo() is even
|
|
|
|
-// Actual: it's 5
|
|
|
|
-//
|
|
|
|
-class GTEST_API_ AssertionResult {
|
|
|
|
- public:
|
|
|
|
- // Copy constructor.
|
|
|
|
- // Used in EXPECT_TRUE/FALSE(assertion_result).
|
|
|
|
- AssertionResult(const AssertionResult& other);
|
|
|
|
-
|
|
|
|
-// C4800 is a level 3 warning in Visual Studio 2015 and earlier.
|
|
|
|
-// This warning is not emitted in Visual Studio 2017.
|
|
|
|
-// This warning is off by default starting in Visual Studio 2019 but can be
|
|
|
|
-// enabled with command-line options.
|
|
|
|
-#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
|
|
|
- GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- // Used in the EXPECT_TRUE/FALSE(bool_expression).
|
|
|
|
- //
|
|
|
|
- // T must be contextually convertible to bool.
|
|
|
|
- //
|
|
|
|
- // The second parameter prevents this overload from being considered if
|
|
|
|
- // the argument is implicitly convertible to AssertionResult. In that case
|
|
|
|
- // we want AssertionResult's copy constructor to be used.
|
|
|
|
- template <typename T>
|
|
|
|
- explicit AssertionResult(
|
|
|
|
- const T& success,
|
|
|
|
- typename std::enable_if<
|
|
|
|
- !std::is_convertible<T, AssertionResult>::value>::type*
|
|
|
|
- /*enabler*/
|
|
|
|
- = nullptr)
|
|
|
|
- : success_(success) {}
|
|
|
|
-
|
|
|
|
-#if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
|
|
|
|
- GTEST_DISABLE_MSC_WARNINGS_POP_()
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- // Assignment operator.
|
|
|
|
- AssertionResult& operator=(AssertionResult other) {
|
|
|
|
- swap(other);
|
|
|
|
- return *this;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Returns true if and only if the assertion succeeded.
|
|
|
|
- operator bool() const { return success_; } // NOLINT
|
|
|
|
-
|
|
|
|
- // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
|
|
|
|
- AssertionResult operator!() const;
|
|
|
|
-
|
|
|
|
- // Returns the text streamed into this AssertionResult. Test assertions
|
|
|
|
- // use it when they fail (i.e., the predicate's outcome doesn't match the
|
|
|
|
- // assertion's expectation). When nothing has been streamed into the
|
|
|
|
- // object, returns an empty string.
|
|
|
|
- const char* message() const {
|
|
|
|
- return message_.get() != nullptr ? message_->c_str() : "";
|
|
|
|
- }
|
|
|
|
- // Deprecated; please use message() instead.
|
|
|
|
- const char* failure_message() const { return message(); }
|
|
|
|
-
|
|
|
|
- // Streams a custom failure message into this object.
|
|
|
|
- template <typename T> AssertionResult& operator<<(const T& value) {
|
|
|
|
- AppendMessage(Message() << value);
|
|
|
|
- return *this;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Allows streaming basic output manipulators such as endl or flush into
|
|
|
|
- // this object.
|
|
|
|
- AssertionResult& operator<<(
|
|
|
|
- ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
|
|
|
|
- AppendMessage(Message() << basic_manipulator);
|
|
|
|
- return *this;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private:
|
|
|
|
- // Appends the contents of message to message_.
|
|
|
|
- void AppendMessage(const Message& a_message) {
|
|
|
|
- if (message_.get() == nullptr) message_.reset(new ::std::string);
|
|
|
|
- message_->append(a_message.GetString().c_str());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Swap the contents of this AssertionResult with other.
|
|
|
|
- void swap(AssertionResult& other);
|
|
|
|
-
|
|
|
|
- // Stores result of the assertion predicate.
|
|
|
|
- bool success_;
|
|
|
|
- // Stores the message describing the condition in case the expectation
|
|
|
|
- // construct is not satisfied with the predicate's outcome.
|
|
|
|
- // Referenced via a pointer to avoid taking too much stack frame space
|
|
|
|
- // with test assertions.
|
|
|
|
- std::unique_ptr< ::std::string> message_;
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-// Makes a successful assertion result.
|
|
|
|
-GTEST_API_ AssertionResult AssertionSuccess();
|
|
|
|
-
|
|
|
|
-// Makes a failed assertion result.
|
|
|
|
-GTEST_API_ AssertionResult AssertionFailure();
|
|
|
|
-
|
|
|
|
-// Makes a failed assertion result with the given failure message.
|
|
|
|
-// Deprecated; use AssertionFailure() << msg.
|
|
|
|
-GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
|
|
|
|
-
|
|
|
|
-} // namespace testing
|
|
|
|
-
|
|
|
|
-// Includes the auto-generated header that implements a family of generic
|
|
|
|
-// predicate assertion macros. This include comes late because it relies on
|
|
|
|
-// APIs declared above.
|
|
|
|
-#include "gtest/gtest_pred_impl.h"
|
|
|
|
-
|
|
|
|
-namespace testing {
|
|
|
|
-
|
|
|
|
// The abstract class that all tests inherit from.
|
|
// The abstract class that all tests inherit from.
|
|
//
|
|
//
|
|
// In Google Test, a unit test program contains one or many TestSuites, and
|
|
// In Google Test, a unit test program contains one or many TestSuites, and
|
|
@@ -522,7 +339,8 @@ class GTEST_API_ Test {
|
|
virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
|
|
virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
|
|
|
|
|
|
// We disallow copying Tests.
|
|
// We disallow copying Tests.
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
|
|
|
|
|
|
+ Test(const Test&) = delete;
|
|
|
|
+ Test& operator=(const Test&) = delete;
|
|
};
|
|
};
|
|
|
|
|
|
typedef internal::TimeInMillis TimeInMillis;
|
|
typedef internal::TimeInMillis TimeInMillis;
|
|
@@ -536,24 +354,17 @@ class TestProperty {
|
|
// C'tor. TestProperty does NOT have a default constructor.
|
|
// C'tor. TestProperty does NOT have a default constructor.
|
|
// Always use this constructor (with parameters) to create a
|
|
// Always use this constructor (with parameters) to create a
|
|
// TestProperty object.
|
|
// TestProperty object.
|
|
- TestProperty(const std::string& a_key, const std::string& a_value) :
|
|
|
|
- key_(a_key), value_(a_value) {
|
|
|
|
- }
|
|
|
|
|
|
+ TestProperty(const std::string& a_key, const std::string& a_value)
|
|
|
|
+ : key_(a_key), value_(a_value) {}
|
|
|
|
|
|
// Gets the user supplied key.
|
|
// Gets the user supplied key.
|
|
- const char* key() const {
|
|
|
|
- return key_.c_str();
|
|
|
|
- }
|
|
|
|
|
|
+ const char* key() const { return key_.c_str(); }
|
|
|
|
|
|
// Gets the user supplied value.
|
|
// Gets the user supplied value.
|
|
- const char* value() const {
|
|
|
|
- return value_.c_str();
|
|
|
|
- }
|
|
|
|
|
|
+ const char* value() const { return value_.c_str(); }
|
|
|
|
|
|
// Sets a new value, overriding the one supplied in the constructor.
|
|
// Sets a new value, overriding the one supplied in the constructor.
|
|
- void SetValue(const std::string& new_value) {
|
|
|
|
- value_ = new_value;
|
|
|
|
- }
|
|
|
|
|
|
+ void SetValue(const std::string& new_value) { value_ = new_value; }
|
|
|
|
|
|
private:
|
|
private:
|
|
// The key supplied by the user.
|
|
// The key supplied by the user.
|
|
@@ -687,7 +498,8 @@ class GTEST_API_ TestResult {
|
|
TimeInMillis elapsed_time_;
|
|
TimeInMillis elapsed_time_;
|
|
|
|
|
|
// We disallow copying TestResult.
|
|
// We disallow copying TestResult.
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
|
|
|
|
|
|
+ TestResult(const TestResult&) = delete;
|
|
|
|
+ TestResult& operator=(const TestResult&) = delete;
|
|
}; // class TestResult
|
|
}; // class TestResult
|
|
|
|
|
|
// A TestInfo object stores the following information about a test:
|
|
// A TestInfo object stores the following information about a test:
|
|
@@ -811,8 +623,8 @@ class GTEST_API_ TestInfo {
|
|
}
|
|
}
|
|
|
|
|
|
// These fields are immutable properties of the test.
|
|
// These fields are immutable properties of the test.
|
|
- const std::string test_suite_name_; // test suite name
|
|
|
|
- const std::string name_; // Test name
|
|
|
|
|
|
+ const std::string test_suite_name_; // test suite name
|
|
|
|
+ const std::string name_; // Test name
|
|
// Name of the parameter type, or NULL if this is not a typed or a
|
|
// Name of the parameter type, or NULL if this is not a typed or a
|
|
// type-parameterized test.
|
|
// type-parameterized test.
|
|
const std::unique_ptr<const ::std::string> type_param_;
|
|
const std::unique_ptr<const ::std::string> type_param_;
|
|
@@ -833,7 +645,8 @@ class GTEST_API_ TestInfo {
|
|
// test for the second time.
|
|
// test for the second time.
|
|
TestResult result_;
|
|
TestResult result_;
|
|
|
|
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
|
|
|
|
|
|
+ TestInfo(const TestInfo&) = delete;
|
|
|
|
+ TestInfo& operator=(const TestInfo&) = delete;
|
|
};
|
|
};
|
|
|
|
|
|
// A test suite, which consists of a vector of TestInfos.
|
|
// A test suite, which consists of a vector of TestInfos.
|
|
@@ -941,7 +754,7 @@ class GTEST_API_ TestSuite {
|
|
|
|
|
|
// Adds a TestInfo to this test suite. Will delete the TestInfo upon
|
|
// Adds a TestInfo to this test suite. Will delete the TestInfo upon
|
|
// destruction of the TestSuite object.
|
|
// destruction of the TestSuite object.
|
|
- void AddTestInfo(TestInfo * test_info);
|
|
|
|
|
|
+ void AddTestInfo(TestInfo* test_info);
|
|
|
|
|
|
// Clears the results of all tests in this test suite.
|
|
// Clears the results of all tests in this test suite.
|
|
void ClearResult();
|
|
void ClearResult();
|
|
@@ -1042,7 +855,8 @@ class GTEST_API_ TestSuite {
|
|
TestResult ad_hoc_test_result_;
|
|
TestResult ad_hoc_test_result_;
|
|
|
|
|
|
// We disallow copying TestSuites.
|
|
// We disallow copying TestSuites.
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestSuite);
|
|
|
|
|
|
+ TestSuite(const TestSuite&) = delete;
|
|
|
|
+ TestSuite& operator=(const TestSuite&) = delete;
|
|
};
|
|
};
|
|
|
|
|
|
// An Environment object is capable of setting up and tearing down an
|
|
// An Environment object is capable of setting up and tearing down an
|
|
@@ -1069,6 +883,7 @@ class Environment {
|
|
|
|
|
|
// Override this to define how to tear down the environment.
|
|
// Override this to define how to tear down the environment.
|
|
virtual void TearDown() {}
|
|
virtual void TearDown() {}
|
|
|
|
+
|
|
private:
|
|
private:
|
|
// If you see an error about overriding the following function or
|
|
// If you see an error about overriding the following function or
|
|
// about it being private, you have mis-spelled SetUp() as Setup().
|
|
// about it being private, you have mis-spelled SetUp() as Setup().
|
|
@@ -1120,6 +935,9 @@ class TestEventListener {
|
|
// Fired before the test starts.
|
|
// Fired before the test starts.
|
|
virtual void OnTestStart(const TestInfo& test_info) = 0;
|
|
virtual void OnTestStart(const TestInfo& test_info) = 0;
|
|
|
|
|
|
|
|
+ // Fired when a test is disabled
|
|
|
|
+ virtual void OnTestDisabled(const TestInfo& /*test_info*/) {}
|
|
|
|
+
|
|
// Fired after a failed assertion or a SUCCEED() invocation.
|
|
// Fired after a failed assertion or a SUCCEED() invocation.
|
|
// If you want to throw an exception from this function to skip to the next
|
|
// If you want to throw an exception from this function to skip to the next
|
|
// TEST, it must be AssertionException defined above, or inherited from it.
|
|
// TEST, it must be AssertionException defined above, or inherited from it.
|
|
@@ -1143,8 +961,7 @@ class TestEventListener {
|
|
virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
|
|
virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
|
|
|
|
|
|
// Fired after each iteration of tests finishes.
|
|
// Fired after each iteration of tests finishes.
|
|
- virtual void OnTestIterationEnd(const UnitTest& unit_test,
|
|
|
|
- int iteration) = 0;
|
|
|
|
|
|
+ virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) = 0;
|
|
|
|
|
|
// Fired after all test activities have ended.
|
|
// Fired after all test activities have ended.
|
|
virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
|
|
virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
|
|
@@ -1169,6 +986,7 @@ class EmptyTestEventListener : public TestEventListener {
|
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
|
|
|
|
|
void OnTestStart(const TestInfo& /*test_info*/) override {}
|
|
void OnTestStart(const TestInfo& /*test_info*/) override {}
|
|
|
|
+ void OnTestDisabled(const TestInfo& /*test_info*/) override {}
|
|
void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {}
|
|
void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {}
|
|
void OnTestEnd(const TestInfo& /*test_info*/) override {}
|
|
void OnTestEnd(const TestInfo& /*test_info*/) override {}
|
|
void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {}
|
|
void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {}
|
|
@@ -1258,7 +1076,8 @@ class GTEST_API_ TestEventListeners {
|
|
TestEventListener* default_xml_generator_;
|
|
TestEventListener* default_xml_generator_;
|
|
|
|
|
|
// We disallow copying TestEventListeners.
|
|
// We disallow copying TestEventListeners.
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
|
|
|
|
|
|
+ TestEventListeners(const TestEventListeners&) = delete;
|
|
|
|
+ TestEventListeners& operator=(const TestEventListeners&) = delete;
|
|
};
|
|
};
|
|
|
|
|
|
// A UnitTest consists of a vector of TestSuites.
|
|
// A UnitTest consists of a vector of TestSuites.
|
|
@@ -1301,8 +1120,7 @@ class GTEST_API_ UnitTest {
|
|
|
|
|
|
// Returns the TestInfo object for the test that's currently running,
|
|
// Returns the TestInfo object for the test that's currently running,
|
|
// or NULL if no test is running.
|
|
// or NULL if no test is running.
|
|
- const TestInfo* current_test_info() const
|
|
|
|
- GTEST_LOCK_EXCLUDED_(mutex_);
|
|
|
|
|
|
+ const TestInfo* current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_);
|
|
|
|
|
|
// Returns the random seed used at the start of the current test run.
|
|
// Returns the random seed used at the start of the current test run.
|
|
int random_seed() const;
|
|
int random_seed() const;
|
|
@@ -1408,8 +1226,7 @@ class GTEST_API_ UnitTest {
|
|
// eventually call this to report their results. The user code
|
|
// eventually call this to report their results. The user code
|
|
// should use the assertion macros instead of calling this directly.
|
|
// should use the assertion macros instead of calling this directly.
|
|
void AddTestPartResult(TestPartResult::Type result_type,
|
|
void AddTestPartResult(TestPartResult::Type result_type,
|
|
- const char* file_name,
|
|
|
|
- int line_number,
|
|
|
|
|
|
+ const char* file_name, int line_number,
|
|
const std::string& message,
|
|
const std::string& message,
|
|
const std::string& os_stack_trace)
|
|
const std::string& os_stack_trace)
|
|
GTEST_LOCK_EXCLUDED_(mutex_);
|
|
GTEST_LOCK_EXCLUDED_(mutex_);
|
|
@@ -1440,8 +1257,7 @@ class GTEST_API_ UnitTest {
|
|
friend std::set<std::string>* internal::GetIgnoredParameterizedTestSuites();
|
|
friend std::set<std::string>* internal::GetIgnoredParameterizedTestSuites();
|
|
friend internal::UnitTestImpl* internal::GetUnitTestImpl();
|
|
friend internal::UnitTestImpl* internal::GetUnitTestImpl();
|
|
friend void internal::ReportFailureInUnknownLocation(
|
|
friend void internal::ReportFailureInUnknownLocation(
|
|
- TestPartResult::Type result_type,
|
|
|
|
- const std::string& message);
|
|
|
|
|
|
+ TestPartResult::Type result_type, const std::string& message);
|
|
|
|
|
|
// Creates an empty UnitTest.
|
|
// Creates an empty UnitTest.
|
|
UnitTest();
|
|
UnitTest();
|
|
@@ -1455,8 +1271,7 @@ class GTEST_API_ UnitTest {
|
|
GTEST_LOCK_EXCLUDED_(mutex_);
|
|
GTEST_LOCK_EXCLUDED_(mutex_);
|
|
|
|
|
|
// Pops a trace from the per-thread Google Test trace stack.
|
|
// Pops a trace from the per-thread Google Test trace stack.
|
|
- void PopGTestTrace()
|
|
|
|
- GTEST_LOCK_EXCLUDED_(mutex_);
|
|
|
|
|
|
+ void PopGTestTrace() GTEST_LOCK_EXCLUDED_(mutex_);
|
|
|
|
|
|
// Protects mutable state in *impl_. This is mutable as some const
|
|
// Protects mutable state in *impl_. This is mutable as some const
|
|
// methods need to lock it too.
|
|
// methods need to lock it too.
|
|
@@ -1469,7 +1284,8 @@ class GTEST_API_ UnitTest {
|
|
internal::UnitTestImpl* impl_;
|
|
internal::UnitTestImpl* impl_;
|
|
|
|
|
|
// We disallow copying UnitTest.
|
|
// We disallow copying UnitTest.
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
|
|
|
|
|
|
+ UnitTest(const UnitTest&) = delete;
|
|
|
|
+ UnitTest& operator=(const UnitTest&) = delete;
|
|
};
|
|
};
|
|
|
|
|
|
// A convenient wrapper for adding an environment for the test
|
|
// A convenient wrapper for adding an environment for the test
|
|
@@ -1520,13 +1336,11 @@ namespace internal {
|
|
// when calling EXPECT_* in a tight loop.
|
|
// when calling EXPECT_* in a tight loop.
|
|
template <typename T1, typename T2>
|
|
template <typename T1, typename T2>
|
|
AssertionResult CmpHelperEQFailure(const char* lhs_expression,
|
|
AssertionResult CmpHelperEQFailure(const char* lhs_expression,
|
|
- const char* rhs_expression,
|
|
|
|
- const T1& lhs, const T2& rhs) {
|
|
|
|
- return EqFailure(lhs_expression,
|
|
|
|
- rhs_expression,
|
|
|
|
|
|
+ const char* rhs_expression, const T1& lhs,
|
|
|
|
+ const T2& rhs) {
|
|
|
|
+ return EqFailure(lhs_expression, rhs_expression,
|
|
FormatForComparisonFailureMessage(lhs, rhs),
|
|
FormatForComparisonFailureMessage(lhs, rhs),
|
|
- FormatForComparisonFailureMessage(rhs, lhs),
|
|
|
|
- false);
|
|
|
|
|
|
+ FormatForComparisonFailureMessage(rhs, lhs), false);
|
|
}
|
|
}
|
|
|
|
|
|
// This block of code defines operator==/!=
|
|
// This block of code defines operator==/!=
|
|
@@ -1539,8 +1353,7 @@ inline bool operator!=(faketype, faketype) { return false; }
|
|
// The helper function for {ASSERT|EXPECT}_EQ.
|
|
// The helper function for {ASSERT|EXPECT}_EQ.
|
|
template <typename T1, typename T2>
|
|
template <typename T1, typename T2>
|
|
AssertionResult CmpHelperEQ(const char* lhs_expression,
|
|
AssertionResult CmpHelperEQ(const char* lhs_expression,
|
|
- const char* rhs_expression,
|
|
|
|
- const T1& lhs,
|
|
|
|
|
|
+ const char* rhs_expression, const T1& lhs,
|
|
const T2& rhs) {
|
|
const T2& rhs) {
|
|
if (lhs == rhs) {
|
|
if (lhs == rhs) {
|
|
return AssertionSuccess();
|
|
return AssertionSuccess();
|
|
@@ -1571,8 +1384,7 @@ class EqHelper {
|
|
// Even though its body looks the same as the above version, we
|
|
// Even though its body looks the same as the above version, we
|
|
// cannot merge the two, as it will make anonymous enums unhappy.
|
|
// cannot merge the two, as it will make anonymous enums unhappy.
|
|
static AssertionResult Compare(const char* lhs_expression,
|
|
static AssertionResult Compare(const char* lhs_expression,
|
|
- const char* rhs_expression,
|
|
|
|
- BiggestInt lhs,
|
|
|
|
|
|
+ const char* rhs_expression, BiggestInt lhs,
|
|
BiggestInt rhs) {
|
|
BiggestInt rhs) {
|
|
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
|
|
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
|
|
}
|
|
}
|
|
@@ -1607,16 +1419,16 @@ AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
|
|
//
|
|
//
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
|
|
|
|
-#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
|
|
|
|
-template <typename T1, typename T2>\
|
|
|
|
-AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
|
|
|
- const T1& val1, const T2& val2) {\
|
|
|
|
- if (val1 op val2) {\
|
|
|
|
- return AssertionSuccess();\
|
|
|
|
- } else {\
|
|
|
|
- return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
|
|
|
|
- }\
|
|
|
|
-}
|
|
|
|
|
|
+#define GTEST_IMPL_CMP_HELPER_(op_name, op) \
|
|
|
|
+ template <typename T1, typename T2> \
|
|
|
|
+ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
|
|
|
+ const T1& val1, const T2& val2) { \
|
|
|
|
+ if (val1 op val2) { \
|
|
|
|
+ return AssertionSuccess(); \
|
|
|
|
+ } else { \
|
|
|
|
+ return CmpHelperOpFailure(expr1, expr2, val1, val2, #op); \
|
|
|
|
+ } \
|
|
|
|
+ }
|
|
|
|
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
|
|
|
|
@@ -1638,49 +1450,42 @@ GTEST_IMPL_CMP_HELPER_(GT, >)
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
|
|
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
|
|
const char* s2_expression,
|
|
const char* s2_expression,
|
|
- const char* s1,
|
|
|
|
- const char* s2);
|
|
|
|
|
|
+ const char* s1, const char* s2);
|
|
|
|
|
|
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
|
|
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
|
|
//
|
|
//
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
|
|
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
|
|
const char* s2_expression,
|
|
const char* s2_expression,
|
|
- const char* s1,
|
|
|
|
- const char* s2);
|
|
|
|
|
|
+ const char* s1, const char* s2);
|
|
|
|
|
|
// The helper function for {ASSERT|EXPECT}_STRNE.
|
|
// The helper function for {ASSERT|EXPECT}_STRNE.
|
|
//
|
|
//
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
|
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
|
const char* s2_expression,
|
|
const char* s2_expression,
|
|
- const char* s1,
|
|
|
|
- const char* s2);
|
|
|
|
|
|
+ const char* s1, const char* s2);
|
|
|
|
|
|
// The helper function for {ASSERT|EXPECT}_STRCASENE.
|
|
// The helper function for {ASSERT|EXPECT}_STRCASENE.
|
|
//
|
|
//
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
|
|
GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
|
|
const char* s2_expression,
|
|
const char* s2_expression,
|
|
- const char* s1,
|
|
|
|
- const char* s2);
|
|
|
|
-
|
|
|
|
|
|
+ const char* s1, const char* s2);
|
|
|
|
|
|
// Helper function for *_STREQ on wide strings.
|
|
// Helper function for *_STREQ on wide strings.
|
|
//
|
|
//
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
|
|
GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
|
|
const char* s2_expression,
|
|
const char* s2_expression,
|
|
- const wchar_t* s1,
|
|
|
|
- const wchar_t* s2);
|
|
|
|
|
|
+ const wchar_t* s1, const wchar_t* s2);
|
|
|
|
|
|
// Helper function for *_STRNE on wide strings.
|
|
// Helper function for *_STRNE on wide strings.
|
|
//
|
|
//
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
|
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
|
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
|
const char* s2_expression,
|
|
const char* s2_expression,
|
|
- const wchar_t* s1,
|
|
|
|
- const wchar_t* s2);
|
|
|
|
|
|
+ const wchar_t* s1, const wchar_t* s2);
|
|
|
|
|
|
} // namespace internal
|
|
} // namespace internal
|
|
|
|
|
|
@@ -1692,32 +1497,40 @@ GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
|
|
//
|
|
//
|
|
// The {needle,haystack}_expr arguments are the stringified
|
|
// The {needle,haystack}_expr arguments are the stringified
|
|
// expressions that generated the two real arguments.
|
|
// expressions that generated the two real arguments.
|
|
-GTEST_API_ AssertionResult IsSubstring(
|
|
|
|
- const char* needle_expr, const char* haystack_expr,
|
|
|
|
- const char* needle, const char* haystack);
|
|
|
|
-GTEST_API_ AssertionResult IsSubstring(
|
|
|
|
- const char* needle_expr, const char* haystack_expr,
|
|
|
|
- const wchar_t* needle, const wchar_t* haystack);
|
|
|
|
-GTEST_API_ AssertionResult IsNotSubstring(
|
|
|
|
- const char* needle_expr, const char* haystack_expr,
|
|
|
|
- const char* needle, const char* haystack);
|
|
|
|
-GTEST_API_ AssertionResult IsNotSubstring(
|
|
|
|
- const char* needle_expr, const char* haystack_expr,
|
|
|
|
- const wchar_t* needle, const wchar_t* haystack);
|
|
|
|
-GTEST_API_ AssertionResult IsSubstring(
|
|
|
|
- const char* needle_expr, const char* haystack_expr,
|
|
|
|
- const ::std::string& needle, const ::std::string& haystack);
|
|
|
|
-GTEST_API_ AssertionResult IsNotSubstring(
|
|
|
|
- const char* needle_expr, const char* haystack_expr,
|
|
|
|
- const ::std::string& needle, const ::std::string& haystack);
|
|
|
|
|
|
+GTEST_API_ AssertionResult IsSubstring(const char* needle_expr,
|
|
|
|
+ const char* haystack_expr,
|
|
|
|
+ const char* needle,
|
|
|
|
+ const char* haystack);
|
|
|
|
+GTEST_API_ AssertionResult IsSubstring(const char* needle_expr,
|
|
|
|
+ const char* haystack_expr,
|
|
|
|
+ const wchar_t* needle,
|
|
|
|
+ const wchar_t* haystack);
|
|
|
|
+GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr,
|
|
|
|
+ const char* haystack_expr,
|
|
|
|
+ const char* needle,
|
|
|
|
+ const char* haystack);
|
|
|
|
+GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr,
|
|
|
|
+ const char* haystack_expr,
|
|
|
|
+ const wchar_t* needle,
|
|
|
|
+ const wchar_t* haystack);
|
|
|
|
+GTEST_API_ AssertionResult IsSubstring(const char* needle_expr,
|
|
|
|
+ const char* haystack_expr,
|
|
|
|
+ const ::std::string& needle,
|
|
|
|
+ const ::std::string& haystack);
|
|
|
|
+GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr,
|
|
|
|
+ const char* haystack_expr,
|
|
|
|
+ const ::std::string& needle,
|
|
|
|
+ const ::std::string& haystack);
|
|
|
|
|
|
#if GTEST_HAS_STD_WSTRING
|
|
#if GTEST_HAS_STD_WSTRING
|
|
-GTEST_API_ AssertionResult IsSubstring(
|
|
|
|
- const char* needle_expr, const char* haystack_expr,
|
|
|
|
- const ::std::wstring& needle, const ::std::wstring& haystack);
|
|
|
|
-GTEST_API_ AssertionResult IsNotSubstring(
|
|
|
|
- const char* needle_expr, const char* haystack_expr,
|
|
|
|
- const ::std::wstring& needle, const ::std::wstring& haystack);
|
|
|
|
|
|
+GTEST_API_ AssertionResult IsSubstring(const char* needle_expr,
|
|
|
|
+ const char* haystack_expr,
|
|
|
|
+ const ::std::wstring& needle,
|
|
|
|
+ const ::std::wstring& haystack);
|
|
|
|
+GTEST_API_ AssertionResult IsNotSubstring(const char* needle_expr,
|
|
|
|
+ const char* haystack_expr,
|
|
|
|
+ const ::std::wstring& needle,
|
|
|
|
+ const ::std::wstring& haystack);
|
|
#endif // GTEST_HAS_STD_WSTRING
|
|
#endif // GTEST_HAS_STD_WSTRING
|
|
|
|
|
|
namespace internal {
|
|
namespace internal {
|
|
@@ -1732,8 +1545,7 @@ namespace internal {
|
|
template <typename RawType>
|
|
template <typename RawType>
|
|
AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
|
|
AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
|
|
const char* rhs_expression,
|
|
const char* rhs_expression,
|
|
- RawType lhs_value,
|
|
|
|
- RawType rhs_value) {
|
|
|
|
|
|
+ RawType lhs_value, RawType rhs_value) {
|
|
const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
|
|
const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
|
|
|
|
|
|
if (lhs.AlmostEquals(rhs)) {
|
|
if (lhs.AlmostEquals(rhs)) {
|
|
@@ -1748,10 +1560,8 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
|
|
rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
|
|
rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
|
|
<< rhs_value;
|
|
<< rhs_value;
|
|
|
|
|
|
- return EqFailure(lhs_expression,
|
|
|
|
- rhs_expression,
|
|
|
|
- StringStreamToString(&lhs_ss),
|
|
|
|
- StringStreamToString(&rhs_ss),
|
|
|
|
|
|
+ return EqFailure(lhs_expression, rhs_expression,
|
|
|
|
+ StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss),
|
|
false);
|
|
false);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1761,8 +1571,7 @@ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
|
|
GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
|
|
GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
|
|
const char* expr2,
|
|
const char* expr2,
|
|
const char* abs_error_expr,
|
|
const char* abs_error_expr,
|
|
- double val1,
|
|
|
|
- double val2,
|
|
|
|
|
|
+ double val1, double val2,
|
|
double abs_error);
|
|
double abs_error);
|
|
|
|
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
|
@@ -1770,9 +1579,7 @@ GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
|
|
class GTEST_API_ AssertHelper {
|
|
class GTEST_API_ AssertHelper {
|
|
public:
|
|
public:
|
|
// Constructor.
|
|
// Constructor.
|
|
- AssertHelper(TestPartResult::Type type,
|
|
|
|
- const char* file,
|
|
|
|
- int line,
|
|
|
|
|
|
+ AssertHelper(TestPartResult::Type type, const char* file, int line,
|
|
const char* message);
|
|
const char* message);
|
|
~AssertHelper();
|
|
~AssertHelper();
|
|
|
|
|
|
@@ -1786,11 +1593,9 @@ class GTEST_API_ AssertHelper {
|
|
// re-using stack space even for temporary variables, so every EXPECT_EQ
|
|
// re-using stack space even for temporary variables, so every EXPECT_EQ
|
|
// reserves stack space for another AssertHelper.
|
|
// reserves stack space for another AssertHelper.
|
|
struct AssertHelperData {
|
|
struct AssertHelperData {
|
|
- AssertHelperData(TestPartResult::Type t,
|
|
|
|
- const char* srcfile,
|
|
|
|
- int line_num,
|
|
|
|
|
|
+ AssertHelperData(TestPartResult::Type t, const char* srcfile, int line_num,
|
|
const char* msg)
|
|
const char* msg)
|
|
- : type(t), file(srcfile), line(line_num), message(msg) { }
|
|
|
|
|
|
+ : type(t), file(srcfile), line(line_num), message(msg) {}
|
|
|
|
|
|
TestPartResult::Type const type;
|
|
TestPartResult::Type const type;
|
|
const char* const file;
|
|
const char* const file;
|
|
@@ -1798,12 +1603,14 @@ class GTEST_API_ AssertHelper {
|
|
std::string const message;
|
|
std::string const message;
|
|
|
|
|
|
private:
|
|
private:
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
|
|
|
|
|
|
+ AssertHelperData(const AssertHelperData&) = delete;
|
|
|
|
+ AssertHelperData& operator=(const AssertHelperData&) = delete;
|
|
};
|
|
};
|
|
|
|
|
|
AssertHelperData* const data_;
|
|
AssertHelperData* const data_;
|
|
|
|
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
|
|
|
|
|
|
+ AssertHelper(const AssertHelper&) = delete;
|
|
|
|
+ AssertHelper& operator=(const AssertHelper&) = delete;
|
|
};
|
|
};
|
|
|
|
|
|
} // namespace internal
|
|
} // namespace internal
|
|
@@ -1860,15 +1667,14 @@ class WithParamInterface {
|
|
private:
|
|
private:
|
|
// Sets parameter value. The caller is responsible for making sure the value
|
|
// Sets parameter value. The caller is responsible for making sure the value
|
|
// remains alive and unchanged throughout the current test.
|
|
// remains alive and unchanged throughout the current test.
|
|
- static void SetParam(const ParamType* parameter) {
|
|
|
|
- parameter_ = parameter;
|
|
|
|
- }
|
|
|
|
|
|
+ static void SetParam(const ParamType* parameter) { parameter_ = parameter; }
|
|
|
|
|
|
// Static value used for accessing parameter during a test lifetime.
|
|
// Static value used for accessing parameter during a test lifetime.
|
|
static const ParamType* parameter_;
|
|
static const ParamType* parameter_;
|
|
|
|
|
|
// TestClass must be a subclass of WithParamInterface<T> and Test.
|
|
// TestClass must be a subclass of WithParamInterface<T> and Test.
|
|
- template <class TestClass> friend class internal::ParameterizedTestFactory;
|
|
|
|
|
|
+ template <class TestClass>
|
|
|
|
+ friend class internal::ParameterizedTestFactory;
|
|
};
|
|
};
|
|
|
|
|
|
template <typename T>
|
|
template <typename T>
|
|
@@ -1878,8 +1684,7 @@ const T* WithParamInterface<T>::parameter_ = nullptr;
|
|
// WithParamInterface, and can just inherit from ::testing::TestWithParam.
|
|
// WithParamInterface, and can just inherit from ::testing::TestWithParam.
|
|
|
|
|
|
template <typename T>
|
|
template <typename T>
|
|
-class TestWithParam : public Test, public WithParamInterface<T> {
|
|
|
|
-};
|
|
|
|
|
|
+class TestWithParam : public Test, public WithParamInterface<T> {};
|
|
|
|
|
|
// Macros for indicating success/failure in test code.
|
|
// Macros for indicating success/failure in test code.
|
|
|
|
|
|
@@ -1910,7 +1715,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|
|
|
|
|
// Generates a nonfatal failure at the given source file location with
|
|
// Generates a nonfatal failure at the given source file location with
|
|
// a generic message.
|
|
// a generic message.
|
|
-#define ADD_FAILURE_AT(file, line) \
|
|
|
|
|
|
+#define ADD_FAILURE_AT(file, line) \
|
|
GTEST_MESSAGE_AT_(file, line, "Failed", \
|
|
GTEST_MESSAGE_AT_(file, line, "Failed", \
|
|
::testing::TestPartResult::kNonFatalFailure)
|
|
::testing::TestPartResult::kNonFatalFailure)
|
|
|
|
|
|
@@ -1925,7 +1730,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|
// Define this macro to 1 to omit the definition of FAIL(), which is a
|
|
// Define this macro to 1 to omit the definition of FAIL(), which is a
|
|
// generic name and clashes with some other libraries.
|
|
// generic name and clashes with some other libraries.
|
|
#if !GTEST_DONT_DEFINE_FAIL
|
|
#if !GTEST_DONT_DEFINE_FAIL
|
|
-# define FAIL() GTEST_FAIL()
|
|
|
|
|
|
+#define FAIL() GTEST_FAIL()
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// Generates a success with a generic message.
|
|
// Generates a success with a generic message.
|
|
@@ -1934,7 +1739,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|
// Define this macro to 1 to omit the definition of SUCCEED(), which
|
|
// Define this macro to 1 to omit the definition of SUCCEED(), which
|
|
// is a generic name and clashes with some other libraries.
|
|
// is a generic name and clashes with some other libraries.
|
|
#if !GTEST_DONT_DEFINE_SUCCEED
|
|
#if !GTEST_DONT_DEFINE_SUCCEED
|
|
-# define SUCCEED() GTEST_SUCCEED()
|
|
|
|
|
|
+#define SUCCEED() GTEST_SUCCEED()
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// Macros for testing exceptions.
|
|
// Macros for testing exceptions.
|
|
@@ -1962,16 +1767,15 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|
// Boolean assertions. Condition can be either a Boolean expression or an
|
|
// Boolean assertions. Condition can be either a Boolean expression or an
|
|
// AssertionResult. For more information on how to use AssertionResult with
|
|
// AssertionResult. For more information on how to use AssertionResult with
|
|
// these macros see comments on that class.
|
|
// these macros see comments on that class.
|
|
-#define GTEST_EXPECT_TRUE(condition) \
|
|
|
|
|
|
+#define GTEST_EXPECT_TRUE(condition) \
|
|
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
|
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
|
GTEST_NONFATAL_FAILURE_)
|
|
GTEST_NONFATAL_FAILURE_)
|
|
-#define GTEST_EXPECT_FALSE(condition) \
|
|
|
|
|
|
+#define GTEST_EXPECT_FALSE(condition) \
|
|
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
|
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
|
GTEST_NONFATAL_FAILURE_)
|
|
GTEST_NONFATAL_FAILURE_)
|
|
#define GTEST_ASSERT_TRUE(condition) \
|
|
#define GTEST_ASSERT_TRUE(condition) \
|
|
- GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
|
|
|
- GTEST_FATAL_FAILURE_)
|
|
|
|
-#define GTEST_ASSERT_FALSE(condition) \
|
|
|
|
|
|
+ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, GTEST_FATAL_FAILURE_)
|
|
|
|
+#define GTEST_ASSERT_FALSE(condition) \
|
|
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
|
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
|
GTEST_FATAL_FAILURE_)
|
|
GTEST_FATAL_FAILURE_)
|
|
|
|
|
|
@@ -2070,27 +1874,27 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|
// ASSERT_XY(), which clashes with some users' own code.
|
|
// ASSERT_XY(), which clashes with some users' own code.
|
|
|
|
|
|
#if !GTEST_DONT_DEFINE_ASSERT_EQ
|
|
#if !GTEST_DONT_DEFINE_ASSERT_EQ
|
|
-# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
|
|
|
|
|
|
+#define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#if !GTEST_DONT_DEFINE_ASSERT_NE
|
|
#if !GTEST_DONT_DEFINE_ASSERT_NE
|
|
-# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
|
|
|
|
|
|
+#define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#if !GTEST_DONT_DEFINE_ASSERT_LE
|
|
#if !GTEST_DONT_DEFINE_ASSERT_LE
|
|
-# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
|
|
|
|
|
|
+#define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#if !GTEST_DONT_DEFINE_ASSERT_LT
|
|
#if !GTEST_DONT_DEFINE_ASSERT_LT
|
|
-# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
|
|
|
|
|
|
+#define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#if !GTEST_DONT_DEFINE_ASSERT_GE
|
|
#if !GTEST_DONT_DEFINE_ASSERT_GE
|
|
-# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
|
|
|
|
|
|
+#define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#if !GTEST_DONT_DEFINE_ASSERT_GT
|
|
#if !GTEST_DONT_DEFINE_ASSERT_GT
|
|
-# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
|
|
|
|
|
|
+#define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// C-string Comparisons. All tests treat NULL and any non-NULL string
|
|
// C-string Comparisons. All tests treat NULL and any non-NULL string
|
|
@@ -2115,7 +1919,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
|
|
#define EXPECT_STRCASEEQ(s1, s2) \
|
|
#define EXPECT_STRCASEEQ(s1, s2) \
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
|
|
-#define EXPECT_STRCASENE(s1, s2)\
|
|
|
|
|
|
+#define EXPECT_STRCASENE(s1, s2) \
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
|
|
|
|
|
|
#define ASSERT_STREQ(s1, s2) \
|
|
#define ASSERT_STREQ(s1, s2) \
|
|
@@ -2124,7 +1928,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
|
|
#define ASSERT_STRCASEEQ(s1, s2) \
|
|
#define ASSERT_STRCASEEQ(s1, s2) \
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
|
|
-#define ASSERT_STRCASENE(s1, s2)\
|
|
|
|
|
|
+#define ASSERT_STRCASENE(s1, s2) \
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
|
|
|
|
|
|
// Macros for comparing floating-point numbers.
|
|
// Macros for comparing floating-point numbers.
|
|
@@ -2141,29 +1945,29 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|
// FloatingPoint template class in gtest-internal.h if you are
|
|
// FloatingPoint template class in gtest-internal.h if you are
|
|
// interested in the implementation details.
|
|
// interested in the implementation details.
|
|
|
|
|
|
-#define EXPECT_FLOAT_EQ(val1, val2)\
|
|
|
|
|
|
+#define EXPECT_FLOAT_EQ(val1, val2) \
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
|
|
val1, val2)
|
|
val1, val2)
|
|
|
|
|
|
-#define EXPECT_DOUBLE_EQ(val1, val2)\
|
|
|
|
|
|
+#define EXPECT_DOUBLE_EQ(val1, val2) \
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
|
|
val1, val2)
|
|
val1, val2)
|
|
|
|
|
|
-#define ASSERT_FLOAT_EQ(val1, val2)\
|
|
|
|
|
|
+#define ASSERT_FLOAT_EQ(val1, val2) \
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
|
|
val1, val2)
|
|
val1, val2)
|
|
|
|
|
|
-#define ASSERT_DOUBLE_EQ(val1, val2)\
|
|
|
|
|
|
+#define ASSERT_DOUBLE_EQ(val1, val2) \
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
|
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
|
|
val1, val2)
|
|
val1, val2)
|
|
|
|
|
|
-#define EXPECT_NEAR(val1, val2, abs_error)\
|
|
|
|
- EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
|
|
|
|
- val1, val2, abs_error)
|
|
|
|
|
|
+#define EXPECT_NEAR(val1, val2, abs_error) \
|
|
|
|
+ EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, val1, val2, \
|
|
|
|
+ abs_error)
|
|
|
|
|
|
-#define ASSERT_NEAR(val1, val2, abs_error)\
|
|
|
|
- ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
|
|
|
|
- val1, val2, abs_error)
|
|
|
|
|
|
+#define ASSERT_NEAR(val1, val2, abs_error) \
|
|
|
|
+ ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, val1, val2, \
|
|
|
|
+ abs_error)
|
|
|
|
|
|
// These predicate format functions work on floating-point values, and
|
|
// These predicate format functions work on floating-point values, and
|
|
// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
|
|
// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
|
|
@@ -2177,7 +1981,6 @@ GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
|
|
GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|
GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|
double val1, double val2);
|
|
double val1, double val2);
|
|
|
|
|
|
-
|
|
|
|
#if GTEST_OS_WINDOWS
|
|
#if GTEST_OS_WINDOWS
|
|
|
|
|
|
// Macros that test for HRESULT failure and success, these are only useful
|
|
// Macros that test for HRESULT failure and success, these are only useful
|
|
@@ -2189,17 +1992,17 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|
// expected result and the actual result with both a human-readable
|
|
// expected result and the actual result with both a human-readable
|
|
// string representation of the error, if available, as well as the
|
|
// string representation of the error, if available, as well as the
|
|
// hex result code.
|
|
// hex result code.
|
|
-# define EXPECT_HRESULT_SUCCEEDED(expr) \
|
|
|
|
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
|
|
|
|
|
+#define EXPECT_HRESULT_SUCCEEDED(expr) \
|
|
|
|
+ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
|
|
|
|
|
-# define ASSERT_HRESULT_SUCCEEDED(expr) \
|
|
|
|
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
|
|
|
|
|
+#define ASSERT_HRESULT_SUCCEEDED(expr) \
|
|
|
|
+ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
|
|
|
|
|
-# define EXPECT_HRESULT_FAILED(expr) \
|
|
|
|
- EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
|
|
|
|
|
+#define EXPECT_HRESULT_FAILED(expr) \
|
|
|
|
+ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
|
|
|
|
|
-# define ASSERT_HRESULT_FAILED(expr) \
|
|
|
|
- ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
|
|
|
|
|
+#define ASSERT_HRESULT_FAILED(expr) \
|
|
|
|
+ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
|
|
|
|
|
#endif // GTEST_OS_WINDOWS
|
|
#endif // GTEST_OS_WINDOWS
|
|
|
|
|
|
@@ -2214,9 +2017,9 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|
// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
|
|
// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
|
|
//
|
|
//
|
|
#define ASSERT_NO_FATAL_FAILURE(statement) \
|
|
#define ASSERT_NO_FATAL_FAILURE(statement) \
|
|
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
|
|
|
|
|
|
+ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
|
|
#define EXPECT_NO_FATAL_FAILURE(statement) \
|
|
#define EXPECT_NO_FATAL_FAILURE(statement) \
|
|
- GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
|
|
|
|
|
|
+ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
|
|
|
|
|
|
// Causes a trace (including the given source file path and line number,
|
|
// Causes a trace (including the given source file path and line number,
|
|
// and the given message) to be included in every test failure message generated
|
|
// and the given message) to be included in every test failure message generated
|
|
@@ -2258,7 +2061,8 @@ class GTEST_API_ ScopedTrace {
|
|
private:
|
|
private:
|
|
void PushTrace(const char* file, int line, std::string message);
|
|
void PushTrace(const char* file, int line, std::string message);
|
|
|
|
|
|
- GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
|
|
|
|
|
|
+ ScopedTrace(const ScopedTrace&) = delete;
|
|
|
|
+ ScopedTrace& operator=(const ScopedTrace&) = delete;
|
|
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
|
|
} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
|
|
// c'tor and d'tor. Therefore it doesn't
|
|
// c'tor and d'tor. Therefore it doesn't
|
|
// need to be used otherwise.
|
|
// need to be used otherwise.
|
|
@@ -2278,9 +2082,9 @@ class GTEST_API_ ScopedTrace {
|
|
// Assuming that each thread maintains its own stack of traces.
|
|
// Assuming that each thread maintains its own stack of traces.
|
|
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
|
|
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
|
|
// assertions in its own thread.
|
|
// assertions in its own thread.
|
|
-#define SCOPED_TRACE(message) \
|
|
|
|
- ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
|
|
|
|
- __FILE__, __LINE__, (message))
|
|
|
|
|
|
+#define SCOPED_TRACE(message) \
|
|
|
|
+ ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \
|
|
|
|
+ __FILE__, __LINE__, (message))
|
|
|
|
|
|
// Compile-time assertion for type equality.
|
|
// Compile-time assertion for type equality.
|
|
// StaticAssertTypeEq<type1, type2>() compiles if and only if type1 and type2
|
|
// StaticAssertTypeEq<type1, type2>() compiles if and only if type1 and type2
|
|
@@ -2378,20 +2182,19 @@ constexpr bool StaticAssertTypeEq() noexcept {
|
|
// EXPECT_EQ(a_.size(), 0);
|
|
// EXPECT_EQ(a_.size(), 0);
|
|
// EXPECT_EQ(b_.size(), 1);
|
|
// EXPECT_EQ(b_.size(), 1);
|
|
// }
|
|
// }
|
|
-//
|
|
|
|
-// GOOGLETEST_CM0011 DO NOT DELETE
|
|
|
|
-#if !GTEST_DONT_DEFINE_TEST
|
|
|
|
-#define TEST_F(test_fixture, test_name)\
|
|
|
|
|
|
+#define GTEST_TEST_F(test_fixture, test_name) \
|
|
GTEST_TEST_(test_fixture, test_name, test_fixture, \
|
|
GTEST_TEST_(test_fixture, test_name, test_fixture, \
|
|
::testing::internal::GetTypeId<test_fixture>())
|
|
::testing::internal::GetTypeId<test_fixture>())
|
|
-#endif // !GTEST_DONT_DEFINE_TEST
|
|
|
|
|
|
+#if !GTEST_DONT_DEFINE_TEST_F
|
|
|
|
+#define TEST_F(test_fixture, test_name) GTEST_TEST_F(test_fixture, test_name)
|
|
|
|
+#endif
|
|
|
|
|
|
// Returns a path to temporary directory.
|
|
// Returns a path to temporary directory.
|
|
// Tries to determine an appropriate directory for the platform.
|
|
// Tries to determine an appropriate directory for the platform.
|
|
GTEST_API_ std::string TempDir();
|
|
GTEST_API_ std::string TempDir();
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
#ifdef _MSC_VER
|
|
-# pragma warning(pop)
|
|
|
|
|
|
+#pragma warning(pop)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// Dynamically registers a test with the framework.
|
|
// Dynamically registers a test with the framework.
|
|
@@ -2445,6 +2248,7 @@ GTEST_API_ std::string TempDir();
|
|
// }
|
|
// }
|
|
// ...
|
|
// ...
|
|
// int main(int argc, char** argv) {
|
|
// int main(int argc, char** argv) {
|
|
|
|
+// ::testing::InitGoogleTest(&argc, argv);
|
|
// std::vector<int> values_to_test = LoadValuesFromConfig();
|
|
// std::vector<int> values_to_test = LoadValuesFromConfig();
|
|
// RegisterMyTests(values_to_test);
|
|
// RegisterMyTests(values_to_test);
|
|
// ...
|
|
// ...
|
|
@@ -2486,9 +2290,7 @@ TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
|
|
// namespace and has an all-caps name.
|
|
// namespace and has an all-caps name.
|
|
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
|
|
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
|
|
|
|
|
|
-inline int RUN_ALL_TESTS() {
|
|
|
|
- return ::testing::UnitTest::GetInstance()->Run();
|
|
|
|
-}
|
|
|
|
|
|
+inline int RUN_ALL_TESTS() { return ::testing::UnitTest::GetInstance()->Run(); }
|
|
|
|
|
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
|
|
|
|