Many changes:
- appends "_" to internal macro names (by Markus Heule). - makes Google Test work with newer versions of tools on Symbian and Windows CE (by Mika Raento). - adds the (ASSERT|EXPECT)_NO_FATAL_FAILURE macros (by Markus Heule). - changes EXPECT_(NON|)FATAL_FAILURE to catch failures in the current thread only (by Markus Heule). - adds the EXPECT_(NON|)FATAL_FAILURE_ON_ALL_THREADS macros (by Markus Heule). - adds GTEST_HAS_PTHREAD and GTEST_IS_THREADSAFE to indicate the availability of <pthread.h> and Google Test's thread-safety (by Zhanyong Wan). - adds scons/SConscript for building with scons (by Joi Sigurdsson). - adds src/gtest-all.cc for building Google Test from a single file (by Markus Heule). - updates the xcode project to include new tests (by Preston Jackson).
This commit is contained in:
parent
0cbe322d37
commit
e0865dd919
@ -10,6 +10,7 @@ Chandler Carruth <chandlerc@google.com>
|
|||||||
Chris Prince <cprince@google.com>
|
Chris Prince <cprince@google.com>
|
||||||
Chris Taylor <taylorc@google.com>
|
Chris Taylor <taylorc@google.com>
|
||||||
Jeffrey Yasskin <jyasskin@google.com>
|
Jeffrey Yasskin <jyasskin@google.com>
|
||||||
|
Jói Sigurðsson <joi@google.com>
|
||||||
Keir Mierle <mierle@gmail.com>
|
Keir Mierle <mierle@gmail.com>
|
||||||
Keith Ray <keith.ray@gmail.com>
|
Keith Ray <keith.ray@gmail.com>
|
||||||
Kenton Varda <kenton@google.com>
|
Kenton Varda <kenton@google.com>
|
||||||
|
15
Makefile.am
15
Makefile.am
@ -7,7 +7,8 @@ EXTRA_DIST = \
|
|||||||
CHANGES \
|
CHANGES \
|
||||||
CONTRIBUTORS \
|
CONTRIBUTORS \
|
||||||
include/gtest/internal/gtest-type-util.h.pump \
|
include/gtest/internal/gtest-type-util.h.pump \
|
||||||
scripts/gen_gtest_pred_impl.py
|
scripts/gen_gtest_pred_impl.py \
|
||||||
|
src/gtest-all.cc
|
||||||
|
|
||||||
# MSVC project files
|
# MSVC project files
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
@ -69,6 +70,7 @@ lib_libgtest_la_SOURCES = src/gtest.cc \
|
|||||||
src/gtest-filepath.cc \
|
src/gtest-filepath.cc \
|
||||||
src/gtest-internal-inl.h \
|
src/gtest-internal-inl.h \
|
||||||
src/gtest-port.cc \
|
src/gtest-port.cc \
|
||||||
|
src/gtest-test-part.cc \
|
||||||
src/gtest-typed-test.cc
|
src/gtest-typed-test.cc
|
||||||
|
|
||||||
pkginclude_HEADERS = include/gtest/gtest.h \
|
pkginclude_HEADERS = include/gtest/gtest.h \
|
||||||
@ -77,6 +79,7 @@ pkginclude_HEADERS = include/gtest/gtest.h \
|
|||||||
include/gtest/gtest-spi.h \
|
include/gtest/gtest-spi.h \
|
||||||
include/gtest/gtest_pred_impl.h \
|
include/gtest/gtest_pred_impl.h \
|
||||||
include/gtest/gtest_prod.h \
|
include/gtest/gtest_prod.h \
|
||||||
|
include/gtest/gtest-test-part.h \
|
||||||
include/gtest/gtest-typed-test.h
|
include/gtest/gtest-typed-test.h
|
||||||
|
|
||||||
pkginclude_internaldir = $(pkgincludedir)/internal
|
pkginclude_internaldir = $(pkgincludedir)/internal
|
||||||
@ -207,11 +210,21 @@ check_PROGRAMS += test/gtest_repeat_test
|
|||||||
test_gtest_repeat_test_SOURCES = test/gtest_repeat_test.cc
|
test_gtest_repeat_test_SOURCES = test/gtest_repeat_test.cc
|
||||||
test_gtest_repeat_test_LDADD = lib/libgtest.la
|
test_gtest_repeat_test_LDADD = lib/libgtest.la
|
||||||
|
|
||||||
|
TESTS += test/gtest_sole_header_test
|
||||||
|
check_PROGRAMS += test/gtest_sole_header_test
|
||||||
|
test_gtest_sole_header_test_SOURCES = test/gtest_sole_header_test.cc
|
||||||
|
test_gtest_sole_header_test_LDADD = lib/libgtest_main.la
|
||||||
|
|
||||||
TESTS += test/gtest_stress_test
|
TESTS += test/gtest_stress_test
|
||||||
check_PROGRAMS += test/gtest_stress_test
|
check_PROGRAMS += test/gtest_stress_test
|
||||||
test_gtest_stress_test_SOURCES = test/gtest_stress_test.cc
|
test_gtest_stress_test_SOURCES = test/gtest_stress_test.cc
|
||||||
test_gtest_stress_test_LDADD = lib/libgtest.la
|
test_gtest_stress_test_LDADD = lib/libgtest.la
|
||||||
|
|
||||||
|
TESTS += test/gtest-test-part_test
|
||||||
|
check_PROGRAMS += test/gtest-test-part_test
|
||||||
|
test_gtest_test_part_test_SOURCES = test/gtest-test-part_test.cc
|
||||||
|
test_gtest_test_part_test_LDADD = lib/libgtest_main.la
|
||||||
|
|
||||||
TESTS += test/gtest-typed-test_test
|
TESTS += test/gtest-typed-test_test
|
||||||
check_PROGRAMS += test/gtest-typed-test_test
|
check_PROGRAMS += test/gtest-typed-test_test
|
||||||
test_gtest_typed_test_test_SOURCES = test/gtest-typed-test_test.cc \
|
test_gtest_typed_test_test_SOURCES = test/gtest-typed-test_test.cc \
|
||||||
|
@ -47,7 +47,7 @@ namespace testing {
|
|||||||
// from the start, running only a single death test, or "fast",
|
// from the start, running only a single death test, or "fast",
|
||||||
// meaning that the child process will execute the test logic immediately
|
// meaning that the child process will execute the test logic immediately
|
||||||
// after forking.
|
// after forking.
|
||||||
GTEST_DECLARE_string(death_test_style);
|
GTEST_DECLARE_string_(death_test_style);
|
||||||
|
|
||||||
#ifdef GTEST_HAS_DEATH_TEST
|
#ifdef GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
@ -104,12 +104,12 @@ GTEST_DECLARE_string(death_test_style);
|
|||||||
// integer exit status that satisfies predicate, and emitting error output
|
// integer exit status that satisfies predicate, and emitting error output
|
||||||
// that matches regex.
|
// that matches regex.
|
||||||
#define ASSERT_EXIT(statement, predicate, regex) \
|
#define ASSERT_EXIT(statement, predicate, regex) \
|
||||||
GTEST_DEATH_TEST(statement, predicate, regex, GTEST_FATAL_FAILURE)
|
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
// Like ASSERT_EXIT, but continues on to successive tests in the
|
// Like ASSERT_EXIT, but continues on to successive tests in the
|
||||||
// test case, if any:
|
// test case, if any:
|
||||||
#define EXPECT_EXIT(statement, predicate, regex) \
|
#define EXPECT_EXIT(statement, predicate, regex) \
|
||||||
GTEST_DEATH_TEST(statement, predicate, regex, GTEST_NONFATAL_FAILURE)
|
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
|
||||||
|
|
||||||
// Asserts that a given statement causes the program to exit, either by
|
// Asserts that a given statement causes the program to exit, either by
|
||||||
// explicitly exiting with a nonzero exit code or being killed by a
|
// explicitly exiting with a nonzero exit code or being killed by a
|
||||||
|
@ -102,7 +102,7 @@ class Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
~Message() { delete ss_; }
|
~Message() { delete ss_; }
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef GTEST_OS_SYMBIAN
|
||||||
// Streams a value (either a pointer or not) to this object.
|
// Streams a value (either a pointer or not) to this object.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline Message& operator <<(const T& value) {
|
inline Message& operator <<(const T& value) {
|
||||||
@ -139,7 +139,7 @@ class Message {
|
|||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif // __SYMBIAN32__
|
#endif // GTEST_OS_SYMBIAN
|
||||||
|
|
||||||
// Since the basic IO manipulators are overloaded for both narrow
|
// Since the basic IO manipulators are overloaded for both narrow
|
||||||
// and wide streams, we have to provide this specialized definition
|
// and wide streams, we have to provide this specialized definition
|
||||||
@ -187,7 +187,7 @@ class Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef GTEST_OS_SYMBIAN
|
||||||
// These are needed as the Nokia Symbian Compiler cannot decide between
|
// These are needed as the Nokia Symbian Compiler cannot decide between
|
||||||
// const T& and const T* in a function template. The Nokia compiler _can_
|
// const T& and const T* in a function template. The Nokia compiler _can_
|
||||||
// decide between class template specializations for T and T*, so a
|
// decide between class template specializations for T and T*, so a
|
||||||
@ -204,7 +204,7 @@ class Message {
|
|||||||
inline void StreamHelper(internal::false_type dummy, const T& value) {
|
inline void StreamHelper(internal::false_type dummy, const T& value) {
|
||||||
::GTestStreamToHelper(ss_, value);
|
::GTestStreamToHelper(ss_, value);
|
||||||
}
|
}
|
||||||
#endif // __SYMBIAN32__
|
#endif // GTEST_OS_SYMBIAN
|
||||||
|
|
||||||
// We'll hold the text streamed to this object here.
|
// We'll hold the text streamed to this object here.
|
||||||
internal::StrStream* const ss_;
|
internal::StrStream* const ss_;
|
||||||
|
@ -39,124 +39,34 @@
|
|||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// A copyable object representing the result of a test part (i.e. an
|
|
||||||
// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
|
|
||||||
//
|
|
||||||
// Don't inherit from TestPartResult as its destructor is not virtual.
|
|
||||||
class TestPartResult {
|
|
||||||
public:
|
|
||||||
// C'tor. TestPartResult does NOT have a default constructor.
|
|
||||||
// Always use this constructor (with parameters) to create a
|
|
||||||
// TestPartResult object.
|
|
||||||
TestPartResult(TestPartResultType type,
|
|
||||||
const char* file_name,
|
|
||||||
int line_number,
|
|
||||||
const char* message)
|
|
||||||
: type_(type),
|
|
||||||
file_name_(file_name),
|
|
||||||
line_number_(line_number),
|
|
||||||
summary_(ExtractSummary(message)),
|
|
||||||
message_(message) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gets the outcome of the test part.
|
|
||||||
TestPartResultType type() const { return type_; }
|
|
||||||
|
|
||||||
// Gets the name of the source file where the test part took place, or
|
|
||||||
// NULL if it's unknown.
|
|
||||||
const char* file_name() const { return file_name_.c_str(); }
|
|
||||||
|
|
||||||
// Gets the line in the source file where the test part took place,
|
|
||||||
// or -1 if it's unknown.
|
|
||||||
int line_number() const { return line_number_; }
|
|
||||||
|
|
||||||
// Gets the summary of the failure message.
|
|
||||||
const char* summary() const { return summary_.c_str(); }
|
|
||||||
|
|
||||||
// Gets the message associated with the test part.
|
|
||||||
const char* message() const { return message_.c_str(); }
|
|
||||||
|
|
||||||
// Returns true iff the test part passed.
|
|
||||||
bool passed() const { return type_ == TPRT_SUCCESS; }
|
|
||||||
|
|
||||||
// Returns true iff the test part failed.
|
|
||||||
bool failed() const { return type_ != TPRT_SUCCESS; }
|
|
||||||
|
|
||||||
// Returns true iff the test part non-fatally failed.
|
|
||||||
bool nonfatally_failed() const { return type_ == TPRT_NONFATAL_FAILURE; }
|
|
||||||
|
|
||||||
// Returns true iff the test part fatally failed.
|
|
||||||
bool fatally_failed() const { return type_ == TPRT_FATAL_FAILURE; }
|
|
||||||
private:
|
|
||||||
TestPartResultType type_;
|
|
||||||
|
|
||||||
// Gets the summary of the failure message by omitting the stack
|
|
||||||
// trace in it.
|
|
||||||
static internal::String ExtractSummary(const char* message);
|
|
||||||
|
|
||||||
// The name of the source file where the test part took place, or
|
|
||||||
// NULL if the source file is unknown.
|
|
||||||
internal::String file_name_;
|
|
||||||
// The line in the source file where the test part took place, or -1
|
|
||||||
// if the line number is unknown.
|
|
||||||
int line_number_;
|
|
||||||
internal::String summary_; // The test failure summary.
|
|
||||||
internal::String message_; // The test failure message.
|
|
||||||
};
|
|
||||||
|
|
||||||
// Prints a TestPartResult object.
|
|
||||||
std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
|
|
||||||
|
|
||||||
// An array of TestPartResult objects.
|
|
||||||
//
|
|
||||||
// We define this class as we cannot use STL containers when compiling
|
|
||||||
// Google Test with MSVC 7.1 and exceptions disabled.
|
|
||||||
//
|
|
||||||
// Don't inherit from TestPartResultArray as its destructor is not
|
|
||||||
// virtual.
|
|
||||||
class TestPartResultArray {
|
|
||||||
public:
|
|
||||||
TestPartResultArray();
|
|
||||||
~TestPartResultArray();
|
|
||||||
|
|
||||||
// Appends the given TestPartResult to the array.
|
|
||||||
void Append(const TestPartResult& result);
|
|
||||||
|
|
||||||
// Returns the TestPartResult at the given index (0-based).
|
|
||||||
const TestPartResult& GetTestPartResult(int index) const;
|
|
||||||
|
|
||||||
// Returns the number of TestPartResult objects in the array.
|
|
||||||
int size() const;
|
|
||||||
private:
|
|
||||||
// Internally we use a list to simulate the array. Yes, this means
|
|
||||||
// that random access is O(N) in time, but it's OK for its purpose.
|
|
||||||
internal::List<TestPartResult>* const list_;
|
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(TestPartResultArray);
|
|
||||||
};
|
|
||||||
|
|
||||||
// This interface knows how to report a test part result.
|
|
||||||
class TestPartResultReporterInterface {
|
|
||||||
public:
|
|
||||||
virtual ~TestPartResultReporterInterface() {}
|
|
||||||
|
|
||||||
virtual void ReportTestPartResult(const TestPartResult& result) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// This helper class can be used to mock out Google Test failure reporting
|
// This helper class can be used to mock out Google Test failure reporting
|
||||||
// so that we can test Google Test or code that builds on Google Test.
|
// so that we can test Google Test or code that builds on Google Test.
|
||||||
//
|
//
|
||||||
// An object of this class appends a TestPartResult object to the
|
// An object of this class appends a TestPartResult object to the
|
||||||
// TestPartResultArray object given in the constructor whenever a
|
// TestPartResultArray object given in the constructor whenever a Google Test
|
||||||
// Google Test failure is reported.
|
// failure is reported. It can either intercept only failures that are
|
||||||
|
// generated in the same thread that created this object or it can intercept
|
||||||
|
// all generated failures. The scope of this mock object can be controlled with
|
||||||
|
// the second argument to the two arguments constructor.
|
||||||
class ScopedFakeTestPartResultReporter
|
class ScopedFakeTestPartResultReporter
|
||||||
: public TestPartResultReporterInterface {
|
: public TestPartResultReporterInterface {
|
||||||
public:
|
public:
|
||||||
|
// The two possible mocking modes of this object.
|
||||||
|
enum InterceptMode {
|
||||||
|
INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
|
||||||
|
INTERCEPT_ALL_THREADS // Intercepts all failures.
|
||||||
|
};
|
||||||
|
|
||||||
// The c'tor sets this object as the test part result reporter used
|
// The c'tor sets this object as the test part result reporter used
|
||||||
// by Google Test. The 'result' parameter specifies where to report the
|
// by Google Test. The 'result' parameter specifies where to report the
|
||||||
// results.
|
// results. This reporter will only catch failures generated in the current
|
||||||
|
// thread. DEPRECATED
|
||||||
explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
|
explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
|
||||||
|
|
||||||
|
// Same as above, but you can choose the interception scope of this object.
|
||||||
|
ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
|
||||||
|
TestPartResultArray* result);
|
||||||
|
|
||||||
// The d'tor restores the previous test part result reporter.
|
// The d'tor restores the previous test part result reporter.
|
||||||
virtual ~ScopedFakeTestPartResultReporter();
|
virtual ~ScopedFakeTestPartResultReporter();
|
||||||
|
|
||||||
@ -167,10 +77,13 @@ class ScopedFakeTestPartResultReporter
|
|||||||
// interface.
|
// interface.
|
||||||
virtual void ReportTestPartResult(const TestPartResult& result);
|
virtual void ReportTestPartResult(const TestPartResult& result);
|
||||||
private:
|
private:
|
||||||
TestPartResultReporterInterface* const old_reporter_;
|
void Init();
|
||||||
|
|
||||||
|
const InterceptMode intercept_mode_;
|
||||||
|
TestPartResultReporterInterface* old_reporter_;
|
||||||
TestPartResultArray* const result_;
|
TestPartResultArray* const result_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(ScopedFakeTestPartResultReporter);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
@ -192,28 +105,53 @@ class SingleFailureChecker {
|
|||||||
const TestPartResultType type_;
|
const TestPartResultType type_;
|
||||||
const String substr_;
|
const String substr_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(SingleFailureChecker);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Helper macro to test that statement generates exactly one fatal failure,
|
||||||
|
// which contains the substring 'substr' in its failure message, when a scoped
|
||||||
|
// test result reporter of the given interception mode is used.
|
||||||
|
#define GTEST_EXPECT_NONFATAL_FAILURE_(statement, substr, intercept_mode)\
|
||||||
|
do {\
|
||||||
|
::testing::TestPartResultArray gtest_failures;\
|
||||||
|
::testing::internal::SingleFailureChecker gtest_checker(\
|
||||||
|
>est_failures, ::testing::TPRT_NONFATAL_FAILURE, (substr));\
|
||||||
|
{\
|
||||||
|
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||||
|
intercept_mode, >est_failures);\
|
||||||
|
statement;\
|
||||||
|
}\
|
||||||
|
} while (false)
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
// A macro for testing Google Test assertions or code that's expected to
|
// A set of macros for testing Google Test assertions or code that's expected
|
||||||
// generate Google Test fatal failures. It verifies that the given
|
// to generate Google Test fatal failures. It verifies that the given
|
||||||
// statement will cause exactly one fatal Google Test failure with 'substr'
|
// statement will cause exactly one fatal Google Test failure with 'substr'
|
||||||
// being part of the failure message.
|
// being part of the failure message.
|
||||||
//
|
//
|
||||||
// Implementation note: The verification is done in the destructor of
|
// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
|
||||||
// SingleFailureChecker, to make sure that it's done even when
|
// affects and considers failures generated in the current thread and
|
||||||
// 'statement' throws an exception.
|
// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
|
||||||
|
//
|
||||||
|
// The verification of the assertion is done correctly even when the statement
|
||||||
|
// throws an exception or aborts the current function.
|
||||||
//
|
//
|
||||||
// Known restrictions:
|
// Known restrictions:
|
||||||
// - 'statement' cannot reference local non-static variables or
|
// - 'statement' cannot reference local non-static variables or
|
||||||
// non-static members of the current object.
|
// non-static members of the current object.
|
||||||
// - 'statement' cannot return a value.
|
// - 'statement' cannot return a value.
|
||||||
// - You cannot stream a failure message to this macro.
|
// - You cannot stream a failure message to this macro.
|
||||||
#define EXPECT_FATAL_FAILURE(statement, substr) do {\
|
//
|
||||||
|
// Note that even though the implementations of the following two
|
||||||
|
// macros are much alike, we cannot refactor them to use a common
|
||||||
|
// helper macro, due to some peculiarity in how the preprocessor
|
||||||
|
// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
|
||||||
|
// gtest_unittest.cc will fail to compile if we do that.
|
||||||
|
#define EXPECT_FATAL_FAILURE(statement, substr) \
|
||||||
|
do { \
|
||||||
class GTestExpectFatalFailureHelper {\
|
class GTestExpectFatalFailureHelper {\
|
||||||
public:\
|
public:\
|
||||||
static void Execute() { statement; }\
|
static void Execute() { statement; }\
|
||||||
@ -223,31 +161,73 @@ class SingleFailureChecker {
|
|||||||
>est_failures, ::testing::TPRT_FATAL_FAILURE, (substr));\
|
>est_failures, ::testing::TPRT_FATAL_FAILURE, (substr));\
|
||||||
{\
|
{\
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||||
>est_failures);\
|
::testing::ScopedFakeTestPartResultReporter:: \
|
||||||
|
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
||||||
|
GTestExpectFatalFailureHelper::Execute();\
|
||||||
|
}\
|
||||||
|
} while (false)
|
||||||
|
|
||||||
|
#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
||||||
|
do { \
|
||||||
|
class GTestExpectFatalFailureHelper {\
|
||||||
|
public:\
|
||||||
|
static void Execute() { statement; }\
|
||||||
|
};\
|
||||||
|
::testing::TestPartResultArray gtest_failures;\
|
||||||
|
::testing::internal::SingleFailureChecker gtest_checker(\
|
||||||
|
>est_failures, ::testing::TPRT_FATAL_FAILURE, (substr));\
|
||||||
|
{\
|
||||||
|
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||||
|
::testing::ScopedFakeTestPartResultReporter:: \
|
||||||
|
INTERCEPT_ALL_THREADS, >est_failures);\
|
||||||
GTestExpectFatalFailureHelper::Execute();\
|
GTestExpectFatalFailureHelper::Execute();\
|
||||||
}\
|
}\
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
// A macro for testing Google Test assertions or code that's expected to
|
// A macro for testing Google Test assertions or code that's expected to
|
||||||
// generate Google Test non-fatal failures. It asserts that the given
|
// generate Google Test non-fatal failures. It asserts that the given
|
||||||
// statement will cause exactly one non-fatal Google Test failure with
|
// statement will cause exactly one non-fatal Google Test failure with 'substr'
|
||||||
// 'substr' being part of the failure message.
|
// being part of the failure message.
|
||||||
|
//
|
||||||
|
// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
|
||||||
|
// affects and considers failures generated in the current thread and
|
||||||
|
// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
|
||||||
//
|
//
|
||||||
// 'statement' is allowed to reference local variables and members of
|
// 'statement' is allowed to reference local variables and members of
|
||||||
// the current object.
|
// the current object.
|
||||||
//
|
//
|
||||||
// Implementation note: The verification is done in the destructor of
|
// The verification of the assertion is done correctly even when the statement
|
||||||
// SingleFailureChecker, to make sure that it's done even when
|
// throws an exception or aborts the current function.
|
||||||
// 'statement' throws an exception or aborts the function.
|
|
||||||
//
|
//
|
||||||
// Known restrictions:
|
// Known restrictions:
|
||||||
// - You cannot stream a failure message to this macro.
|
// - You cannot stream a failure message to this macro.
|
||||||
#define EXPECT_NONFATAL_FAILURE(statement, substr) do {\
|
//
|
||||||
|
// Note that even though the implementations of the following two
|
||||||
|
// macros are much alike, we cannot refactor them to use a common
|
||||||
|
// helper macro, due to some peculiarity in how the preprocessor
|
||||||
|
// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
|
||||||
|
// gtest_unittest.cc will fail to compile if we do that.
|
||||||
|
#define EXPECT_NONFATAL_FAILURE(statement, substr) \
|
||||||
|
do {\
|
||||||
::testing::TestPartResultArray gtest_failures;\
|
::testing::TestPartResultArray gtest_failures;\
|
||||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
::testing::internal::SingleFailureChecker gtest_checker(\
|
||||||
>est_failures, ::testing::TPRT_NONFATAL_FAILURE, (substr));\
|
>est_failures, ::testing::TPRT_NONFATAL_FAILURE, (substr));\
|
||||||
{\
|
{\
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||||
|
::testing::ScopedFakeTestPartResultReporter:: \
|
||||||
|
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
||||||
|
statement;\
|
||||||
|
}\
|
||||||
|
} while (false)
|
||||||
|
|
||||||
|
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
||||||
|
do {\
|
||||||
|
::testing::TestPartResultArray gtest_failures;\
|
||||||
|
::testing::internal::SingleFailureChecker gtest_checker(\
|
||||||
|
>est_failures, ::testing::TPRT_NONFATAL_FAILURE, (substr));\
|
||||||
|
{\
|
||||||
|
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
||||||
|
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\
|
||||||
>est_failures);\
|
>est_failures);\
|
||||||
statement;\
|
statement;\
|
||||||
}\
|
}\
|
||||||
|
179
include/gtest/gtest-test-part.h
Normal file
179
include/gtest/gtest-test-part.h
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
// Copyright 2008, 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.
|
||||||
|
//
|
||||||
|
// Author: mheule@google.com (Markus Heule)
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
||||||
|
#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
||||||
|
|
||||||
|
#include <iosfwd>
|
||||||
|
#include <gtest/internal/gtest-internal.h>
|
||||||
|
#include <gtest/internal/gtest-string.h>
|
||||||
|
|
||||||
|
namespace testing {
|
||||||
|
|
||||||
|
// The possible outcomes of a test part (i.e. an assertion or an
|
||||||
|
// explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
|
||||||
|
enum TestPartResultType {
|
||||||
|
TPRT_SUCCESS, // Succeeded.
|
||||||
|
TPRT_NONFATAL_FAILURE, // Failed but the test can continue.
|
||||||
|
TPRT_FATAL_FAILURE // Failed and the test should be terminated.
|
||||||
|
};
|
||||||
|
|
||||||
|
// A copyable object representing the result of a test part (i.e. an
|
||||||
|
// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
|
||||||
|
//
|
||||||
|
// Don't inherit from TestPartResult as its destructor is not virtual.
|
||||||
|
class TestPartResult {
|
||||||
|
public:
|
||||||
|
// C'tor. TestPartResult does NOT have a default constructor.
|
||||||
|
// Always use this constructor (with parameters) to create a
|
||||||
|
// TestPartResult object.
|
||||||
|
TestPartResult(TestPartResultType type,
|
||||||
|
const char* file_name,
|
||||||
|
int line_number,
|
||||||
|
const char* message)
|
||||||
|
: type_(type),
|
||||||
|
file_name_(file_name),
|
||||||
|
line_number_(line_number),
|
||||||
|
summary_(ExtractSummary(message)),
|
||||||
|
message_(message) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the outcome of the test part.
|
||||||
|
TestPartResultType type() const { return type_; }
|
||||||
|
|
||||||
|
// Gets the name of the source file where the test part took place, or
|
||||||
|
// NULL if it's unknown.
|
||||||
|
const char* file_name() const { return file_name_.c_str(); }
|
||||||
|
|
||||||
|
// Gets the line in the source file where the test part took place,
|
||||||
|
// or -1 if it's unknown.
|
||||||
|
int line_number() const { return line_number_; }
|
||||||
|
|
||||||
|
// Gets the summary of the failure message.
|
||||||
|
const char* summary() const { return summary_.c_str(); }
|
||||||
|
|
||||||
|
// Gets the message associated with the test part.
|
||||||
|
const char* message() const { return message_.c_str(); }
|
||||||
|
|
||||||
|
// Returns true iff the test part passed.
|
||||||
|
bool passed() const { return type_ == TPRT_SUCCESS; }
|
||||||
|
|
||||||
|
// Returns true iff the test part failed.
|
||||||
|
bool failed() const { return type_ != TPRT_SUCCESS; }
|
||||||
|
|
||||||
|
// Returns true iff the test part non-fatally failed.
|
||||||
|
bool nonfatally_failed() const { return type_ == TPRT_NONFATAL_FAILURE; }
|
||||||
|
|
||||||
|
// Returns true iff the test part fatally failed.
|
||||||
|
bool fatally_failed() const { return type_ == TPRT_FATAL_FAILURE; }
|
||||||
|
private:
|
||||||
|
TestPartResultType type_;
|
||||||
|
|
||||||
|
// Gets the summary of the failure message by omitting the stack
|
||||||
|
// trace in it.
|
||||||
|
static internal::String ExtractSummary(const char* message);
|
||||||
|
|
||||||
|
// The name of the source file where the test part took place, or
|
||||||
|
// NULL if the source file is unknown.
|
||||||
|
internal::String file_name_;
|
||||||
|
// The line in the source file where the test part took place, or -1
|
||||||
|
// if the line number is unknown.
|
||||||
|
int line_number_;
|
||||||
|
internal::String summary_; // The test failure summary.
|
||||||
|
internal::String message_; // The test failure message.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Prints a TestPartResult object.
|
||||||
|
std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
|
||||||
|
|
||||||
|
// An array of TestPartResult objects.
|
||||||
|
//
|
||||||
|
// We define this class as we cannot use STL containers when compiling
|
||||||
|
// Google Test with MSVC 7.1 and exceptions disabled.
|
||||||
|
//
|
||||||
|
// Don't inherit from TestPartResultArray as its destructor is not
|
||||||
|
// virtual.
|
||||||
|
class TestPartResultArray {
|
||||||
|
public:
|
||||||
|
TestPartResultArray();
|
||||||
|
~TestPartResultArray();
|
||||||
|
|
||||||
|
// Appends the given TestPartResult to the array.
|
||||||
|
void Append(const TestPartResult& result);
|
||||||
|
|
||||||
|
// Returns the TestPartResult at the given index (0-based).
|
||||||
|
const TestPartResult& GetTestPartResult(int index) const;
|
||||||
|
|
||||||
|
// Returns the number of TestPartResult objects in the array.
|
||||||
|
int size() const;
|
||||||
|
private:
|
||||||
|
// Internally we use a list to simulate the array. Yes, this means
|
||||||
|
// that random access is O(N) in time, but it's OK for its purpose.
|
||||||
|
internal::List<TestPartResult>* const list_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
|
||||||
|
};
|
||||||
|
|
||||||
|
// This interface knows how to report a test part result.
|
||||||
|
class TestPartResultReporterInterface {
|
||||||
|
public:
|
||||||
|
virtual ~TestPartResultReporterInterface() {}
|
||||||
|
|
||||||
|
virtual void ReportTestPartResult(const TestPartResult& result) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
|
||||||
|
// statement generates new fatal failures. To do so it registers itself as the
|
||||||
|
// current test part result reporter. Besides checking if fatal failures were
|
||||||
|
// reported, it only delegates the reporting to the former result reporter.
|
||||||
|
// The original result reporter is restored in the destructor.
|
||||||
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||||
|
class HasNewFatalFailureHelper : public TestPartResultReporterInterface {
|
||||||
|
public:
|
||||||
|
HasNewFatalFailureHelper();
|
||||||
|
virtual ~HasNewFatalFailureHelper();
|
||||||
|
virtual void ReportTestPartResult(const TestPartResult& result);
|
||||||
|
bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
|
||||||
|
private:
|
||||||
|
bool has_new_fatal_failure_;
|
||||||
|
TestPartResultReporterInterface* original_reporter_;
|
||||||
|
|
||||||
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
|
} // namespace testing
|
||||||
|
|
||||||
|
#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
@ -53,7 +53,6 @@
|
|||||||
|
|
||||||
// The following platform macros are used throughout Google Test:
|
// The following platform macros are used throughout Google Test:
|
||||||
// _WIN32_WCE Windows CE (set in project files)
|
// _WIN32_WCE Windows CE (set in project files)
|
||||||
// __SYMBIAN32__ Symbian (set by Symbian tool chain)
|
|
||||||
//
|
//
|
||||||
// Note that even though _MSC_VER and _WIN32_WCE really indicate a compiler
|
// Note that even though _MSC_VER and _WIN32_WCE really indicate a compiler
|
||||||
// and a Win32 implementation, respectively, we use them to indicate the
|
// and a Win32 implementation, respectively, we use them to indicate the
|
||||||
@ -68,6 +67,7 @@
|
|||||||
#include <gtest/gtest-death-test.h>
|
#include <gtest/gtest-death-test.h>
|
||||||
#include <gtest/gtest-message.h>
|
#include <gtest/gtest-message.h>
|
||||||
#include <gtest/gtest_prod.h>
|
#include <gtest/gtest_prod.h>
|
||||||
|
#include <gtest/gtest-test-part.h>
|
||||||
#include <gtest/gtest-typed-test.h>
|
#include <gtest/gtest-typed-test.h>
|
||||||
|
|
||||||
// Depending on the platform, different string classes are available.
|
// Depending on the platform, different string classes are available.
|
||||||
@ -97,19 +97,11 @@ const int kMaxStackTraceDepth = 100;
|
|||||||
|
|
||||||
// This flag specifies the maximum number of stack frames to be
|
// This flag specifies the maximum number of stack frames to be
|
||||||
// printed in a failure message.
|
// printed in a failure message.
|
||||||
GTEST_DECLARE_int32(stack_trace_depth);
|
GTEST_DECLARE_int32_(stack_trace_depth);
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
||||||
// The possible outcomes of a test part (i.e. an assertion or an
|
|
||||||
// explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
|
|
||||||
enum TestPartResultType {
|
|
||||||
TPRT_SUCCESS, // Succeeded.
|
|
||||||
TPRT_NONFATAL_FAILURE, // Failed but the test can continue.
|
|
||||||
TPRT_FATAL_FAILURE // Failed and the test should be terminated.
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
@ -308,7 +300,7 @@ class Test {
|
|||||||
virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
|
virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
|
||||||
|
|
||||||
// We disallow copying Tests.
|
// We disallow copying Tests.
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(Test);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -393,7 +385,7 @@ class TestInfo {
|
|||||||
// An opaque implementation object.
|
// An opaque implementation object.
|
||||||
internal::TestInfoImpl* impl_;
|
internal::TestInfoImpl* impl_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(TestInfo);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
// An Environment object is capable of setting up and tearing down an
|
// An Environment object is capable of setting up and tearing down an
|
||||||
@ -477,7 +469,7 @@ class UnitTest {
|
|||||||
// This method can only be called from the main thread.
|
// This method can only be called from the main thread.
|
||||||
//
|
//
|
||||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||||
int Run() GTEST_MUST_USE_RESULT;
|
int Run() GTEST_MUST_USE_RESULT_;
|
||||||
|
|
||||||
// Returns the working directory when the first TEST() or TEST_F()
|
// Returns the working directory when the first TEST() or TEST_F()
|
||||||
// was executed. The UnitTest object owns the string.
|
// was executed. The UnitTest object owns the string.
|
||||||
@ -523,7 +515,7 @@ class UnitTest {
|
|||||||
internal::UnitTestImpl* impl_;
|
internal::UnitTestImpl* impl_;
|
||||||
|
|
||||||
// We disallow copying UnitTest.
|
// We disallow copying UnitTest.
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(UnitTest);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A convenient wrapper for adding an environment for the test
|
// A convenient wrapper for adding an environment for the test
|
||||||
@ -707,7 +699,7 @@ class EqHelper<true> {
|
|||||||
// with gcc 4.
|
// with gcc 4.
|
||||||
//
|
//
|
||||||
// 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)\
|
#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
|
||||||
template <typename T1, typename T2>\
|
template <typename T1, typename T2>\
|
||||||
AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
||||||
const T1& val1, const T2& val2) {\
|
const T1& val1, const T2& val2) {\
|
||||||
@ -727,17 +719,17 @@ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
|||||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
|
||||||
|
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_NE
|
// Implements the helper function for {ASSERT|EXPECT}_NE
|
||||||
GTEST_IMPL_CMP_HELPER(NE, !=)
|
GTEST_IMPL_CMP_HELPER_(NE, !=)
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_LE
|
// Implements the helper function for {ASSERT|EXPECT}_LE
|
||||||
GTEST_IMPL_CMP_HELPER(LE, <=)
|
GTEST_IMPL_CMP_HELPER_(LE, <=)
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_LT
|
// Implements the helper function for {ASSERT|EXPECT}_LT
|
||||||
GTEST_IMPL_CMP_HELPER(LT, < )
|
GTEST_IMPL_CMP_HELPER_(LT, < )
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_GE
|
// Implements the helper function for {ASSERT|EXPECT}_GE
|
||||||
GTEST_IMPL_CMP_HELPER(GE, >=)
|
GTEST_IMPL_CMP_HELPER_(GE, >=)
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_GT
|
// Implements the helper function for {ASSERT|EXPECT}_GT
|
||||||
GTEST_IMPL_CMP_HELPER(GT, > )
|
GTEST_IMPL_CMP_HELPER_(GT, > )
|
||||||
|
|
||||||
#undef GTEST_IMPL_CMP_HELPER
|
#undef GTEST_IMPL_CMP_HELPER_
|
||||||
|
|
||||||
// The helper function for {ASSERT|EXPECT}_STREQ.
|
// The helper function for {ASSERT|EXPECT}_STREQ.
|
||||||
//
|
//
|
||||||
@ -881,7 +873,7 @@ class AssertHelper {
|
|||||||
AssertHelper(TestPartResultType type, const char* file, int line,
|
AssertHelper(TestPartResultType type, const char* file, int line,
|
||||||
const char* message);
|
const char* message);
|
||||||
// Message assignment is a semantic trick to enable assertion
|
// Message assignment is a semantic trick to enable assertion
|
||||||
// streaming; see the GTEST_MESSAGE macro below.
|
// streaming; see the GTEST_MESSAGE_ macro below.
|
||||||
void operator=(const Message& message) const;
|
void operator=(const Message& message) const;
|
||||||
private:
|
private:
|
||||||
TestPartResultType const type_;
|
TestPartResultType const type_;
|
||||||
@ -889,7 +881,7 @@ class AssertHelper {
|
|||||||
int const line_;
|
int const line_;
|
||||||
String const message_;
|
String const message_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(AssertHelper);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
@ -920,13 +912,13 @@ class AssertHelper {
|
|||||||
// << "There are still pending requests " << "on port " << port;
|
// << "There are still pending requests " << "on port " << port;
|
||||||
|
|
||||||
// Generates a nonfatal failure with a generic message.
|
// Generates a nonfatal failure with a generic message.
|
||||||
#define ADD_FAILURE() GTEST_NONFATAL_FAILURE("Failed")
|
#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
|
||||||
|
|
||||||
// Generates a fatal failure with a generic message.
|
// Generates a fatal failure with a generic message.
|
||||||
#define FAIL() GTEST_FATAL_FAILURE("Failed")
|
#define FAIL() GTEST_FATAL_FAILURE_("Failed")
|
||||||
|
|
||||||
// Generates a success with a generic message.
|
// Generates a success with a generic message.
|
||||||
#define SUCCEED() GTEST_SUCCESS("Succeeded")
|
#define SUCCEED() GTEST_SUCCESS_("Succeeded")
|
||||||
|
|
||||||
// Macros for testing exceptions.
|
// Macros for testing exceptions.
|
||||||
//
|
//
|
||||||
@ -938,31 +930,31 @@ class AssertHelper {
|
|||||||
// Tests that the statement throws an exception.
|
// Tests that the statement throws an exception.
|
||||||
|
|
||||||
#define EXPECT_THROW(statement, expected_exception) \
|
#define EXPECT_THROW(statement, expected_exception) \
|
||||||
GTEST_TEST_THROW(statement, expected_exception, GTEST_NONFATAL_FAILURE)
|
GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_NO_THROW(statement) \
|
#define EXPECT_NO_THROW(statement) \
|
||||||
GTEST_TEST_NO_THROW(statement, GTEST_NONFATAL_FAILURE)
|
GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_ANY_THROW(statement) \
|
#define EXPECT_ANY_THROW(statement) \
|
||||||
GTEST_TEST_ANY_THROW(statement, GTEST_NONFATAL_FAILURE)
|
GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
|
||||||
#define ASSERT_THROW(statement, expected_exception) \
|
#define ASSERT_THROW(statement, expected_exception) \
|
||||||
GTEST_TEST_THROW(statement, expected_exception, GTEST_FATAL_FAILURE)
|
GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_NO_THROW(statement) \
|
#define ASSERT_NO_THROW(statement) \
|
||||||
GTEST_TEST_NO_THROW(statement, GTEST_FATAL_FAILURE)
|
GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_ANY_THROW(statement) \
|
#define ASSERT_ANY_THROW(statement) \
|
||||||
GTEST_TEST_ANY_THROW(statement, GTEST_FATAL_FAILURE)
|
GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
// Boolean assertions.
|
// Boolean assertions.
|
||||||
#define EXPECT_TRUE(condition) \
|
#define EXPECT_TRUE(condition) \
|
||||||
GTEST_TEST_BOOLEAN(condition, #condition, false, true, \
|
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
||||||
GTEST_NONFATAL_FAILURE)
|
GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_FALSE(condition) \
|
#define EXPECT_FALSE(condition) \
|
||||||
GTEST_TEST_BOOLEAN(!(condition), #condition, true, false, \
|
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
||||||
GTEST_NONFATAL_FAILURE)
|
GTEST_NONFATAL_FAILURE_)
|
||||||
#define ASSERT_TRUE(condition) \
|
#define ASSERT_TRUE(condition) \
|
||||||
GTEST_TEST_BOOLEAN(condition, #condition, false, true, \
|
GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
|
||||||
GTEST_FATAL_FAILURE)
|
GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_FALSE(condition) \
|
#define ASSERT_FALSE(condition) \
|
||||||
GTEST_TEST_BOOLEAN(!(condition), #condition, true, false, \
|
GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
|
||||||
GTEST_FATAL_FAILURE)
|
GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
// Includes the auto-generated header that implements a family of
|
// Includes the auto-generated header that implements a family of
|
||||||
// generic predicate assertion macros.
|
// generic predicate assertion macros.
|
||||||
@ -1016,7 +1008,7 @@ class AssertHelper {
|
|||||||
|
|
||||||
#define EXPECT_EQ(expected, actual) \
|
#define EXPECT_EQ(expected, actual) \
|
||||||
EXPECT_PRED_FORMAT2(::testing::internal:: \
|
EXPECT_PRED_FORMAT2(::testing::internal:: \
|
||||||
EqHelper<GTEST_IS_NULL_LITERAL(expected)>::Compare, \
|
EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
|
||||||
expected, actual)
|
expected, actual)
|
||||||
#define EXPECT_NE(expected, actual) \
|
#define EXPECT_NE(expected, actual) \
|
||||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
|
||||||
@ -1031,7 +1023,7 @@ class AssertHelper {
|
|||||||
|
|
||||||
#define ASSERT_EQ(expected, actual) \
|
#define ASSERT_EQ(expected, actual) \
|
||||||
ASSERT_PRED_FORMAT2(::testing::internal:: \
|
ASSERT_PRED_FORMAT2(::testing::internal:: \
|
||||||
EqHelper<GTEST_IS_NULL_LITERAL(expected)>::Compare, \
|
EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
|
||||||
expected, actual)
|
expected, actual)
|
||||||
#define ASSERT_NE(val1, val2) \
|
#define ASSERT_NE(val1, val2) \
|
||||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
|
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
|
||||||
@ -1154,6 +1146,20 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|||||||
|
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
|
// Macros that execute statement and check that it doesn't generate new fatal
|
||||||
|
// failures in the current thread.
|
||||||
|
//
|
||||||
|
// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
//
|
||||||
|
// EXPECT_NO_FATAL_FAILURE(Process());
|
||||||
|
// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
|
||||||
|
//
|
||||||
|
#define ASSERT_NO_FATAL_FAILURE(statement) \
|
||||||
|
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
|
||||||
|
#define EXPECT_NO_FATAL_FAILURE(statement) \
|
||||||
|
GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
|
||||||
|
|
||||||
// Causes a trace (including the source file path, the current line
|
// Causes a trace (including the source file path, the current line
|
||||||
// number, and the given message) to be included in every test failure
|
// number, and the given message) to be included in every test failure
|
||||||
@ -1167,7 +1173,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|||||||
// to appear in the same block - as long as they are on different
|
// to appear in the same block - as long as they are on different
|
||||||
// lines.
|
// lines.
|
||||||
#define SCOPED_TRACE(message) \
|
#define SCOPED_TRACE(message) \
|
||||||
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN(gtest_trace_, __LINE__)(\
|
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
|
||||||
__FILE__, __LINE__, ::testing::Message() << (message))
|
__FILE__, __LINE__, ::testing::Message() << (message))
|
||||||
|
|
||||||
|
|
||||||
@ -1188,7 +1194,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
#define TEST(test_case_name, test_name)\
|
#define TEST(test_case_name, test_name)\
|
||||||
GTEST_TEST(test_case_name, test_name, ::testing::Test)
|
GTEST_TEST_(test_case_name, test_name, ::testing::Test)
|
||||||
|
|
||||||
|
|
||||||
// Defines a test that uses a test fixture.
|
// Defines a test that uses a test fixture.
|
||||||
@ -1218,7 +1224,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
#define TEST_F(test_fixture, test_name)\
|
#define TEST_F(test_fixture, test_name)\
|
||||||
GTEST_TEST(test_fixture, test_name, test_fixture)
|
GTEST_TEST_(test_fixture, test_name, test_fixture)
|
||||||
|
|
||||||
// Use this macro in main() to run all tests. It returns 0 if all
|
// Use this macro in main() to run all tests. It returns 0 if all
|
||||||
// tests are successful, or 1 otherwise.
|
// tests are successful, or 1 otherwise.
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
// (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.
|
||||||
|
|
||||||
// This file is AUTOMATICALLY GENERATED on 06/22/2008 by command
|
// This file is AUTOMATICALLY GENERATED on 10/02/2008 by command
|
||||||
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
|
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
|
||||||
//
|
//
|
||||||
// Implements a family of generic predicate assertion macros.
|
// Implements a family of generic predicate assertion macros.
|
||||||
@ -69,11 +69,11 @@
|
|||||||
// Please email googletestframework@googlegroups.com if you need
|
// Please email googletestframework@googlegroups.com if you need
|
||||||
// support for higher arities.
|
// support for higher arities.
|
||||||
|
|
||||||
// GTEST_ASSERT is the basic statement to which all of the assertions
|
// GTEST_ASSERT_ is the basic statement to which all of the assertions
|
||||||
// in this file reduce. Don't use this in your code.
|
// in this file reduce. Don't use this in your code.
|
||||||
|
|
||||||
#define GTEST_ASSERT(expression, on_failure) \
|
#define GTEST_ASSERT_(expression, on_failure) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (const ::testing::AssertionResult gtest_ar = (expression)) \
|
if (const ::testing::AssertionResult gtest_ar = (expression)) \
|
||||||
; \
|
; \
|
||||||
else \
|
else \
|
||||||
@ -99,27 +99,27 @@ AssertionResult AssertPred1Helper(const char* pred_text,
|
|||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
|
||||||
// Don't use this in your code.
|
// Don't use this in your code.
|
||||||
#define GTEST_PRED_FORMAT1(pred_format, v1, on_failure)\
|
#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
|
||||||
GTEST_ASSERT(pred_format(#v1, v1),\
|
GTEST_ASSERT_(pred_format(#v1, v1),\
|
||||||
on_failure)
|
on_failure)
|
||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
|
||||||
// this in your code.
|
// this in your code.
|
||||||
#define GTEST_PRED1(pred, v1, on_failure)\
|
#define GTEST_PRED1_(pred, v1, on_failure)\
|
||||||
GTEST_ASSERT(::testing::AssertPred1Helper(#pred, \
|
GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
|
||||||
#v1, \
|
#v1, \
|
||||||
pred, \
|
pred, \
|
||||||
v1), on_failure)
|
v1), on_failure)
|
||||||
|
|
||||||
// Unary predicate assertion macros.
|
// Unary predicate assertion macros.
|
||||||
#define EXPECT_PRED_FORMAT1(pred_format, v1) \
|
#define EXPECT_PRED_FORMAT1(pred_format, v1) \
|
||||||
GTEST_PRED_FORMAT1(pred_format, v1, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_PRED1(pred, v1) \
|
#define EXPECT_PRED1(pred, v1) \
|
||||||
GTEST_PRED1(pred, v1, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
|
||||||
#define ASSERT_PRED_FORMAT1(pred_format, v1) \
|
#define ASSERT_PRED_FORMAT1(pred_format, v1) \
|
||||||
GTEST_PRED_FORMAT1(pred_format, v1, GTEST_FATAL_FAILURE)
|
GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_PRED1(pred, v1) \
|
#define ASSERT_PRED1(pred, v1) \
|
||||||
GTEST_PRED1(pred, v1, GTEST_FATAL_FAILURE)
|
GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -147,14 +147,14 @@ AssertionResult AssertPred2Helper(const char* pred_text,
|
|||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
|
||||||
// Don't use this in your code.
|
// Don't use this in your code.
|
||||||
#define GTEST_PRED_FORMAT2(pred_format, v1, v2, on_failure)\
|
#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
|
||||||
GTEST_ASSERT(pred_format(#v1, #v2, v1, v2),\
|
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
|
||||||
on_failure)
|
on_failure)
|
||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
|
||||||
// this in your code.
|
// this in your code.
|
||||||
#define GTEST_PRED2(pred, v1, v2, on_failure)\
|
#define GTEST_PRED2_(pred, v1, v2, on_failure)\
|
||||||
GTEST_ASSERT(::testing::AssertPred2Helper(#pred, \
|
GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
|
||||||
#v1, \
|
#v1, \
|
||||||
#v2, \
|
#v2, \
|
||||||
pred, \
|
pred, \
|
||||||
@ -163,13 +163,13 @@ AssertionResult AssertPred2Helper(const char* pred_text,
|
|||||||
|
|
||||||
// Binary predicate assertion macros.
|
// Binary predicate assertion macros.
|
||||||
#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
|
#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
|
||||||
GTEST_PRED_FORMAT2(pred_format, v1, v2, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_PRED2(pred, v1, v2) \
|
#define EXPECT_PRED2(pred, v1, v2) \
|
||||||
GTEST_PRED2(pred, v1, v2, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
|
||||||
#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
|
#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
|
||||||
GTEST_PRED_FORMAT2(pred_format, v1, v2, GTEST_FATAL_FAILURE)
|
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_PRED2(pred, v1, v2) \
|
#define ASSERT_PRED2(pred, v1, v2) \
|
||||||
GTEST_PRED2(pred, v1, v2, GTEST_FATAL_FAILURE)
|
GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -202,14 +202,14 @@ AssertionResult AssertPred3Helper(const char* pred_text,
|
|||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
|
||||||
// Don't use this in your code.
|
// Don't use this in your code.
|
||||||
#define GTEST_PRED_FORMAT3(pred_format, v1, v2, v3, on_failure)\
|
#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
|
||||||
GTEST_ASSERT(pred_format(#v1, #v2, #v3, v1, v2, v3),\
|
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3),\
|
||||||
on_failure)
|
on_failure)
|
||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
|
||||||
// this in your code.
|
// this in your code.
|
||||||
#define GTEST_PRED3(pred, v1, v2, v3, on_failure)\
|
#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
|
||||||
GTEST_ASSERT(::testing::AssertPred3Helper(#pred, \
|
GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
|
||||||
#v1, \
|
#v1, \
|
||||||
#v2, \
|
#v2, \
|
||||||
#v3, \
|
#v3, \
|
||||||
@ -220,13 +220,13 @@ AssertionResult AssertPred3Helper(const char* pred_text,
|
|||||||
|
|
||||||
// Ternary predicate assertion macros.
|
// Ternary predicate assertion macros.
|
||||||
#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
|
#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
|
||||||
GTEST_PRED_FORMAT3(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_PRED3(pred, v1, v2, v3) \
|
#define EXPECT_PRED3(pred, v1, v2, v3) \
|
||||||
GTEST_PRED3(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
|
||||||
#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
|
#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
|
||||||
GTEST_PRED_FORMAT3(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE)
|
GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_PRED3(pred, v1, v2, v3) \
|
#define ASSERT_PRED3(pred, v1, v2, v3) \
|
||||||
GTEST_PRED3(pred, v1, v2, v3, GTEST_FATAL_FAILURE)
|
GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -264,14 +264,14 @@ AssertionResult AssertPred4Helper(const char* pred_text,
|
|||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
|
||||||
// Don't use this in your code.
|
// Don't use this in your code.
|
||||||
#define GTEST_PRED_FORMAT4(pred_format, v1, v2, v3, v4, on_failure)\
|
#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
|
||||||
GTEST_ASSERT(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\
|
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\
|
||||||
on_failure)
|
on_failure)
|
||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
|
||||||
// this in your code.
|
// this in your code.
|
||||||
#define GTEST_PRED4(pred, v1, v2, v3, v4, on_failure)\
|
#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
|
||||||
GTEST_ASSERT(::testing::AssertPred4Helper(#pred, \
|
GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
|
||||||
#v1, \
|
#v1, \
|
||||||
#v2, \
|
#v2, \
|
||||||
#v3, \
|
#v3, \
|
||||||
@ -284,13 +284,13 @@ AssertionResult AssertPred4Helper(const char* pred_text,
|
|||||||
|
|
||||||
// 4-ary predicate assertion macros.
|
// 4-ary predicate assertion macros.
|
||||||
#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
|
#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
|
||||||
GTEST_PRED_FORMAT4(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
|
#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
|
||||||
GTEST_PRED4(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
|
||||||
#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
|
#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
|
||||||
GTEST_PRED_FORMAT4(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE)
|
GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
|
#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
|
||||||
GTEST_PRED4(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE)
|
GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -333,14 +333,14 @@ AssertionResult AssertPred5Helper(const char* pred_text,
|
|||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
|
||||||
// Don't use this in your code.
|
// Don't use this in your code.
|
||||||
#define GTEST_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5, on_failure)\
|
#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
|
||||||
GTEST_ASSERT(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\
|
GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\
|
||||||
on_failure)
|
on_failure)
|
||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
|
||||||
// this in your code.
|
// this in your code.
|
||||||
#define GTEST_PRED5(pred, v1, v2, v3, v4, v5, on_failure)\
|
#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
|
||||||
GTEST_ASSERT(::testing::AssertPred5Helper(#pred, \
|
GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
|
||||||
#v1, \
|
#v1, \
|
||||||
#v2, \
|
#v2, \
|
||||||
#v3, \
|
#v3, \
|
||||||
@ -355,13 +355,13 @@ AssertionResult AssertPred5Helper(const char* pred_text,
|
|||||||
|
|
||||||
// 5-ary predicate assertion macros.
|
// 5-ary predicate assertion macros.
|
||||||
#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
|
#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
|
||||||
GTEST_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
|
#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
|
||||||
GTEST_PRED5(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
|
||||||
#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
|
#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
|
||||||
GTEST_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE)
|
GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
|
#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
|
||||||
GTEST_PRED5(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE)
|
GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
GTEST_DECLARE_string(internal_run_death_test);
|
GTEST_DECLARE_string_(internal_run_death_test);
|
||||||
|
|
||||||
// Names of the flags (needed for parsing Google Test flags).
|
// Names of the flags (needed for parsing Google Test flags).
|
||||||
const char kDeathTestStyleFlag[] = "death_test_style";
|
const char kDeathTestStyleFlag[] = "death_test_style";
|
||||||
@ -51,7 +51,7 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
|
|||||||
#ifdef GTEST_HAS_DEATH_TEST
|
#ifdef GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
// DeathTest is a class that hides much of the complexity of the
|
// DeathTest is a class that hides much of the complexity of the
|
||||||
// GTEST_DEATH_TEST macro. It is abstract; its static Create method
|
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
|
||||||
// returns a concrete class that depends on the prevailing death test
|
// returns a concrete class that depends on the prevailing death test
|
||||||
// style, as defined by the --gtest_death_test_style and/or
|
// style, as defined by the --gtest_death_test_style and/or
|
||||||
// --gtest_internal_run_death_test flags.
|
// --gtest_internal_run_death_test flags.
|
||||||
@ -85,8 +85,8 @@ class DeathTest {
|
|||||||
~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
|
~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }
|
||||||
private:
|
private:
|
||||||
DeathTest* const test_;
|
DeathTest* const test_;
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(ReturnSentinel);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel);
|
||||||
} GTEST_ATTRIBUTE_UNUSED;
|
} GTEST_ATTRIBUTE_UNUSED_;
|
||||||
|
|
||||||
// An enumeration of possible roles that may be taken when a death
|
// An enumeration of possible roles that may be taken when a death
|
||||||
// test is encountered. EXECUTE means that the death test logic should
|
// test is encountered. EXECUTE means that the death test logic should
|
||||||
@ -121,7 +121,7 @@ class DeathTest {
|
|||||||
static const char* LastMessage();
|
static const char* LastMessage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(DeathTest);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Factory interface for death tests. May be mocked out for testing.
|
// Factory interface for death tests. May be mocked out for testing.
|
||||||
@ -145,14 +145,14 @@ bool ExitedUnsuccessfully(int exit_status);
|
|||||||
|
|
||||||
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
|
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
|
||||||
// ASSERT_EXIT*, and EXPECT_EXIT*.
|
// ASSERT_EXIT*, and EXPECT_EXIT*.
|
||||||
#define GTEST_DEATH_TEST(statement, predicate, regex, fail) \
|
#define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (true) { \
|
if (true) { \
|
||||||
const ::testing::internal::RE& gtest_regex = (regex); \
|
const ::testing::internal::RE& gtest_regex = (regex); \
|
||||||
::testing::internal::DeathTest* gtest_dt; \
|
::testing::internal::DeathTest* gtest_dt; \
|
||||||
if (!::testing::internal::DeathTest::Create(#statement, >est_regex, \
|
if (!::testing::internal::DeathTest::Create(#statement, >est_regex, \
|
||||||
__FILE__, __LINE__, >est_dt)) { \
|
__FILE__, __LINE__, >est_dt)) { \
|
||||||
goto GTEST_CONCAT_TOKEN(gtest_label_, __LINE__); \
|
goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
|
||||||
} \
|
} \
|
||||||
if (gtest_dt != NULL) { \
|
if (gtest_dt != NULL) { \
|
||||||
::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
|
::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \
|
||||||
@ -160,7 +160,7 @@ bool ExitedUnsuccessfully(int exit_status);
|
|||||||
switch (gtest_dt->AssumeRole()) { \
|
switch (gtest_dt->AssumeRole()) { \
|
||||||
case ::testing::internal::DeathTest::OVERSEE_TEST: \
|
case ::testing::internal::DeathTest::OVERSEE_TEST: \
|
||||||
if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
|
if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \
|
||||||
goto GTEST_CONCAT_TOKEN(gtest_label_, __LINE__); \
|
goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \
|
||||||
} \
|
} \
|
||||||
break; \
|
break; \
|
||||||
case ::testing::internal::DeathTest::EXECUTE_TEST: { \
|
case ::testing::internal::DeathTest::EXECUTE_TEST: { \
|
||||||
@ -173,7 +173,7 @@ bool ExitedUnsuccessfully(int exit_status);
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} else \
|
} else \
|
||||||
GTEST_CONCAT_TOKEN(gtest_label_, __LINE__): \
|
GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \
|
||||||
fail(::testing::internal::DeathTest::LastMessage())
|
fail(::testing::internal::DeathTest::LastMessage())
|
||||||
// The symbol "fail" here expands to something into which a message
|
// The symbol "fail" here expands to something into which a message
|
||||||
// can be streamed.
|
// can be streamed.
|
||||||
|
@ -64,8 +64,8 @@
|
|||||||
// will result in the token foo__LINE__, instead of foo followed by
|
// will result in the token foo__LINE__, instead of foo followed by
|
||||||
// the current line number. For more details, see
|
// the current line number. For more details, see
|
||||||
// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
|
// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
|
||||||
#define GTEST_CONCAT_TOKEN(foo, bar) GTEST_CONCAT_TOKEN_IMPL(foo, bar)
|
#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
|
||||||
#define GTEST_CONCAT_TOKEN_IMPL(foo, bar) foo ## bar
|
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
|
||||||
|
|
||||||
// Google Test defines the testing::Message class to allow construction of
|
// Google Test defines the testing::Message class to allow construction of
|
||||||
// test messages via the << operator. The idea is that anything
|
// test messages via the << operator. The idea is that anything
|
||||||
@ -121,6 +121,10 @@ class UnitTestImpl; // Opaque implementation of UnitTest
|
|||||||
template <typename E> class List; // A generic list.
|
template <typename E> class List; // A generic list.
|
||||||
template <typename E> class ListNode; // A node in a generic list.
|
template <typename E> class ListNode; // A node in a generic list.
|
||||||
|
|
||||||
|
// The text used in failure messages to indicate the start of the
|
||||||
|
// stack trace.
|
||||||
|
extern const char kStackTraceMarker[];
|
||||||
|
|
||||||
// A secret type that Google Test users don't know about. It has no
|
// A secret type that Google Test users don't know about. It has no
|
||||||
// definition on purpose. Therefore it's impossible to create a
|
// definition on purpose. Therefore it's impossible to create a
|
||||||
// Secret object, which is what we want.
|
// Secret object, which is what we want.
|
||||||
@ -151,11 +155,11 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT
|
|||||||
// The Nokia Symbian compiler tries to instantiate a copy constructor for
|
// The Nokia Symbian compiler tries to instantiate a copy constructor for
|
||||||
// objects passed through ellipsis (...), failing for uncopyable objects.
|
// objects passed through ellipsis (...), failing for uncopyable objects.
|
||||||
// Hence we define this to false (and lose support for NULL detection).
|
// Hence we define this to false (and lose support for NULL detection).
|
||||||
#define GTEST_IS_NULL_LITERAL(x) false
|
#define GTEST_IS_NULL_LITERAL_(x) false
|
||||||
#else // ! __SYMBIAN32__
|
#else // ! GTEST_OS_SYMBIAN
|
||||||
#define GTEST_IS_NULL_LITERAL(x) \
|
#define GTEST_IS_NULL_LITERAL_(x) \
|
||||||
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
|
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
|
||||||
#endif // __SYMBIAN32__
|
#endif // GTEST_OS_SYMBIAN
|
||||||
|
|
||||||
// Appends the user-supplied message to the Google-Test-generated message.
|
// Appends the user-supplied message to the Google-Test-generated message.
|
||||||
String AppendUserMessage(const String& gtest_msg,
|
String AppendUserMessage(const String& gtest_msg,
|
||||||
@ -175,8 +179,8 @@ class ScopedTrace {
|
|||||||
~ScopedTrace();
|
~ScopedTrace();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(ScopedTrace);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
|
||||||
} 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.
|
||||||
|
|
||||||
@ -192,7 +196,7 @@ String StreamableToString(const T& streamable);
|
|||||||
|
|
||||||
// Formats a value to be used in a failure message.
|
// Formats a value to be used in a failure message.
|
||||||
|
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef GTEST_OS_SYMBIAN
|
||||||
|
|
||||||
// These are needed as the Nokia Symbian Compiler cannot decide between
|
// These are needed as the Nokia Symbian Compiler cannot decide between
|
||||||
// const T& and const T* in a function template. The Nokia compiler _can_
|
// const T& and const T* in a function template. The Nokia compiler _can_
|
||||||
@ -233,7 +237,7 @@ inline String FormatForFailureMessage(T* pointer) {
|
|||||||
return StreamableToString(static_cast<const void*>(pointer));
|
return StreamableToString(static_cast<const void*>(pointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __SYMBIAN32__
|
#endif // GTEST_OS_SYMBIAN
|
||||||
|
|
||||||
// These overloaded versions handle narrow and wide characters.
|
// These overloaded versions handle narrow and wide characters.
|
||||||
String FormatForFailureMessage(char ch);
|
String FormatForFailureMessage(char ch);
|
||||||
@ -244,7 +248,7 @@ String FormatForFailureMessage(wchar_t wchar);
|
|||||||
// rather than a pointer. We do the same for wide strings.
|
// rather than a pointer. We do the same for wide strings.
|
||||||
|
|
||||||
// This internal macro is used to avoid duplicated code.
|
// This internal macro is used to avoid duplicated code.
|
||||||
#define GTEST_FORMAT_IMPL(operand2_type, operand1_printer)\
|
#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)\
|
||||||
inline String FormatForComparisonFailureMessage(\
|
inline String FormatForComparisonFailureMessage(\
|
||||||
operand2_type::value_type* str, const operand2_type& /*operand2*/) {\
|
operand2_type::value_type* str, const operand2_type& /*operand2*/) {\
|
||||||
return operand1_printer(str);\
|
return operand1_printer(str);\
|
||||||
@ -255,20 +259,20 @@ inline String FormatForComparisonFailureMessage(\
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_STD_STRING
|
#if GTEST_HAS_STD_STRING
|
||||||
GTEST_FORMAT_IMPL(::std::string, String::ShowCStringQuoted)
|
GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)
|
||||||
#endif // GTEST_HAS_STD_STRING
|
#endif // GTEST_HAS_STD_STRING
|
||||||
#if GTEST_HAS_STD_WSTRING
|
#if GTEST_HAS_STD_WSTRING
|
||||||
GTEST_FORMAT_IMPL(::std::wstring, String::ShowWideCStringQuoted)
|
GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)
|
||||||
#endif // GTEST_HAS_STD_WSTRING
|
#endif // GTEST_HAS_STD_WSTRING
|
||||||
|
|
||||||
#if GTEST_HAS_GLOBAL_STRING
|
#if GTEST_HAS_GLOBAL_STRING
|
||||||
GTEST_FORMAT_IMPL(::string, String::ShowCStringQuoted)
|
GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)
|
||||||
#endif // GTEST_HAS_GLOBAL_STRING
|
#endif // GTEST_HAS_GLOBAL_STRING
|
||||||
#if GTEST_HAS_GLOBAL_WSTRING
|
#if GTEST_HAS_GLOBAL_WSTRING
|
||||||
GTEST_FORMAT_IMPL(::wstring, String::ShowWideCStringQuoted)
|
GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
|
||||||
#endif // GTEST_HAS_GLOBAL_WSTRING
|
#endif // GTEST_HAS_GLOBAL_WSTRING
|
||||||
|
|
||||||
#undef GTEST_FORMAT_IMPL
|
#undef GTEST_FORMAT_IMPL_
|
||||||
|
|
||||||
// Constructs and returns the message for an equality assertion
|
// Constructs and returns the message for an equality assertion
|
||||||
// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
|
// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
|
||||||
@ -503,7 +507,7 @@ class TestFactoryBase {
|
|||||||
TestFactoryBase() {}
|
TestFactoryBase() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(TestFactoryBase);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);
|
||||||
};
|
};
|
||||||
|
|
||||||
// This class provides implementation of TeastFactoryBase interface.
|
// This class provides implementation of TeastFactoryBase interface.
|
||||||
@ -704,22 +708,22 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {
|
|||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#define GTEST_MESSAGE(message, result_type) \
|
#define GTEST_MESSAGE_(message, result_type) \
|
||||||
::testing::internal::AssertHelper(result_type, __FILE__, __LINE__, message) \
|
::testing::internal::AssertHelper(result_type, __FILE__, __LINE__, message) \
|
||||||
= ::testing::Message()
|
= ::testing::Message()
|
||||||
|
|
||||||
#define GTEST_FATAL_FAILURE(message) \
|
#define GTEST_FATAL_FAILURE_(message) \
|
||||||
return GTEST_MESSAGE(message, ::testing::TPRT_FATAL_FAILURE)
|
return GTEST_MESSAGE_(message, ::testing::TPRT_FATAL_FAILURE)
|
||||||
|
|
||||||
#define GTEST_NONFATAL_FAILURE(message) \
|
#define GTEST_NONFATAL_FAILURE_(message) \
|
||||||
GTEST_MESSAGE(message, ::testing::TPRT_NONFATAL_FAILURE)
|
GTEST_MESSAGE_(message, ::testing::TPRT_NONFATAL_FAILURE)
|
||||||
|
|
||||||
#define GTEST_SUCCESS(message) \
|
#define GTEST_SUCCESS_(message) \
|
||||||
GTEST_MESSAGE(message, ::testing::TPRT_SUCCESS)
|
GTEST_MESSAGE_(message, ::testing::TPRT_SUCCESS)
|
||||||
|
|
||||||
|
|
||||||
#define GTEST_TEST_THROW(statement, expected_exception, fail) \
|
#define GTEST_TEST_THROW_(statement, expected_exception, fail) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (const char* gtest_msg = "") { \
|
if (const char* gtest_msg = "") { \
|
||||||
bool gtest_caught_expected = false; \
|
bool gtest_caught_expected = false; \
|
||||||
try { \
|
try { \
|
||||||
@ -732,19 +736,19 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {
|
|||||||
gtest_msg = "Expected: " #statement " throws an exception of type " \
|
gtest_msg = "Expected: " #statement " throws an exception of type " \
|
||||||
#expected_exception ".\n Actual: it throws a different " \
|
#expected_exception ".\n Actual: it throws a different " \
|
||||||
"type."; \
|
"type."; \
|
||||||
goto GTEST_CONCAT_TOKEN(gtest_label_testthrow_, __LINE__); \
|
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
|
||||||
} \
|
} \
|
||||||
if (!gtest_caught_expected) { \
|
if (!gtest_caught_expected) { \
|
||||||
gtest_msg = "Expected: " #statement " throws an exception of type " \
|
gtest_msg = "Expected: " #statement " throws an exception of type " \
|
||||||
#expected_exception ".\n Actual: it throws nothing."; \
|
#expected_exception ".\n Actual: it throws nothing."; \
|
||||||
goto GTEST_CONCAT_TOKEN(gtest_label_testthrow_, __LINE__); \
|
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
|
||||||
} \
|
} \
|
||||||
} else \
|
} else \
|
||||||
GTEST_CONCAT_TOKEN(gtest_label_testthrow_, __LINE__): \
|
GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
|
||||||
fail(gtest_msg)
|
fail(gtest_msg)
|
||||||
|
|
||||||
#define GTEST_TEST_NO_THROW(statement, fail) \
|
#define GTEST_TEST_NO_THROW_(statement, fail) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (const char* gtest_msg = "") { \
|
if (const char* gtest_msg = "") { \
|
||||||
try { \
|
try { \
|
||||||
statement; \
|
statement; \
|
||||||
@ -752,14 +756,14 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {
|
|||||||
catch (...) { \
|
catch (...) { \
|
||||||
gtest_msg = "Expected: " #statement " doesn't throw an exception.\n" \
|
gtest_msg = "Expected: " #statement " doesn't throw an exception.\n" \
|
||||||
" Actual: it throws."; \
|
" Actual: it throws."; \
|
||||||
goto GTEST_CONCAT_TOKEN(gtest_label_testnothrow_, __LINE__); \
|
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
|
||||||
} \
|
} \
|
||||||
} else \
|
} else \
|
||||||
GTEST_CONCAT_TOKEN(gtest_label_testnothrow_, __LINE__): \
|
GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
|
||||||
fail(gtest_msg)
|
fail(gtest_msg)
|
||||||
|
|
||||||
#define GTEST_TEST_ANY_THROW(statement, fail) \
|
#define GTEST_TEST_ANY_THROW_(statement, fail) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (const char* gtest_msg = "") { \
|
if (const char* gtest_msg = "") { \
|
||||||
bool gtest_caught_any = false; \
|
bool gtest_caught_any = false; \
|
||||||
try { \
|
try { \
|
||||||
@ -771,33 +775,48 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {
|
|||||||
if (!gtest_caught_any) { \
|
if (!gtest_caught_any) { \
|
||||||
gtest_msg = "Expected: " #statement " throws an exception.\n" \
|
gtest_msg = "Expected: " #statement " throws an exception.\n" \
|
||||||
" Actual: it doesn't."; \
|
" Actual: it doesn't."; \
|
||||||
goto GTEST_CONCAT_TOKEN(gtest_label_testanythrow_, __LINE__); \
|
goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
|
||||||
} \
|
} \
|
||||||
} else \
|
} else \
|
||||||
GTEST_CONCAT_TOKEN(gtest_label_testanythrow_, __LINE__): \
|
GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
|
||||||
fail(gtest_msg)
|
fail(gtest_msg)
|
||||||
|
|
||||||
|
|
||||||
#define GTEST_TEST_BOOLEAN(boolexpr, booltext, actual, expected, fail) \
|
#define GTEST_TEST_BOOLEAN_(boolexpr, booltext, actual, expected, fail) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (boolexpr) \
|
if (boolexpr) \
|
||||||
; \
|
; \
|
||||||
else \
|
else \
|
||||||
fail("Value of: " booltext "\n Actual: " #actual "\nExpected: " #expected)
|
fail("Value of: " booltext "\n Actual: " #actual "\nExpected: " #expected)
|
||||||
|
|
||||||
|
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
|
||||||
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
|
if (const char* gtest_msg = "") { \
|
||||||
|
::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
|
||||||
|
{ statement; } \
|
||||||
|
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
|
||||||
|
gtest_msg = "Expected: " #statement " doesn't generate new fatal " \
|
||||||
|
"failures in the current thread.\n" \
|
||||||
|
" Actual: it does."; \
|
||||||
|
goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
|
||||||
|
} \
|
||||||
|
} else \
|
||||||
|
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
|
||||||
|
fail(gtest_msg)
|
||||||
|
|
||||||
// Expands to the name of the class that implements the given test.
|
// Expands to the name of the class that implements the given test.
|
||||||
#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||||
test_case_name##_##test_name##_Test
|
test_case_name##_##test_name##_Test
|
||||||
|
|
||||||
// Helper macro for defining tests.
|
// Helper macro for defining tests.
|
||||||
#define GTEST_TEST(test_case_name, test_name, parent_class)\
|
#define GTEST_TEST_(test_case_name, test_name, parent_class)\
|
||||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
|
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
|
||||||
public:\
|
public:\
|
||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
|
||||||
private:\
|
private:\
|
||||||
virtual void TestBody();\
|
virtual void TestBody();\
|
||||||
static ::testing::TestInfo* const test_info_;\
|
static ::testing::TestInfo* const test_info_;\
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(\
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
|
||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
|
||||||
};\
|
};\
|
||||||
\
|
\
|
||||||
|
@ -37,27 +37,25 @@
|
|||||||
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
|
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
|
||||||
|
|
||||||
// The user can define the following macros in the build script to
|
// The user can define the following macros in the build script to
|
||||||
// control Google Test's behavior:
|
// control Google Test's behavior. If the user doesn't define a macro
|
||||||
|
// in this list, Google Test will define it.
|
||||||
//
|
//
|
||||||
// GTEST_HAS_STD_STRING - Define it to 1/0 to indicate that
|
// GTEST_HAS_STD_STRING - Define it to 1/0 to indicate that
|
||||||
// std::string does/doesn't work (Google Test can
|
// std::string does/doesn't work (Google Test can
|
||||||
// be used where std::string is unavailable).
|
// be used where std::string is unavailable).
|
||||||
// Leave it undefined to let Google Test define it.
|
|
||||||
// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
|
// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
|
||||||
// is/isn't available (some systems define
|
// is/isn't available (some systems define
|
||||||
// ::string, which is different to std::string).
|
// ::string, which is different to std::string).
|
||||||
// Leave it undefined to let Google Test define it.
|
|
||||||
// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
|
// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
|
||||||
// std::wstring does/doesn't work (Google Test can
|
// std::wstring does/doesn't work (Google Test can
|
||||||
// be used where std::wstring is unavailable).
|
// be used where std::wstring is unavailable).
|
||||||
// Leave it undefined to let Google Test define it.
|
|
||||||
// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
|
// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
|
||||||
// is/isn't available (some systems define
|
// is/isn't available (some systems define
|
||||||
// ::wstring, which is different to std::wstring).
|
// ::wstring, which is different to std::wstring).
|
||||||
// Leave it undefined to let Google Test define it.
|
|
||||||
// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
|
// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't
|
||||||
// enabled. Leave it undefined to let Google
|
// enabled.
|
||||||
// Test define it.
|
// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
|
||||||
|
// is/isn't available.
|
||||||
|
|
||||||
// This header defines the following utilities:
|
// This header defines the following utilities:
|
||||||
//
|
//
|
||||||
@ -72,6 +70,7 @@
|
|||||||
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin.
|
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin.
|
||||||
// GTEST_OS_LINUX - defined iff compiled on Linux.
|
// GTEST_OS_LINUX - defined iff compiled on Linux.
|
||||||
// GTEST_OS_MAC - defined iff compiled on Mac OS X.
|
// GTEST_OS_MAC - defined iff compiled on Mac OS X.
|
||||||
|
// GTEST_OS_SYMBIAN - defined iff compiled for Symbian.
|
||||||
// GTEST_OS_WINDOWS - defined iff compiled on Windows.
|
// GTEST_OS_WINDOWS - defined iff compiled on Windows.
|
||||||
// Note that it is possible that none of the GTEST_OS_ macros are defined.
|
// Note that it is possible that none of the GTEST_OS_ macros are defined.
|
||||||
//
|
//
|
||||||
@ -82,15 +81,18 @@
|
|||||||
// supported.
|
// supported.
|
||||||
//
|
//
|
||||||
// Macros for basic C++ coding:
|
// Macros for basic C++ coding:
|
||||||
// GTEST_AMBIGUOUS_ELSE_BLOCKER - for disabling a gcc warning.
|
// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
|
||||||
// GTEST_ATTRIBUTE_UNUSED - declares that a class' instances don't have to
|
// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances don't have to
|
||||||
// be used.
|
// be used.
|
||||||
// GTEST_DISALLOW_COPY_AND_ASSIGN() - disables copy ctor and operator=.
|
// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=.
|
||||||
// GTEST_MUST_USE_RESULT - declares that a function's result must be used.
|
// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
|
||||||
//
|
//
|
||||||
// Synchronization:
|
// Synchronization:
|
||||||
// Mutex, MutexLock, ThreadLocal, GetThreadCount()
|
// Mutex, MutexLock, ThreadLocal, GetThreadCount()
|
||||||
// - synchronization primitives.
|
// - synchronization primitives.
|
||||||
|
// GTEST_IS_THREADSAFE - defined to 1 to indicate that the above
|
||||||
|
// synchronization primitives have real implementations
|
||||||
|
// and Google Test is thread-safe; or 0 otherwise.
|
||||||
//
|
//
|
||||||
// Template meta programming:
|
// Template meta programming:
|
||||||
// is_pointer - as in TR1; needed on Symbian only.
|
// is_pointer - as in TR1; needed on Symbian only.
|
||||||
@ -104,7 +106,7 @@
|
|||||||
// Windows.
|
// Windows.
|
||||||
//
|
//
|
||||||
// Logging:
|
// Logging:
|
||||||
// GTEST_LOG() - logs messages at the specified severity level.
|
// GTEST_LOG_() - logs messages at the specified severity level.
|
||||||
// LogToStderr() - directs all log messages to stderr.
|
// LogToStderr() - directs all log messages to stderr.
|
||||||
// FlushInfoLog() - flushes informational log messages.
|
// FlushInfoLog() - flushes informational log messages.
|
||||||
//
|
//
|
||||||
@ -148,6 +150,8 @@
|
|||||||
// Determines the platform on which Google Test is compiled.
|
// Determines the platform on which Google Test is compiled.
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
#define GTEST_OS_CYGWIN
|
#define GTEST_OS_CYGWIN
|
||||||
|
#elif __SYMBIAN32__
|
||||||
|
#define GTEST_OS_SYMBIAN
|
||||||
#elif defined _MSC_VER
|
#elif defined _MSC_VER
|
||||||
// TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean
|
// TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean
|
||||||
// both "The OS is Windows" and "The compiler is MSVC". These
|
// both "The OS is Windows" and "The compiler is MSVC". These
|
||||||
@ -261,6 +265,18 @@
|
|||||||
|
|
||||||
#endif // GTEST_HAS_RTTI
|
#endif // GTEST_HAS_RTTI
|
||||||
|
|
||||||
|
// Determines whether <pthread.h> is available.
|
||||||
|
#ifndef GTEST_HAS_PTHREAD
|
||||||
|
// The user didn't tell us, so we need to figure it out.
|
||||||
|
|
||||||
|
#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC)
|
||||||
|
#define GTEST_HAS_PTHREAD 1
|
||||||
|
#else
|
||||||
|
#define GTEST_HAS_PTHREAD 0
|
||||||
|
#endif // GTEST_OS_LINUX || GTEST_OS_MAC
|
||||||
|
|
||||||
|
#endif // GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
// Determines whether to support death tests.
|
// Determines whether to support death tests.
|
||||||
#if GTEST_HAS_STD_STRING && defined(GTEST_OS_LINUX)
|
#if GTEST_HAS_STD_STRING && defined(GTEST_OS_LINUX)
|
||||||
#define GTEST_HAS_DEATH_TEST
|
#define GTEST_HAS_DEATH_TEST
|
||||||
@ -285,7 +301,7 @@
|
|||||||
|
|
||||||
// Determines whether the system compiler uses UTF-16 for encoding wide strings.
|
// Determines whether the system compiler uses UTF-16 for encoding wide strings.
|
||||||
#if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \
|
#if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \
|
||||||
defined(__SYMBIAN32__)
|
defined(GTEST_OS_SYMBIAN)
|
||||||
#define GTEST_WIDE_STRING_USES_UTF16_ 1
|
#define GTEST_WIDE_STRING_USES_UTF16_ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -300,9 +316,9 @@
|
|||||||
//
|
//
|
||||||
// The "switch (0) case 0:" idiom is used to suppress this.
|
// The "switch (0) case 0:" idiom is used to suppress this.
|
||||||
#ifdef __INTEL_COMPILER
|
#ifdef __INTEL_COMPILER
|
||||||
#define GTEST_AMBIGUOUS_ELSE_BLOCKER
|
#define GTEST_AMBIGUOUS_ELSE_BLOCKER_
|
||||||
#else
|
#else
|
||||||
#define GTEST_AMBIGUOUS_ELSE_BLOCKER switch (0) case 0: // NOLINT
|
#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use this annotation at the end of a struct / class definition to
|
// Use this annotation at the end of a struct / class definition to
|
||||||
@ -312,16 +328,16 @@
|
|||||||
//
|
//
|
||||||
// struct Foo {
|
// struct Foo {
|
||||||
// Foo() { ... }
|
// Foo() { ... }
|
||||||
// } GTEST_ATTRIBUTE_UNUSED;
|
// } GTEST_ATTRIBUTE_UNUSED_;
|
||||||
#if defined(__GNUC__) && !defined(COMPILER_ICC)
|
#if defined(__GNUC__) && !defined(COMPILER_ICC)
|
||||||
#define GTEST_ATTRIBUTE_UNUSED __attribute__ ((unused))
|
#define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
|
||||||
#else
|
#else
|
||||||
#define GTEST_ATTRIBUTE_UNUSED
|
#define GTEST_ATTRIBUTE_UNUSED_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// A macro to disallow the evil copy constructor and operator= functions
|
// A macro to disallow the evil copy constructor and operator= functions
|
||||||
// This should be used in the private: declarations for a class.
|
// This should be used in the private: declarations for a class.
|
||||||
#define GTEST_DISALLOW_COPY_AND_ASSIGN(type)\
|
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\
|
||||||
type(const type &);\
|
type(const type &);\
|
||||||
void operator=(const type &)
|
void operator=(const type &)
|
||||||
|
|
||||||
@ -329,11 +345,11 @@
|
|||||||
// with this macro. The macro should be used on function declarations
|
// with this macro. The macro should be used on function declarations
|
||||||
// following the argument list:
|
// following the argument list:
|
||||||
//
|
//
|
||||||
// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT;
|
// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
|
||||||
#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
|
#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
|
||||||
#define GTEST_MUST_USE_RESULT __attribute__ ((warn_unused_result))
|
#define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
|
||||||
#else
|
#else
|
||||||
#define GTEST_MUST_USE_RESULT
|
#define GTEST_MUST_USE_RESULT_
|
||||||
#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
|
#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
@ -385,7 +401,7 @@ class scoped_ptr {
|
|||||||
private:
|
private:
|
||||||
T* ptr_;
|
T* ptr_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(scoped_ptr);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef GTEST_HAS_DEATH_TEST
|
#ifdef GTEST_HAS_DEATH_TEST
|
||||||
@ -444,7 +460,7 @@ class RE {
|
|||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
// Defines logging utilities:
|
// Defines logging utilities:
|
||||||
// GTEST_LOG() - logs messages at the specified severity level.
|
// GTEST_LOG_() - logs messages at the specified severity level.
|
||||||
// LogToStderr() - directs all log messages to stderr.
|
// LogToStderr() - directs all log messages to stderr.
|
||||||
// FlushInfoLog() - flushes informational log messages.
|
// FlushInfoLog() - flushes informational log messages.
|
||||||
|
|
||||||
@ -458,7 +474,7 @@ enum GTestLogSeverity {
|
|||||||
void GTestLog(GTestLogSeverity severity, const char* file,
|
void GTestLog(GTestLogSeverity severity, const char* file,
|
||||||
int line, const char* msg);
|
int line, const char* msg);
|
||||||
|
|
||||||
#define GTEST_LOG(severity, msg)\
|
#define GTEST_LOG_(severity, msg)\
|
||||||
::testing::internal::GTestLog(\
|
::testing::internal::GTestLog(\
|
||||||
::testing::internal::GTEST_##severity, __FILE__, __LINE__, \
|
::testing::internal::GTEST_##severity, __FILE__, __LINE__, \
|
||||||
(::testing::Message() << (msg)).GetString().c_str())
|
(::testing::Message() << (msg)).GetString().c_str())
|
||||||
@ -510,6 +526,8 @@ typedef GTestMutexLock MutexLock;
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
class ThreadLocal {
|
class ThreadLocal {
|
||||||
public:
|
public:
|
||||||
|
ThreadLocal() : value_() {}
|
||||||
|
explicit ThreadLocal(const T& value) : value_(value) {}
|
||||||
T* pointer() { return &value_; }
|
T* pointer() { return &value_; }
|
||||||
const T* pointer() const { return &value_; }
|
const T* pointer() const { return &value_; }
|
||||||
const T& get() const { return value_; }
|
const T& get() const { return value_; }
|
||||||
@ -522,6 +540,10 @@ class ThreadLocal {
|
|||||||
// return 0 to indicate that we cannot detect it.
|
// return 0 to indicate that we cannot detect it.
|
||||||
inline size_t GetThreadCount() { return 0; }
|
inline size_t GetThreadCount() { return 0; }
|
||||||
|
|
||||||
|
// The above synchronization primitives have dummy implementations.
|
||||||
|
// Therefore Google Test is not thread-safe.
|
||||||
|
#define GTEST_IS_THREADSAFE 0
|
||||||
|
|
||||||
// Defines tr1::is_pointer (only needed for Symbian).
|
// Defines tr1::is_pointer (only needed for Symbian).
|
||||||
|
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef __SYMBIAN32__
|
||||||
@ -657,18 +679,18 @@ inline void abort() { ::abort(); }
|
|||||||
#define GTEST_FLAG(name) FLAGS_gtest_##name
|
#define GTEST_FLAG(name) FLAGS_gtest_##name
|
||||||
|
|
||||||
// Macros for declaring flags.
|
// Macros for declaring flags.
|
||||||
#define GTEST_DECLARE_bool(name) extern bool GTEST_FLAG(name)
|
#define GTEST_DECLARE_bool_(name) extern bool GTEST_FLAG(name)
|
||||||
#define GTEST_DECLARE_int32(name) \
|
#define GTEST_DECLARE_int32_(name) \
|
||||||
extern ::testing::internal::Int32 GTEST_FLAG(name)
|
extern ::testing::internal::Int32 GTEST_FLAG(name)
|
||||||
#define GTEST_DECLARE_string(name) \
|
#define GTEST_DECLARE_string_(name) \
|
||||||
extern ::testing::internal::String GTEST_FLAG(name)
|
extern ::testing::internal::String GTEST_FLAG(name)
|
||||||
|
|
||||||
// Macros for defining flags.
|
// Macros for defining flags.
|
||||||
#define GTEST_DEFINE_bool(name, default_val, doc) \
|
#define GTEST_DEFINE_bool_(name, default_val, doc) \
|
||||||
bool GTEST_FLAG(name) = (default_val)
|
bool GTEST_FLAG(name) = (default_val)
|
||||||
#define GTEST_DEFINE_int32(name, default_val, doc) \
|
#define GTEST_DEFINE_int32_(name, default_val, doc) \
|
||||||
::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
|
::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
|
||||||
#define GTEST_DEFINE_string(name, default_val, doc) \
|
#define GTEST_DEFINE_string_(name, default_val, doc) \
|
||||||
::testing::internal::String GTEST_FLAG(name) = (default_val)
|
::testing::internal::String GTEST_FLAG(name) = (default_val)
|
||||||
|
|
||||||
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
|
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
|
||||||
|
180
scons/SConscript
Normal file
180
scons/SConscript
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
#!/usr/bin/python2.4
|
||||||
|
#
|
||||||
|
# Copyright 2008, 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.
|
||||||
|
|
||||||
|
|
||||||
|
"""Builds the Google Test (gtest) lib; this is for Windows projects
|
||||||
|
using SCons and can probably be easily extended for cross-platform
|
||||||
|
SCons builds. The compilation settings from your project will be used,
|
||||||
|
with some specific flags required for gtest added.
|
||||||
|
|
||||||
|
You should be able to call this file from more or less any SConscript
|
||||||
|
file.
|
||||||
|
|
||||||
|
You can optionally set a variable on the construction environment to
|
||||||
|
have the unit test executables copied to your output directory. The
|
||||||
|
variable should be env['EXE_OUTPUT'].
|
||||||
|
|
||||||
|
Another optional variable is env['LIB_OUTPUT']. If set, the generated
|
||||||
|
libraries are copied to the folder indicated by the variable.
|
||||||
|
|
||||||
|
If you place the gtest sources within your own project's source
|
||||||
|
directory, you should be able to call this SConscript file simply as
|
||||||
|
follows:
|
||||||
|
|
||||||
|
# -- cut here --
|
||||||
|
# Build gtest library; first tell it where to copy executables.
|
||||||
|
env['EXE_OUTPUT'] = '#/mybuilddir/mybuildmode' # example, optional
|
||||||
|
env['LIB_OUTPUT'] = '#/mybuilddir/mybuildmode/lib'
|
||||||
|
env.SConscript('whateverpath/gtest/scons/SConscript')
|
||||||
|
# -- cut here --
|
||||||
|
|
||||||
|
If on the other hand you place the gtest sources in a directory
|
||||||
|
outside of your project's source tree, you would use a snippet similar
|
||||||
|
to the following:
|
||||||
|
|
||||||
|
# -- cut here --
|
||||||
|
|
||||||
|
# The following assumes that $BUILD_DIR refers to the root of the
|
||||||
|
# directory for your current build mode, e.g. "#/mybuilddir/mybuildmode"
|
||||||
|
|
||||||
|
# Build gtest library; as it is outside of our source root, we need to
|
||||||
|
# tell SCons that the directory it will refer to as
|
||||||
|
# e.g. $BUIlD_DIR/gtest is actually on disk in original form as
|
||||||
|
# ../../gtest (relative to your project root directory). Recall that
|
||||||
|
# SCons by default copies all source files into the build directory
|
||||||
|
# before building.
|
||||||
|
gtest_dir = env.Dir('$BUILD_DIR/gtest')
|
||||||
|
|
||||||
|
# Modify this part to point to gtest relative to the current
|
||||||
|
# SConscript or SConstruct file's directory. The ../.. path would
|
||||||
|
# be different per project, to locate the base directory for gtest.
|
||||||
|
gtest_dir.addRepository(env.Dir('../../gtest'))
|
||||||
|
|
||||||
|
# Tell the gtest SCons file where to copy executables.
|
||||||
|
env['EXE_OUTPUT'] = '$BUILD_DIR' # example, optional
|
||||||
|
|
||||||
|
# Call the gtest SConscript to build gtest.lib and unit tests. The
|
||||||
|
# location of the library should end up as
|
||||||
|
# '$BUILD_DIR/gtest/scons/gtest.lib'
|
||||||
|
env.SConscript(env.File('scons/SConscript', gtest_dir))
|
||||||
|
|
||||||
|
# -- cut here --
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
__author__ = 'joi@google.com (Joi Sigurdsson)'
|
||||||
|
|
||||||
|
|
||||||
|
Import('env')
|
||||||
|
env = env.Clone()
|
||||||
|
|
||||||
|
# Include paths to gtest headers are relative to a directory two above
|
||||||
|
# the gtest directory itself, and this SConscript file is one
|
||||||
|
# directory deeper than the gtest directory.
|
||||||
|
env.Prepend(CPPPATH = ['../../..'])
|
||||||
|
|
||||||
|
# TODO(joi@google.com) Fix the code that causes this warning so that
|
||||||
|
# we see all warnings from the compiler about possible 64-bit porting
|
||||||
|
# issues.
|
||||||
|
env.Append(CCFLAGS=['-wd4267'])
|
||||||
|
|
||||||
|
# Sources shared by base library and library that includes main.
|
||||||
|
gtest_sources = ['../src/gtest-all.cc']
|
||||||
|
|
||||||
|
# gtest.lib to be used by most apps (if you have your own main
|
||||||
|
# function)
|
||||||
|
gtest = env.StaticLibrary(target='gtest',
|
||||||
|
source=gtest_sources)
|
||||||
|
|
||||||
|
# gtest_main.lib can be used if you just want a basic main function;
|
||||||
|
# it is also used by the tests for Google Test itself.
|
||||||
|
gtest_main = env.StaticLibrary(target='gtest_main',
|
||||||
|
source=gtest_sources + ['../src/gtest_main.cc'])
|
||||||
|
|
||||||
|
# Install the libraries if needed.
|
||||||
|
if 'LIB_OUTPUT' in env.Dictionary():
|
||||||
|
env.Install('$LIB_OUTPUT', source=[gtest, gtest_main])
|
||||||
|
|
||||||
|
|
||||||
|
def GtestUnitTest(env, target, gtest_lib, additional_sources=None):
|
||||||
|
"""Helper to create gtest unit tests.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
env: The SCons construction environment to use to build.
|
||||||
|
target: The basename of the target unit test .cc file.
|
||||||
|
gtest_lib: The gtest lib to use.
|
||||||
|
"""
|
||||||
|
source = [env.File('%s.cc' % target, env.Dir('../test'))]
|
||||||
|
if additional_sources:
|
||||||
|
source += additional_sources
|
||||||
|
unit_test = env.Program(target=target,
|
||||||
|
source=source,
|
||||||
|
LIBS=[gtest_lib, 'kernel32.lib', 'user32.lib'])
|
||||||
|
if 'EXE_OUTPUT' in env.Dictionary():
|
||||||
|
env.Install('$EXE_OUTPUT', source=[unit_test])
|
||||||
|
|
||||||
|
|
||||||
|
GtestUnitTest(env, 'gtest-filepath_test', gtest_main)
|
||||||
|
GtestUnitTest(env, 'gtest-message_test', gtest_main)
|
||||||
|
GtestUnitTest(env, 'gtest-options_test', gtest_main)
|
||||||
|
GtestUnitTest(env, 'gtest_environment_test', gtest)
|
||||||
|
GtestUnitTest(env, 'gtest_main_unittest', gtest_main)
|
||||||
|
GtestUnitTest(env, 'gtest_no_test_unittest', gtest)
|
||||||
|
GtestUnitTest(env, 'gtest_pred_impl_unittest', gtest_main)
|
||||||
|
GtestUnitTest(env, 'gtest_prod_test', gtest_main,
|
||||||
|
additional_sources=['../test/production.cc'])
|
||||||
|
GtestUnitTest(env, 'gtest_repeat_test', gtest)
|
||||||
|
GtestUnitTest(env, 'gtest_sole_header_test', gtest_main)
|
||||||
|
GtestUnitTest(env, 'gtest-test-part_test', gtest_main)
|
||||||
|
GtestUnitTest(env, 'gtest-typed-test_test', gtest_main,
|
||||||
|
additional_sources=['../test/gtest-typed-test2_test.cc'])
|
||||||
|
GtestUnitTest(env, 'gtest_unittest', gtest)
|
||||||
|
GtestUnitTest(env, 'gtest_output_test_', gtest)
|
||||||
|
GtestUnitTest(env, 'gtest_color_test_', gtest)
|
||||||
|
|
||||||
|
# TODO(wan@google.com) Add these unit tests:
|
||||||
|
# - gtest_break_on_failure_unittest_
|
||||||
|
# - gtest_filter_unittest_
|
||||||
|
# - gtest_list_tests_unittest_
|
||||||
|
# - gtest_xml_outfile1_test_
|
||||||
|
# - gtest_xml_outfile2_test_
|
||||||
|
# - gtest_xml_output_unittest_
|
||||||
|
|
||||||
|
# We need to disable some optimization flags for a couple of tests,
|
||||||
|
# otherwise the redirection of stdout does not work (apparently
|
||||||
|
# because of a compiler bug).
|
||||||
|
special_env = env.Clone()
|
||||||
|
linker_flags = special_env['LINKFLAGS']
|
||||||
|
for flag in ["/O1", "/Os", "/Og", "/Oy"]:
|
||||||
|
if flag in linker_flags:
|
||||||
|
linker_flags.remove(flag)
|
||||||
|
GtestUnitTest(special_env, 'gtest_env_var_test_', gtest)
|
||||||
|
GtestUnitTest(special_env, 'gtest_uninitialized_test_', gtest)
|
@ -149,11 +149,11 @@ def HeaderPreamble(n):
|
|||||||
// Please email googletestframework@googlegroups.com if you need
|
// Please email googletestframework@googlegroups.com if you need
|
||||||
// support for higher arities.
|
// support for higher arities.
|
||||||
|
|
||||||
// GTEST_ASSERT is the basic statement to which all of the assertions
|
// GTEST_ASSERT_ is the basic statement to which all of the assertions
|
||||||
// in this file reduce. Don't use this in your code.
|
// in this file reduce. Don't use this in your code.
|
||||||
|
|
||||||
#define GTEST_ASSERT(expression, on_failure) \\
|
#define GTEST_ASSERT_(expression, on_failure) \\
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER \\
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \\
|
||||||
if (const ::testing::AssertionResult gtest_ar = (expression)) \\
|
if (const ::testing::AssertionResult gtest_ar = (expression)) \\
|
||||||
; \\
|
; \\
|
||||||
else \\
|
else \\
|
||||||
@ -257,14 +257,14 @@ AssertionResult AssertPred%(n)sHelper(const char* pred_text""" % DEFS
|
|||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT%(n)s.
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT%(n)s.
|
||||||
// Don't use this in your code.
|
// Don't use this in your code.
|
||||||
#define GTEST_PRED_FORMAT%(n)s(pred_format, %(vs)s, on_failure)\\
|
#define GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, on_failure)\\
|
||||||
GTEST_ASSERT(pred_format(%(vts)s, %(vs)s),\\
|
GTEST_ASSERT_(pred_format(%(vts)s, %(vs)s),\\
|
||||||
on_failure)
|
on_failure)
|
||||||
|
|
||||||
// Internal macro for implementing {EXPECT|ASSERT}_PRED%(n)s. Don't use
|
// Internal macro for implementing {EXPECT|ASSERT}_PRED%(n)s. Don't use
|
||||||
// this in your code.
|
// this in your code.
|
||||||
#define GTEST_PRED%(n)s(pred, %(vs)s, on_failure)\\
|
#define GTEST_PRED%(n)s_(pred, %(vs)s, on_failure)\\
|
||||||
GTEST_ASSERT(::testing::AssertPred%(n)sHelper(#pred""" % DEFS
|
GTEST_ASSERT_(::testing::AssertPred%(n)sHelper(#pred""" % DEFS
|
||||||
|
|
||||||
impl += Iter(n, """, \\
|
impl += Iter(n, """, \\
|
||||||
#v%s""")
|
#v%s""")
|
||||||
@ -279,13 +279,13 @@ AssertionResult AssertPred%(n)sHelper(const char* pred_text""" % DEFS
|
|||||||
|
|
||||||
// %(Arity)s predicate assertion macros.
|
// %(Arity)s predicate assertion macros.
|
||||||
#define EXPECT_PRED_FORMAT%(n)s(pred_format, %(vs)s) \\
|
#define EXPECT_PRED_FORMAT%(n)s(pred_format, %(vs)s) \\
|
||||||
GTEST_PRED_FORMAT%(n)s(pred_format, %(vs)s, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, GTEST_NONFATAL_FAILURE_)
|
||||||
#define EXPECT_PRED%(n)s(pred, %(vs)s) \\
|
#define EXPECT_PRED%(n)s(pred, %(vs)s) \\
|
||||||
GTEST_PRED%(n)s(pred, %(vs)s, GTEST_NONFATAL_FAILURE)
|
GTEST_PRED%(n)s_(pred, %(vs)s, GTEST_NONFATAL_FAILURE_)
|
||||||
#define ASSERT_PRED_FORMAT%(n)s(pred_format, %(vs)s) \\
|
#define ASSERT_PRED_FORMAT%(n)s(pred_format, %(vs)s) \\
|
||||||
GTEST_PRED_FORMAT%(n)s(pred_format, %(vs)s, GTEST_FATAL_FAILURE)
|
GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, GTEST_FATAL_FAILURE_)
|
||||||
#define ASSERT_PRED%(n)s(pred, %(vs)s) \\
|
#define ASSERT_PRED%(n)s(pred, %(vs)s) \\
|
||||||
GTEST_PRED%(n)s(pred, %(vs)s, GTEST_FATAL_FAILURE)
|
GTEST_PRED%(n)s_(pred, %(vs)s, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
""" % DEFS
|
""" % DEFS
|
||||||
|
|
||||||
|
41
src/gtest-all.cc
Normal file
41
src/gtest-all.cc
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// Copyright 2008, 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.
|
||||||
|
//
|
||||||
|
// Author: mheule@google.com (Markus Heule)
|
||||||
|
//
|
||||||
|
// Google C++ Testing Framework (Google Test)
|
||||||
|
//
|
||||||
|
// Sometimes it's desirable to build Google Test by compiling a single file.
|
||||||
|
// This file serves this purpose.
|
||||||
|
#include "src/gtest.cc"
|
||||||
|
#include "src/gtest-death-test.cc"
|
||||||
|
#include "src/gtest-filepath.cc"
|
||||||
|
#include "src/gtest-port.cc"
|
||||||
|
#include "src/gtest-test-part.cc"
|
||||||
|
#include "src/gtest-typed-test.cc"
|
@ -59,7 +59,7 @@ namespace testing {
|
|||||||
// The default death test style.
|
// The default death test style.
|
||||||
static const char kDefaultDeathTestStyle[] = "fast";
|
static const char kDefaultDeathTestStyle[] = "fast";
|
||||||
|
|
||||||
GTEST_DEFINE_string(
|
GTEST_DEFINE_string_(
|
||||||
death_test_style,
|
death_test_style,
|
||||||
internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle),
|
internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle),
|
||||||
"Indicates how to run a death test in a forked child process: "
|
"Indicates how to run a death test in a forked child process: "
|
||||||
@ -69,7 +69,7 @@ GTEST_DEFINE_string(
|
|||||||
"after forking).");
|
"after forking).");
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
GTEST_DEFINE_string(
|
GTEST_DEFINE_string_(
|
||||||
internal_run_death_test, "",
|
internal_run_death_test, "",
|
||||||
"Indicates the file, line number, temporal index of "
|
"Indicates the file, line number, temporal index of "
|
||||||
"the single death test to run, and a file descriptor to "
|
"the single death test to run, and a file descriptor to "
|
||||||
@ -188,7 +188,7 @@ void DeathTestAbort(const char* format, ...) {
|
|||||||
|
|
||||||
// A replacement for CHECK that calls DeathTestAbort if the assertion
|
// A replacement for CHECK that calls DeathTestAbort if the assertion
|
||||||
// fails.
|
// fails.
|
||||||
#define GTEST_DEATH_TEST_CHECK(expression) \
|
#define GTEST_DEATH_TEST_CHECK_(expression) \
|
||||||
do { \
|
do { \
|
||||||
if (!(expression)) { \
|
if (!(expression)) { \
|
||||||
DeathTestAbort("CHECK failed: File %s, line %d: %s", \
|
DeathTestAbort("CHECK failed: File %s, line %d: %s", \
|
||||||
@ -196,14 +196,14 @@ void DeathTestAbort(const char* format, ...) {
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
// This macro is similar to GTEST_DEATH_TEST_CHECK, but it is meant for
|
// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for
|
||||||
// evaluating any system call that fulfills two conditions: it must return
|
// evaluating any system call that fulfills two conditions: it must return
|
||||||
// -1 on failure, and set errno to EINTR when it is interrupted and
|
// -1 on failure, and set errno to EINTR when it is interrupted and
|
||||||
// should be tried again. The macro expands to a loop that repeatedly
|
// should be tried again. The macro expands to a loop that repeatedly
|
||||||
// evaluates the expression as long as it evaluates to -1 and sets
|
// evaluates the expression as long as it evaluates to -1 and sets
|
||||||
// errno to EINTR. If the expression evaluates to -1 but errno is
|
// errno to EINTR. If the expression evaluates to -1 but errno is
|
||||||
// something other than EINTR, DeathTestAbort is called.
|
// something other than EINTR, DeathTestAbort is called.
|
||||||
#define GTEST_DEATH_TEST_CHECK_SYSCALL(expression) \
|
#define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
|
||||||
do { \
|
do { \
|
||||||
int retval; \
|
int retval; \
|
||||||
do { \
|
do { \
|
||||||
@ -303,9 +303,9 @@ static void FailFromInternalError(int fd) {
|
|||||||
|
|
||||||
// TODO(smcafee): Maybe just FAIL the test instead?
|
// TODO(smcafee): Maybe just FAIL the test instead?
|
||||||
if (num_read == 0) {
|
if (num_read == 0) {
|
||||||
GTEST_LOG(FATAL, error);
|
GTEST_LOG_(FATAL, error);
|
||||||
} else {
|
} else {
|
||||||
GTEST_LOG(FATAL,
|
GTEST_LOG_(FATAL,
|
||||||
Message() << "Error while reading death test internal: "
|
Message() << "Error while reading death test internal: "
|
||||||
<< strerror(errno) << " [" << errno << "]");
|
<< strerror(errno) << " [" << errno << "]");
|
||||||
}
|
}
|
||||||
@ -343,19 +343,19 @@ int ForkingDeathTest::Wait() {
|
|||||||
FailFromInternalError(read_fd_); // Does not return.
|
FailFromInternalError(read_fd_); // Does not return.
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GTEST_LOG(FATAL,
|
GTEST_LOG_(FATAL,
|
||||||
Message() << "Death test child process reported unexpected "
|
Message() << "Death test child process reported unexpected "
|
||||||
<< "status byte (" << static_cast<unsigned int>(flag)
|
<< "status byte (" << static_cast<unsigned int>(flag)
|
||||||
<< ")");
|
<< ")");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GTEST_LOG(FATAL,
|
GTEST_LOG_(FATAL,
|
||||||
Message() << "Read from death test child process failed: "
|
Message() << "Read from death test child process failed: "
|
||||||
<< strerror(errno));
|
<< strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
GTEST_DEATH_TEST_CHECK_SYSCALL(close(read_fd_));
|
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(read_fd_));
|
||||||
GTEST_DEATH_TEST_CHECK_SYSCALL(waitpid(child_pid_, &status_, 0));
|
GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_, 0));
|
||||||
return status_;
|
return status_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ bool ForkingDeathTest::Passed(bool status_ok) {
|
|||||||
break;
|
break;
|
||||||
case IN_PROGRESS:
|
case IN_PROGRESS:
|
||||||
default:
|
default:
|
||||||
GTEST_LOG(FATAL,
|
GTEST_LOG_(FATAL,
|
||||||
"DeathTest::Passed somehow called before conclusion of test");
|
"DeathTest::Passed somehow called before conclusion of test");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,8 +436,8 @@ void ForkingDeathTest::Abort(AbortReason reason) {
|
|||||||
// to the pipe, then exit.
|
// to the pipe, then exit.
|
||||||
const char flag =
|
const char flag =
|
||||||
reason == TEST_DID_NOT_DIE ? kDeathTestLived : kDeathTestReturned;
|
reason == TEST_DID_NOT_DIE ? kDeathTestLived : kDeathTestReturned;
|
||||||
GTEST_DEATH_TEST_CHECK_SYSCALL(write(write_fd_, &flag, 1));
|
GTEST_DEATH_TEST_CHECK_SYSCALL_(write(write_fd_, &flag, 1));
|
||||||
GTEST_DEATH_TEST_CHECK_SYSCALL(close(write_fd_));
|
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(write_fd_));
|
||||||
_exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
|
_exit(1); // Exits w/o any normal exit hooks (we were supposed to crash)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,11 +455,11 @@ class NoExecDeathTest : public ForkingDeathTest {
|
|||||||
DeathTest::TestRole NoExecDeathTest::AssumeRole() {
|
DeathTest::TestRole NoExecDeathTest::AssumeRole() {
|
||||||
const size_t thread_count = GetThreadCount();
|
const size_t thread_count = GetThreadCount();
|
||||||
if (thread_count != 1) {
|
if (thread_count != 1) {
|
||||||
GTEST_LOG(WARNING, DeathTestThreadWarning(thread_count));
|
GTEST_LOG_(WARNING, DeathTestThreadWarning(thread_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
int pipe_fd[2];
|
int pipe_fd[2];
|
||||||
GTEST_DEATH_TEST_CHECK(pipe(pipe_fd) != -1);
|
GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
|
||||||
|
|
||||||
last_death_test_message = "";
|
last_death_test_message = "";
|
||||||
CaptureStderr();
|
CaptureStderr();
|
||||||
@ -473,10 +473,10 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() {
|
|||||||
FlushInfoLog();
|
FlushInfoLog();
|
||||||
|
|
||||||
const pid_t child_pid = fork();
|
const pid_t child_pid = fork();
|
||||||
GTEST_DEATH_TEST_CHECK(child_pid != -1);
|
GTEST_DEATH_TEST_CHECK_(child_pid != -1);
|
||||||
set_child_pid(child_pid);
|
set_child_pid(child_pid);
|
||||||
if (child_pid == 0) {
|
if (child_pid == 0) {
|
||||||
GTEST_DEATH_TEST_CHECK_SYSCALL(close(pipe_fd[0]));
|
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
|
||||||
set_write_fd(pipe_fd[1]);
|
set_write_fd(pipe_fd[1]);
|
||||||
// Redirects all logging to stderr in the child process to prevent
|
// Redirects all logging to stderr in the child process to prevent
|
||||||
// concurrent writes to the log files. We capture stderr in the parent
|
// concurrent writes to the log files. We capture stderr in the parent
|
||||||
@ -484,7 +484,7 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() {
|
|||||||
LogToStderr();
|
LogToStderr();
|
||||||
return EXECUTE_TEST;
|
return EXECUTE_TEST;
|
||||||
} else {
|
} else {
|
||||||
GTEST_DEATH_TEST_CHECK_SYSCALL(close(pipe_fd[1]));
|
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
|
||||||
set_read_fd(pipe_fd[0]);
|
set_read_fd(pipe_fd[0]);
|
||||||
set_forked(true);
|
set_forked(true);
|
||||||
return OVERSEE_TEST;
|
return OVERSEE_TEST;
|
||||||
@ -551,7 +551,7 @@ struct ExecDeathTestArgs {
|
|||||||
// any potentially unsafe operations like malloc or libc functions.
|
// any potentially unsafe operations like malloc or libc functions.
|
||||||
static int ExecDeathTestChildMain(void* child_arg) {
|
static int ExecDeathTestChildMain(void* child_arg) {
|
||||||
ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
|
ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg);
|
||||||
GTEST_DEATH_TEST_CHECK_SYSCALL(close(args->close_fd));
|
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd));
|
||||||
|
|
||||||
// We need to execute the test program in the same environment where
|
// We need to execute the test program in the same environment where
|
||||||
// it was originally invoked. Therefore we change to the original
|
// it was originally invoked. Therefore we change to the original
|
||||||
@ -599,14 +599,14 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
|
|||||||
const size_t stack_size = getpagesize();
|
const size_t stack_size = getpagesize();
|
||||||
void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
|
void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
|
||||||
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||||
GTEST_DEATH_TEST_CHECK(stack != MAP_FAILED);
|
GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
|
||||||
void* const stack_top =
|
void* const stack_top =
|
||||||
static_cast<char*>(stack) + (stack_grows_down ? stack_size : 0);
|
static_cast<char*>(stack) + (stack_grows_down ? stack_size : 0);
|
||||||
ExecDeathTestArgs args = { argv, close_fd };
|
ExecDeathTestArgs args = { argv, close_fd };
|
||||||
const pid_t child_pid = clone(&ExecDeathTestChildMain, stack_top,
|
const pid_t child_pid = clone(&ExecDeathTestChildMain, stack_top,
|
||||||
SIGCHLD, &args);
|
SIGCHLD, &args);
|
||||||
GTEST_DEATH_TEST_CHECK(child_pid != -1);
|
GTEST_DEATH_TEST_CHECK_(child_pid != -1);
|
||||||
GTEST_DEATH_TEST_CHECK(munmap(stack, stack_size) != -1);
|
GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
|
||||||
return child_pid;
|
return child_pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,10 +627,10 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int pipe_fd[2];
|
int pipe_fd[2];
|
||||||
GTEST_DEATH_TEST_CHECK(pipe(pipe_fd) != -1);
|
GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1);
|
||||||
// Clear the close-on-exec flag on the write end of the pipe, lest
|
// Clear the close-on-exec flag on the write end of the pipe, lest
|
||||||
// it be closed when the child process does an exec:
|
// it be closed when the child process does an exec:
|
||||||
GTEST_DEATH_TEST_CHECK(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
|
GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1);
|
||||||
|
|
||||||
const String filter_flag =
|
const String filter_flag =
|
||||||
String::Format("--%s%s=%s.%s",
|
String::Format("--%s%s=%s.%s",
|
||||||
@ -654,7 +654,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
|
|||||||
FlushInfoLog();
|
FlushInfoLog();
|
||||||
|
|
||||||
const pid_t child_pid = ExecDeathTestFork(args.Argv(), pipe_fd[0]);
|
const pid_t child_pid = ExecDeathTestFork(args.Argv(), pipe_fd[0]);
|
||||||
GTEST_DEATH_TEST_CHECK_SYSCALL(close(pipe_fd[1]));
|
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
|
||||||
set_child_pid(child_pid);
|
set_child_pid(child_pid);
|
||||||
set_read_fd(pipe_fd[0]);
|
set_read_fd(pipe_fd[0]);
|
||||||
set_forked(true);
|
set_forked(true);
|
||||||
|
@ -36,10 +36,14 @@
|
|||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined(_WIN32)
|
#elif defined(GTEST_OS_WINDOWS)
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#elif defined(GTEST_OS_SYMBIAN)
|
||||||
|
// Symbian OpenC has PATH_MAX in sys/syslimits.h
|
||||||
|
#include <sys/syslimits.h>
|
||||||
|
#include <unistd.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -249,7 +253,7 @@ bool FilePath::CreateDirectoriesRecursively() const {
|
|||||||
// directory for any reason, including if the parent directory does not
|
// directory for any reason, including if the parent directory does not
|
||||||
// exist. Not named "CreateDirectory" because that's a macro on Windows.
|
// exist. Not named "CreateDirectory" because that's a macro on Windows.
|
||||||
bool FilePath::CreateFolder() const {
|
bool FilePath::CreateFolder() const {
|
||||||
#ifdef _WIN32
|
#ifdef GTEST_OS_WINDOWS
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
FilePath removed_sep(this->RemoveTrailingPathSeparator());
|
FilePath removed_sep(this->RemoveTrailingPathSeparator());
|
||||||
LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
|
LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
|
||||||
|
@ -64,16 +64,16 @@ namespace testing {
|
|||||||
// We don't want the users to modify these flags in the code, but want
|
// We don't want the users to modify these flags in the code, but want
|
||||||
// Google Test's own unit tests to be able to access them. Therefore we
|
// Google Test's own unit tests to be able to access them. Therefore we
|
||||||
// declare them here as opposed to in gtest.h.
|
// declare them here as opposed to in gtest.h.
|
||||||
GTEST_DECLARE_bool(break_on_failure);
|
GTEST_DECLARE_bool_(break_on_failure);
|
||||||
GTEST_DECLARE_bool(catch_exceptions);
|
GTEST_DECLARE_bool_(catch_exceptions);
|
||||||
GTEST_DECLARE_string(color);
|
GTEST_DECLARE_string_(color);
|
||||||
GTEST_DECLARE_string(filter);
|
GTEST_DECLARE_string_(filter);
|
||||||
GTEST_DECLARE_bool(list_tests);
|
GTEST_DECLARE_bool_(list_tests);
|
||||||
GTEST_DECLARE_string(output);
|
GTEST_DECLARE_string_(output);
|
||||||
GTEST_DECLARE_bool(print_time);
|
GTEST_DECLARE_bool_(print_time);
|
||||||
GTEST_DECLARE_int32(repeat);
|
GTEST_DECLARE_int32_(repeat);
|
||||||
GTEST_DECLARE_int32(stack_trace_depth);
|
GTEST_DECLARE_int32_(stack_trace_depth);
|
||||||
GTEST_DECLARE_bool(show_internal_stack_frames);
|
GTEST_DECLARE_bool_(show_internal_stack_frames);
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class GTestFlagSaver {
|
|||||||
bool print_time_;
|
bool print_time_;
|
||||||
bool pretty_;
|
bool pretty_;
|
||||||
internal::Int32 repeat_;
|
internal::Int32 repeat_;
|
||||||
} GTEST_ATTRIBUTE_UNUSED;
|
} GTEST_ATTRIBUTE_UNUSED_;
|
||||||
|
|
||||||
// Converts a Unicode code point to a narrow string in UTF-8 encoding.
|
// Converts a Unicode code point to a narrow string in UTF-8 encoding.
|
||||||
// code_point parameter is of type UInt32 because wchar_t may not be
|
// code_point parameter is of type UInt32 because wchar_t may not be
|
||||||
@ -200,7 +200,7 @@ class ListNode {
|
|||||||
explicit ListNode(const E & element) : element_(element), next_(NULL) {}
|
explicit ListNode(const E & element) : element_(element), next_(NULL) {}
|
||||||
|
|
||||||
// We disallow copying ListNode
|
// We disallow copying ListNode
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(ListNode);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(ListNode);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ class List {
|
|||||||
int size_; // The number of elements in the list.
|
int size_; // The number of elements in the list.
|
||||||
|
|
||||||
// We disallow copying List.
|
// We disallow copying List.
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(List);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(List);
|
||||||
};
|
};
|
||||||
|
|
||||||
// The virtual destructor of List.
|
// The virtual destructor of List.
|
||||||
@ -557,7 +557,7 @@ class TestResult {
|
|||||||
TimeInMillis elapsed_time_;
|
TimeInMillis elapsed_time_;
|
||||||
|
|
||||||
// We disallow copying TestResult.
|
// We disallow copying TestResult.
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(TestResult);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
|
||||||
}; // class TestResult
|
}; // class TestResult
|
||||||
|
|
||||||
class TestInfoImpl {
|
class TestInfoImpl {
|
||||||
@ -633,7 +633,7 @@ class TestInfoImpl {
|
|||||||
// test for the second time.
|
// test for the second time.
|
||||||
internal::TestResult result_;
|
internal::TestResult result_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(TestInfoImpl);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfoImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
@ -765,7 +765,7 @@ class TestCase {
|
|||||||
internal::TimeInMillis elapsed_time_;
|
internal::TimeInMillis elapsed_time_;
|
||||||
|
|
||||||
// We disallow copying TestCases.
|
// We disallow copying TestCases.
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(TestCase);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
@ -843,7 +843,7 @@ class OsStackTraceGetterInterface {
|
|||||||
virtual void UponLeavingGTest() = 0;
|
virtual void UponLeavingGTest() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(OsStackTraceGetterInterface);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A working implemenation of the OsStackTraceGetterInterface interface.
|
// A working implemenation of the OsStackTraceGetterInterface interface.
|
||||||
@ -866,7 +866,7 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
|
|||||||
// and any calls to CurrentStackTrace() from within the user code.
|
// and any calls to CurrentStackTrace() from within the user code.
|
||||||
void* caller_frame_;
|
void* caller_frame_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(OsStackTraceGetter);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Information about a Google Test trace point.
|
// Information about a Google Test trace point.
|
||||||
@ -876,24 +876,63 @@ struct TraceInfo {
|
|||||||
String message;
|
String message;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This is the default global test part result reporter used in UnitTestImpl.
|
||||||
|
// This class should only be used by UnitTestImpl.
|
||||||
|
class DefaultGlobalTestPartResultReporter
|
||||||
|
: public TestPartResultReporterInterface {
|
||||||
|
public:
|
||||||
|
explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
|
||||||
|
// Implements the TestPartResultReporterInterface. Reports the test part
|
||||||
|
// result in the current test.
|
||||||
|
virtual void ReportTestPartResult(const TestPartResult& result);
|
||||||
|
|
||||||
|
private:
|
||||||
|
UnitTestImpl* const unit_test_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is the default per thread test part result reporter used in
|
||||||
|
// UnitTestImpl. This class should only be used by UnitTestImpl.
|
||||||
|
class DefaultPerThreadTestPartResultReporter
|
||||||
|
: public TestPartResultReporterInterface {
|
||||||
|
public:
|
||||||
|
explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
|
||||||
|
// Implements the TestPartResultReporterInterface. The implementation just
|
||||||
|
// delegates to the current global test part result reporter of *unit_test_.
|
||||||
|
virtual void ReportTestPartResult(const TestPartResult& result);
|
||||||
|
|
||||||
|
private:
|
||||||
|
UnitTestImpl* const unit_test_;
|
||||||
|
};
|
||||||
|
|
||||||
// The private implementation of the UnitTest class. We don't protect
|
// The private implementation of the UnitTest class. We don't protect
|
||||||
// the methods under a mutex, as this class is not accessible by a
|
// the methods under a mutex, as this class is not accessible by a
|
||||||
// user and the UnitTest class that delegates work to this class does
|
// user and the UnitTest class that delegates work to this class does
|
||||||
// proper locking.
|
// proper locking.
|
||||||
class UnitTestImpl : public TestPartResultReporterInterface {
|
class UnitTestImpl {
|
||||||
public:
|
public:
|
||||||
explicit UnitTestImpl(UnitTest* parent);
|
explicit UnitTestImpl(UnitTest* parent);
|
||||||
virtual ~UnitTestImpl();
|
virtual ~UnitTestImpl();
|
||||||
|
|
||||||
// Reports a test part result. This method is from the
|
// There are two different ways to register your own TestPartResultReporter.
|
||||||
// TestPartResultReporterInterface interface.
|
// You can register your own repoter to listen either only for test results
|
||||||
virtual void ReportTestPartResult(const TestPartResult& result);
|
// from the current thread or for results from all threads.
|
||||||
|
// By default, each per-thread test result repoter just passes a new
|
||||||
|
// TestPartResult to the global test result reporter, which registers the
|
||||||
|
// test part result for the currently running test.
|
||||||
|
|
||||||
// Returns the current test part result reporter.
|
// Returns the global test part result reporter.
|
||||||
TestPartResultReporterInterface* test_part_result_reporter();
|
TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
|
||||||
|
|
||||||
// Sets the current test part result reporter.
|
// Sets the global test part result reporter.
|
||||||
void set_test_part_result_reporter(TestPartResultReporterInterface* reporter);
|
void SetGlobalTestPartResultReporter(
|
||||||
|
TestPartResultReporterInterface* reporter);
|
||||||
|
|
||||||
|
// Returns the test part result reporter for the current thread.
|
||||||
|
TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
|
||||||
|
|
||||||
|
// Sets the test part result reporter for the current thread.
|
||||||
|
void SetTestPartResultReporterForCurrentThread(
|
||||||
|
TestPartResultReporterInterface* reporter);
|
||||||
|
|
||||||
// Gets the number of successful test cases.
|
// Gets the number of successful test cases.
|
||||||
int successful_test_case_count() const;
|
int successful_test_case_count() const;
|
||||||
@ -1107,8 +1146,20 @@ class UnitTestImpl : public TestPartResultReporterInterface {
|
|||||||
// executed.
|
// executed.
|
||||||
internal::FilePath original_working_dir_;
|
internal::FilePath original_working_dir_;
|
||||||
|
|
||||||
// Points to (but doesn't own) the test part result reporter.
|
// The default test part result reporters.
|
||||||
TestPartResultReporterInterface* test_part_result_reporter_;
|
DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
|
||||||
|
DefaultPerThreadTestPartResultReporter
|
||||||
|
default_per_thread_test_part_result_reporter_;
|
||||||
|
|
||||||
|
// Points to (but doesn't own) the global test part result reporter.
|
||||||
|
TestPartResultReporterInterface* global_test_part_result_repoter_;
|
||||||
|
|
||||||
|
// Protects read and write access to global_test_part_result_reporter_.
|
||||||
|
internal::Mutex global_test_part_result_reporter_mutex_;
|
||||||
|
|
||||||
|
// Points to (but doesn't own) the per-thread test part result reporter.
|
||||||
|
internal::ThreadLocal<TestPartResultReporterInterface*>
|
||||||
|
per_thread_test_part_result_reporter_;
|
||||||
|
|
||||||
// The list of environments that need to be set-up/torn-down
|
// The list of environments that need to be set-up/torn-down
|
||||||
// before/after the tests are run. environments_in_reverse_order_
|
// before/after the tests are run. environments_in_reverse_order_
|
||||||
@ -1168,7 +1219,7 @@ class UnitTestImpl : public TestPartResultReporterInterface {
|
|||||||
// A per-thread stack of traces created by the SCOPED_TRACE() macro.
|
// A per-thread stack of traces created by the SCOPED_TRACE() macro.
|
||||||
internal::ThreadLocal<internal::List<TraceInfo> > gtest_trace_stack_;
|
internal::ThreadLocal<internal::List<TraceInfo> > gtest_trace_stack_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(UnitTestImpl);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
|
||||||
}; // class UnitTestImpl
|
}; // class UnitTestImpl
|
||||||
|
|
||||||
// Convenience function for accessing the global UnitTest
|
// Convenience function for accessing the global UnitTest
|
||||||
|
@ -172,7 +172,7 @@ static ::std::string ReadEntireFile(FILE * file) {
|
|||||||
// Starts capturing stderr.
|
// Starts capturing stderr.
|
||||||
void CaptureStderr() {
|
void CaptureStderr() {
|
||||||
if (g_captured_stderr != NULL) {
|
if (g_captured_stderr != NULL) {
|
||||||
GTEST_LOG(FATAL, "Only one stderr capturer can exist at one time.");
|
GTEST_LOG_(FATAL, "Only one stderr capturer can exist at one time.");
|
||||||
}
|
}
|
||||||
g_captured_stderr = new CapturedStderr;
|
g_captured_stderr = new CapturedStderr;
|
||||||
}
|
}
|
||||||
|
124
src/gtest-test-part.cc
Normal file
124
src/gtest-test-part.cc
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
// Copyright 2008, 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.
|
||||||
|
//
|
||||||
|
// Author: mheule@google.com (Markus Heule)
|
||||||
|
//
|
||||||
|
// The Google C++ Testing Framework (Google Test)
|
||||||
|
|
||||||
|
#include <gtest/gtest-test-part.h>
|
||||||
|
|
||||||
|
// Indicates that this translation unit is part of Google Test's
|
||||||
|
// implementation. It must come before gtest-internal-inl.h is
|
||||||
|
// included, or there will be a compiler error. This trick is to
|
||||||
|
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||||
|
// his code.
|
||||||
|
#define GTEST_IMPLEMENTATION
|
||||||
|
#include "src/gtest-internal-inl.h"
|
||||||
|
#undef GTEST_IMPLEMENTATION
|
||||||
|
|
||||||
|
namespace testing {
|
||||||
|
|
||||||
|
// Gets the summary of the failure message by omitting the stack trace
|
||||||
|
// in it.
|
||||||
|
internal::String TestPartResult::ExtractSummary(const char* message) {
|
||||||
|
const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
|
||||||
|
return stack_trace == NULL ? internal::String(message) :
|
||||||
|
internal::String(message, stack_trace - message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prints a TestPartResult object.
|
||||||
|
std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
|
||||||
|
return os << result.file_name() << ":"
|
||||||
|
<< result.line_number() << ": "
|
||||||
|
<< (result.type() == TPRT_SUCCESS ? "Success" :
|
||||||
|
result.type() == TPRT_FATAL_FAILURE ? "Fatal failure" :
|
||||||
|
"Non-fatal failure") << ":\n"
|
||||||
|
<< result.message() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructs an empty TestPartResultArray.
|
||||||
|
TestPartResultArray::TestPartResultArray()
|
||||||
|
: list_(new internal::List<TestPartResult>) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destructs a TestPartResultArray.
|
||||||
|
TestPartResultArray::~TestPartResultArray() {
|
||||||
|
delete list_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Appends a TestPartResult to the array.
|
||||||
|
void TestPartResultArray::Append(const TestPartResult& result) {
|
||||||
|
list_->PushBack(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the TestPartResult at the given index (0-based).
|
||||||
|
const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
|
||||||
|
if (index < 0 || index >= size()) {
|
||||||
|
printf("\nInvalid index (%d) into TestPartResultArray.\n", index);
|
||||||
|
internal::abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
const internal::ListNode<TestPartResult>* p = list_->Head();
|
||||||
|
for (int i = 0; i < index; i++) {
|
||||||
|
p = p->next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return p->element();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the number of TestPartResult objects in the array.
|
||||||
|
int TestPartResultArray::size() const {
|
||||||
|
return list_->size();
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
HasNewFatalFailureHelper::HasNewFatalFailureHelper()
|
||||||
|
: has_new_fatal_failure_(false),
|
||||||
|
original_reporter_(UnitTest::GetInstance()->impl()->
|
||||||
|
GetTestPartResultReporterForCurrentThread()) {
|
||||||
|
UnitTest::GetInstance()->impl()->SetTestPartResultReporterForCurrentThread(
|
||||||
|
this);
|
||||||
|
}
|
||||||
|
|
||||||
|
HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
|
||||||
|
UnitTest::GetInstance()->impl()->SetTestPartResultReporterForCurrentThread(
|
||||||
|
original_reporter_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HasNewFatalFailureHelper::ReportTestPartResult(
|
||||||
|
const TestPartResult& result) {
|
||||||
|
if (result.fatally_failed())
|
||||||
|
has_new_fatal_failure_ = true;
|
||||||
|
original_reporter_->ReportTestPartResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
|
} // namespace testing
|
254
src/gtest.cc
254
src/gtest.cc
@ -60,11 +60,16 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#elif defined(GTEST_OS_SYMBIAN)
|
||||||
|
// No autoconf on Symbian
|
||||||
|
#define GTEST_HAS_GETTIMEOFDAY
|
||||||
|
#include <sys/time.h> // NOLINT
|
||||||
|
|
||||||
#elif defined(_WIN32_WCE) // We are on Windows CE.
|
#elif defined(_WIN32_WCE) // We are on Windows CE.
|
||||||
|
|
||||||
#include <windows.h> // NOLINT
|
#include <windows.h> // NOLINT
|
||||||
|
|
||||||
#elif defined(_WIN32) // We are on Windows proper.
|
#elif defined(GTEST_OS_WINDOWS) // We are on Windows proper.
|
||||||
|
|
||||||
#include <io.h> // NOLINT
|
#include <io.h> // NOLINT
|
||||||
#include <sys/timeb.h> // NOLINT
|
#include <sys/timeb.h> // NOLINT
|
||||||
@ -134,22 +139,26 @@ static const char kUniversalFilter[] = "*";
|
|||||||
// The default output file for XML output.
|
// The default output file for XML output.
|
||||||
static const char kDefaultOutputFile[] = "test_detail.xml";
|
static const char kDefaultOutputFile[] = "test_detail.xml";
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
// The text used in failure messages to indicate the start of the
|
// The text used in failure messages to indicate the start of the
|
||||||
// stack trace.
|
// stack trace.
|
||||||
static const char kStackTraceMarker[] = "\nStack trace:\n";
|
const char kStackTraceMarker[] = "\nStack trace:\n";
|
||||||
|
|
||||||
GTEST_DEFINE_bool(
|
} // namespace internal
|
||||||
|
|
||||||
|
GTEST_DEFINE_bool_(
|
||||||
break_on_failure,
|
break_on_failure,
|
||||||
internal::BoolFromGTestEnv("break_on_failure", false),
|
internal::BoolFromGTestEnv("break_on_failure", false),
|
||||||
"True iff a failed assertion should be a debugger break-point.");
|
"True iff a failed assertion should be a debugger break-point.");
|
||||||
|
|
||||||
GTEST_DEFINE_bool(
|
GTEST_DEFINE_bool_(
|
||||||
catch_exceptions,
|
catch_exceptions,
|
||||||
internal::BoolFromGTestEnv("catch_exceptions", false),
|
internal::BoolFromGTestEnv("catch_exceptions", false),
|
||||||
"True iff " GTEST_NAME
|
"True iff " GTEST_NAME
|
||||||
" should catch exceptions and treat them as test failures.");
|
" should catch exceptions and treat them as test failures.");
|
||||||
|
|
||||||
GTEST_DEFINE_string(
|
GTEST_DEFINE_string_(
|
||||||
color,
|
color,
|
||||||
internal::StringFromGTestEnv("color", "auto"),
|
internal::StringFromGTestEnv("color", "auto"),
|
||||||
"Whether to use colors in the output. Valid values: yes, no, "
|
"Whether to use colors in the output. Valid values: yes, no, "
|
||||||
@ -157,7 +166,7 @@ GTEST_DEFINE_string(
|
|||||||
"being sent to a terminal and the TERM environment variable "
|
"being sent to a terminal and the TERM environment variable "
|
||||||
"is set to xterm or xterm-color.");
|
"is set to xterm or xterm-color.");
|
||||||
|
|
||||||
GTEST_DEFINE_string(
|
GTEST_DEFINE_string_(
|
||||||
filter,
|
filter,
|
||||||
internal::StringFromGTestEnv("filter", kUniversalFilter),
|
internal::StringFromGTestEnv("filter", kUniversalFilter),
|
||||||
"A colon-separated list of glob (not regex) patterns "
|
"A colon-separated list of glob (not regex) patterns "
|
||||||
@ -166,10 +175,10 @@ GTEST_DEFINE_string(
|
|||||||
"exclude). A test is run if it matches one of the positive "
|
"exclude). A test is run if it matches one of the positive "
|
||||||
"patterns and does not match any of the negative patterns.");
|
"patterns and does not match any of the negative patterns.");
|
||||||
|
|
||||||
GTEST_DEFINE_bool(list_tests, false,
|
GTEST_DEFINE_bool_(list_tests, false,
|
||||||
"List all tests without running them.");
|
"List all tests without running them.");
|
||||||
|
|
||||||
GTEST_DEFINE_string(
|
GTEST_DEFINE_string_(
|
||||||
output,
|
output,
|
||||||
internal::StringFromGTestEnv("output", ""),
|
internal::StringFromGTestEnv("output", ""),
|
||||||
"A format (currently must be \"xml\"), optionally followed "
|
"A format (currently must be \"xml\"), optionally followed "
|
||||||
@ -181,37 +190,29 @@ GTEST_DEFINE_string(
|
|||||||
"executable's name and, if necessary, made unique by adding "
|
"executable's name and, if necessary, made unique by adding "
|
||||||
"digits.");
|
"digits.");
|
||||||
|
|
||||||
GTEST_DEFINE_bool(
|
GTEST_DEFINE_bool_(
|
||||||
print_time,
|
print_time,
|
||||||
internal::BoolFromGTestEnv("print_time", false),
|
internal::BoolFromGTestEnv("print_time", false),
|
||||||
"True iff " GTEST_NAME
|
"True iff " GTEST_NAME
|
||||||
" should display elapsed time in text output.");
|
" should display elapsed time in text output.");
|
||||||
|
|
||||||
GTEST_DEFINE_int32(
|
GTEST_DEFINE_int32_(
|
||||||
repeat,
|
repeat,
|
||||||
internal::Int32FromGTestEnv("repeat", 1),
|
internal::Int32FromGTestEnv("repeat", 1),
|
||||||
"How many times to repeat each test. Specify a negative number "
|
"How many times to repeat each test. Specify a negative number "
|
||||||
"for repeating forever. Useful for shaking out flaky tests.");
|
"for repeating forever. Useful for shaking out flaky tests.");
|
||||||
|
|
||||||
GTEST_DEFINE_int32(
|
GTEST_DEFINE_int32_(
|
||||||
stack_trace_depth,
|
stack_trace_depth,
|
||||||
internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth),
|
internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth),
|
||||||
"The maximum number of stack frames to print when an "
|
"The maximum number of stack frames to print when an "
|
||||||
"assertion fails. The valid range is 0 through 100, inclusive.");
|
"assertion fails. The valid range is 0 through 100, inclusive.");
|
||||||
|
|
||||||
GTEST_DEFINE_bool(
|
GTEST_DEFINE_bool_(
|
||||||
show_internal_stack_frames, false,
|
show_internal_stack_frames, false,
|
||||||
"True iff " GTEST_NAME " should include internal stack frames when "
|
"True iff " GTEST_NAME " should include internal stack frames when "
|
||||||
"printing test failure stack traces.");
|
"printing test failure stack traces.");
|
||||||
|
|
||||||
// Gets the summary of the failure message by omitting the stack trace
|
|
||||||
// in it.
|
|
||||||
internal::String TestPartResult::ExtractSummary(const char* message) {
|
|
||||||
const char* const stack_trace = strstr(message, kStackTraceMarker);
|
|
||||||
return stack_trace == NULL ? internal::String(message) :
|
|
||||||
internal::String(message, stack_trace - message);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
// GTestIsInitialized() returns true iff the user has initialized
|
// GTestIsInitialized() returns true iff the user has initialized
|
||||||
@ -280,11 +281,11 @@ String g_executable_path;
|
|||||||
FilePath GetCurrentExecutableName() {
|
FilePath GetCurrentExecutableName() {
|
||||||
FilePath result;
|
FilePath result;
|
||||||
|
|
||||||
#if defined(_WIN32_WCE) || defined(_WIN32)
|
#if defined(_WIN32_WCE) || defined(GTEST_OS_WINDOWS)
|
||||||
result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
|
result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
|
||||||
#else
|
#else
|
||||||
result.Set(FilePath(g_executable_path));
|
result.Set(FilePath(g_executable_path));
|
||||||
#endif // _WIN32_WCE || _WIN32
|
#endif // _WIN32_WCE || GTEST_OS_WINDOWS
|
||||||
|
|
||||||
return result.RemoveDirectoryName();
|
return result.RemoveDirectoryName();
|
||||||
}
|
}
|
||||||
@ -456,58 +457,46 @@ class UnitTestEventListenerInterface {
|
|||||||
virtual void OnNewTestPartResult(const TestPartResult*) {}
|
virtual void OnNewTestPartResult(const TestPartResult*) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constructs an empty TestPartResultArray.
|
// The c'tor sets this object as the test part result reporter used by
|
||||||
TestPartResultArray::TestPartResultArray()
|
// Google Test. The 'result' parameter specifies where to report the
|
||||||
: list_(new internal::List<TestPartResult>) {
|
// results. Intercepts only failures from the current thread.
|
||||||
}
|
ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
|
||||||
|
TestPartResultArray* result)
|
||||||
// Destructs a TestPartResultArray.
|
: intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),
|
||||||
TestPartResultArray::~TestPartResultArray() {
|
result_(result) {
|
||||||
delete list_;
|
Init();
|
||||||
}
|
|
||||||
|
|
||||||
// Appends a TestPartResult to the array.
|
|
||||||
void TestPartResultArray::Append(const TestPartResult& result) {
|
|
||||||
list_->PushBack(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the TestPartResult at the given index (0-based).
|
|
||||||
const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const {
|
|
||||||
if (index < 0 || index >= size()) {
|
|
||||||
printf("\nInvalid index (%d) into TestPartResultArray.\n", index);
|
|
||||||
internal::abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
const internal::ListNode<TestPartResult>* p = list_->Head();
|
|
||||||
for (int i = 0; i < index; i++) {
|
|
||||||
p = p->next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return p->element();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the number of TestPartResult objects in the array.
|
|
||||||
int TestPartResultArray::size() const {
|
|
||||||
return list_->size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The c'tor sets this object as the test part result reporter used by
|
// The c'tor sets this object as the test part result reporter used by
|
||||||
// Google Test. The 'result' parameter specifies where to report the
|
// Google Test. The 'result' parameter specifies where to report the
|
||||||
// results.
|
// results.
|
||||||
ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
|
ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
|
||||||
TestPartResultArray* result)
|
InterceptMode intercept_mode, TestPartResultArray* result)
|
||||||
: old_reporter_(UnitTest::GetInstance()->impl()->
|
: intercept_mode_(intercept_mode),
|
||||||
test_part_result_reporter()),
|
|
||||||
result_(result) {
|
result_(result) {
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScopedFakeTestPartResultReporter::Init() {
|
||||||
internal::UnitTestImpl* const impl = UnitTest::GetInstance()->impl();
|
internal::UnitTestImpl* const impl = UnitTest::GetInstance()->impl();
|
||||||
impl->set_test_part_result_reporter(this);
|
if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
|
||||||
|
old_reporter_ = impl->GetGlobalTestPartResultReporter();
|
||||||
|
impl->SetGlobalTestPartResultReporter(this);
|
||||||
|
} else {
|
||||||
|
old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();
|
||||||
|
impl->SetTestPartResultReporterForCurrentThread(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The d'tor restores the test part result reporter used by Google Test
|
// The d'tor restores the test part result reporter used by Google Test
|
||||||
// before.
|
// before.
|
||||||
ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
|
ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
|
||||||
UnitTest::GetInstance()->impl()->
|
internal::UnitTestImpl* const impl = UnitTest::GetInstance()->impl();
|
||||||
set_test_part_result_reporter(old_reporter_);
|
if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
|
||||||
|
impl->SetGlobalTestPartResultReporter(old_reporter_);
|
||||||
|
} else {
|
||||||
|
impl->SetTestPartResultReporterForCurrentThread(old_reporter_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increments the test part result count and remembers the result.
|
// Increments the test part result count and remembers the result.
|
||||||
@ -579,21 +568,47 @@ SingleFailureChecker::~SingleFailureChecker() {
|
|||||||
EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_.c_str());
|
EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reports a test part result.
|
DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(
|
||||||
void UnitTestImpl::ReportTestPartResult(const TestPartResult& result) {
|
UnitTestImpl* unit_test) : unit_test_(unit_test) {}
|
||||||
current_test_result()->AddTestPartResult(result);
|
|
||||||
result_printer()->OnNewTestPartResult(&result);
|
void DefaultGlobalTestPartResultReporter::ReportTestPartResult(
|
||||||
|
const TestPartResult& result) {
|
||||||
|
unit_test_->current_test_result()->AddTestPartResult(result);
|
||||||
|
unit_test_->result_printer()->OnNewTestPartResult(&result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the current test part result reporter.
|
DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(
|
||||||
TestPartResultReporterInterface* UnitTestImpl::test_part_result_reporter() {
|
UnitTestImpl* unit_test) : unit_test_(unit_test) {}
|
||||||
return test_part_result_reporter_;
|
|
||||||
|
void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
|
||||||
|
const TestPartResult& result) {
|
||||||
|
unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the current test part result reporter.
|
// Returns the global test part result reporter.
|
||||||
void UnitTestImpl::set_test_part_result_reporter(
|
TestPartResultReporterInterface*
|
||||||
|
UnitTestImpl::GetGlobalTestPartResultReporter() {
|
||||||
|
internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
|
||||||
|
return global_test_part_result_repoter_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the global test part result reporter.
|
||||||
|
void UnitTestImpl::SetGlobalTestPartResultReporter(
|
||||||
TestPartResultReporterInterface* reporter) {
|
TestPartResultReporterInterface* reporter) {
|
||||||
test_part_result_reporter_ = reporter;
|
internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
|
||||||
|
global_test_part_result_repoter_ = reporter;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the test part result reporter for the current thread.
|
||||||
|
TestPartResultReporterInterface*
|
||||||
|
UnitTestImpl::GetTestPartResultReporterForCurrentThread() {
|
||||||
|
return per_thread_test_part_result_reporter_.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the test part result reporter for the current thread.
|
||||||
|
void UnitTestImpl::SetTestPartResultReporterForCurrentThread(
|
||||||
|
TestPartResultReporterInterface* reporter) {
|
||||||
|
per_thread_test_part_result_reporter_.set(reporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the number of successful test cases.
|
// Gets the number of successful test cases.
|
||||||
@ -678,7 +693,7 @@ static TimeInMillis GetTimeInMillis() {
|
|||||||
return now_int64.QuadPart;
|
return now_int64.QuadPart;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#elif defined(_WIN32) && !defined(GTEST_HAS_GETTIMEOFDAY)
|
#elif defined(GTEST_OS_WINDOWS) && !defined(GTEST_HAS_GETTIMEOFDAY)
|
||||||
__timeb64 now;
|
__timeb64 now;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
|
// MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
|
||||||
@ -1039,7 +1054,7 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
|
|||||||
// A macro for implementing the helper functions needed to implement
|
// A macro for implementing the helper functions needed to implement
|
||||||
// ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here
|
// ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here
|
||||||
// just to avoid copy-and-paste of similar code.
|
// just to avoid copy-and-paste of similar code.
|
||||||
#define GTEST_IMPL_CMP_HELPER(op_name, op)\
|
#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
|
||||||
AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
||||||
BiggestInt val1, BiggestInt val2) {\
|
BiggestInt val1, BiggestInt val2) {\
|
||||||
if (val1 op val2) {\
|
if (val1 op val2) {\
|
||||||
@ -1055,21 +1070,21 @@ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
|
|||||||
|
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_NE with int or
|
// Implements the helper function for {ASSERT|EXPECT}_NE with int or
|
||||||
// enum arguments.
|
// enum arguments.
|
||||||
GTEST_IMPL_CMP_HELPER(NE, !=)
|
GTEST_IMPL_CMP_HELPER_(NE, !=)
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_LE with int or
|
// Implements the helper function for {ASSERT|EXPECT}_LE with int or
|
||||||
// enum arguments.
|
// enum arguments.
|
||||||
GTEST_IMPL_CMP_HELPER(LE, <=)
|
GTEST_IMPL_CMP_HELPER_(LE, <=)
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_LT with int or
|
// Implements the helper function for {ASSERT|EXPECT}_LT with int or
|
||||||
// enum arguments.
|
// enum arguments.
|
||||||
GTEST_IMPL_CMP_HELPER(LT, < )
|
GTEST_IMPL_CMP_HELPER_(LT, < )
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_GE with int or
|
// Implements the helper function for {ASSERT|EXPECT}_GE with int or
|
||||||
// enum arguments.
|
// enum arguments.
|
||||||
GTEST_IMPL_CMP_HELPER(GE, >=)
|
GTEST_IMPL_CMP_HELPER_(GE, >=)
|
||||||
// Implements the helper function for {ASSERT|EXPECT}_GT with int or
|
// Implements the helper function for {ASSERT|EXPECT}_GT with int or
|
||||||
// enum arguments.
|
// enum arguments.
|
||||||
GTEST_IMPL_CMP_HELPER(GT, > )
|
GTEST_IMPL_CMP_HELPER_(GT, > )
|
||||||
|
|
||||||
#undef GTEST_IMPL_CMP_HELPER
|
#undef GTEST_IMPL_CMP_HELPER_
|
||||||
|
|
||||||
// The helper function for {ASSERT|EXPECT}_STREQ.
|
// The helper function for {ASSERT|EXPECT}_STREQ.
|
||||||
AssertionResult CmpHelperSTREQ(const char* expected_expression,
|
AssertionResult CmpHelperSTREQ(const char* expected_expression,
|
||||||
@ -1722,19 +1737,6 @@ String AppendUserMessage(const String& gtest_msg,
|
|||||||
return msg.GetString();
|
return msg.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace internal
|
|
||||||
|
|
||||||
// Prints a TestPartResult object.
|
|
||||||
std::ostream& operator<<(std::ostream& os, const TestPartResult& result) {
|
|
||||||
return os << result.file_name() << ":"
|
|
||||||
<< result.line_number() << ": "
|
|
||||||
<< (result.type() == TPRT_SUCCESS ? "Success" :
|
|
||||||
result.type() == TPRT_FATAL_FAILURE ? "Fatal failure" :
|
|
||||||
"Non-fatal failure") << ":\n"
|
|
||||||
<< result.message() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace internal {
|
|
||||||
// class TestResult
|
// class TestResult
|
||||||
|
|
||||||
// Creates an empty TestResult.
|
// Creates an empty TestResult.
|
||||||
@ -2380,7 +2382,7 @@ enum GTestColor {
|
|||||||
COLOR_YELLOW
|
COLOR_YELLOW
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_WIN32_WCE)
|
#if defined(GTEST_OS_WINDOWS) && !defined(_WIN32_WCE)
|
||||||
|
|
||||||
// Returns the character attribute for the given color.
|
// Returns the character attribute for the given color.
|
||||||
WORD GetColorAttribute(GTestColor color) {
|
WORD GetColorAttribute(GTestColor color) {
|
||||||
@ -2404,14 +2406,14 @@ const char* GetAnsiColorCode(GTestColor color) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _WIN32 && !_WIN32_WCE
|
#endif // GTEST_OS_WINDOWS && !_WIN32_WCE
|
||||||
|
|
||||||
// Returns true iff Google Test should use colors in the output.
|
// Returns true iff Google Test should use colors in the output.
|
||||||
bool ShouldUseColor(bool stdout_is_tty) {
|
bool ShouldUseColor(bool stdout_is_tty) {
|
||||||
const char* const gtest_color = GTEST_FLAG(color).c_str();
|
const char* const gtest_color = GTEST_FLAG(color).c_str();
|
||||||
|
|
||||||
if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
|
if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
|
||||||
#ifdef _WIN32
|
#ifdef GTEST_OS_WINDOWS
|
||||||
// On Windows the TERM variable is usually not set, but the
|
// On Windows the TERM variable is usually not set, but the
|
||||||
// console there does support colors.
|
// console there does support colors.
|
||||||
return stdout_is_tty;
|
return stdout_is_tty;
|
||||||
@ -2423,7 +2425,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
|
|||||||
String::CStringEquals(term, "xterm-color") ||
|
String::CStringEquals(term, "xterm-color") ||
|
||||||
String::CStringEquals(term, "cygwin");
|
String::CStringEquals(term, "cygwin");
|
||||||
return stdout_is_tty && term_supports_color;
|
return stdout_is_tty && term_supports_color;
|
||||||
#endif // _WIN32
|
#endif // GTEST_OS_WINDOWS
|
||||||
}
|
}
|
||||||
|
|
||||||
return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
|
return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
|
||||||
@ -2443,7 +2445,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
|||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#if defined(_WIN32_WCE) || defined(GTEST_OS_SYMBIAN)
|
||||||
static const bool use_color = false;
|
static const bool use_color = false;
|
||||||
#else
|
#else
|
||||||
static const bool use_color = ShouldUseColor(isatty(fileno(stdout)) != 0);
|
static const bool use_color = ShouldUseColor(isatty(fileno(stdout)) != 0);
|
||||||
@ -2456,7 +2458,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_WIN32_WCE)
|
#if defined(GTEST_OS_WINDOWS) && !defined(_WIN32_WCE)
|
||||||
const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
// Gets the current text color.
|
// Gets the current text color.
|
||||||
@ -2474,7 +2476,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
|||||||
printf("\033[0;3%sm", GetAnsiColorCode(color));
|
printf("\033[0;3%sm", GetAnsiColorCode(color));
|
||||||
vprintf(fmt, args);
|
vprintf(fmt, args);
|
||||||
printf("\033[m"); // Resets the terminal to default.
|
printf("\033[m"); // Resets the terminal to default.
|
||||||
#endif // _WIN32 && !_WIN32_WCE
|
#endif // GTEST_OS_WINDOWS && !_WIN32_WCE
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2718,7 +2720,7 @@ class UnitTestEventsRepeater : public UnitTestEventListenerInterface {
|
|||||||
private:
|
private:
|
||||||
Listeners listeners_;
|
Listeners listeners_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(UnitTestEventsRepeater);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestEventsRepeater);
|
||||||
};
|
};
|
||||||
|
|
||||||
UnitTestEventsRepeater::~UnitTestEventsRepeater() {
|
UnitTestEventsRepeater::~UnitTestEventsRepeater() {
|
||||||
@ -2736,7 +2738,7 @@ void UnitTestEventsRepeater::AddListener(
|
|||||||
|
|
||||||
// Since the methods are identical, use a macro to reduce boilerplate.
|
// Since the methods are identical, use a macro to reduce boilerplate.
|
||||||
// This defines a member that repeats the call to all listeners.
|
// This defines a member that repeats the call to all listeners.
|
||||||
#define GTEST_REPEATER_METHOD(Name, Type) \
|
#define GTEST_REPEATER_METHOD_(Name, Type) \
|
||||||
void UnitTestEventsRepeater::Name(const Type* parameter) { \
|
void UnitTestEventsRepeater::Name(const Type* parameter) { \
|
||||||
for (ListenersNode* listener = listeners_.Head(); \
|
for (ListenersNode* listener = listeners_.Head(); \
|
||||||
listener != NULL; \
|
listener != NULL; \
|
||||||
@ -2745,19 +2747,19 @@ void UnitTestEventsRepeater::Name(const Type* parameter) { \
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
GTEST_REPEATER_METHOD(OnUnitTestStart, UnitTest)
|
GTEST_REPEATER_METHOD_(OnUnitTestStart, UnitTest)
|
||||||
GTEST_REPEATER_METHOD(OnUnitTestEnd, UnitTest)
|
GTEST_REPEATER_METHOD_(OnUnitTestEnd, UnitTest)
|
||||||
GTEST_REPEATER_METHOD(OnGlobalSetUpStart, UnitTest)
|
GTEST_REPEATER_METHOD_(OnGlobalSetUpStart, UnitTest)
|
||||||
GTEST_REPEATER_METHOD(OnGlobalSetUpEnd, UnitTest)
|
GTEST_REPEATER_METHOD_(OnGlobalSetUpEnd, UnitTest)
|
||||||
GTEST_REPEATER_METHOD(OnGlobalTearDownStart, UnitTest)
|
GTEST_REPEATER_METHOD_(OnGlobalTearDownStart, UnitTest)
|
||||||
GTEST_REPEATER_METHOD(OnGlobalTearDownEnd, UnitTest)
|
GTEST_REPEATER_METHOD_(OnGlobalTearDownEnd, UnitTest)
|
||||||
GTEST_REPEATER_METHOD(OnTestCaseStart, TestCase)
|
GTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)
|
||||||
GTEST_REPEATER_METHOD(OnTestCaseEnd, TestCase)
|
GTEST_REPEATER_METHOD_(OnTestCaseEnd, TestCase)
|
||||||
GTEST_REPEATER_METHOD(OnTestStart, TestInfo)
|
GTEST_REPEATER_METHOD_(OnTestStart, TestInfo)
|
||||||
GTEST_REPEATER_METHOD(OnTestEnd, TestInfo)
|
GTEST_REPEATER_METHOD_(OnTestEnd, TestInfo)
|
||||||
GTEST_REPEATER_METHOD(OnNewTestPartResult, TestPartResult)
|
GTEST_REPEATER_METHOD_(OnNewTestPartResult, TestPartResult)
|
||||||
|
|
||||||
#undef GTEST_REPEATER_METHOD
|
#undef GTEST_REPEATER_METHOD_
|
||||||
|
|
||||||
// End PrettyUnitTestResultPrinter
|
// End PrettyUnitTestResultPrinter
|
||||||
|
|
||||||
@ -2818,7 +2820,7 @@ class XmlUnitTestResultPrinter : public UnitTestEventListenerInterface {
|
|||||||
// The output file.
|
// The output file.
|
||||||
const internal::String output_file_;
|
const internal::String output_file_;
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN(XmlUnitTestResultPrinter);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates a new XmlUnitTestResultPrinter.
|
// Creates a new XmlUnitTestResultPrinter.
|
||||||
@ -3181,13 +3183,14 @@ void UnitTest::AddTestPartResult(TestPartResultType result_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
|
if (os_stack_trace.c_str() != NULL && !os_stack_trace.empty()) {
|
||||||
msg << kStackTraceMarker << os_stack_trace;
|
msg << internal::kStackTraceMarker << os_stack_trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TestPartResult result =
|
const TestPartResult result =
|
||||||
TestPartResult(result_type, file_name, line_number,
|
TestPartResult(result_type, file_name, line_number,
|
||||||
msg.GetString().c_str());
|
msg.GetString().c_str());
|
||||||
impl_->test_part_result_reporter()->ReportTestPartResult(result);
|
impl_->GetTestPartResultReporterForCurrentThread()->
|
||||||
|
ReportTestPartResult(result);
|
||||||
|
|
||||||
// If this is a failure and the user wants the debugger to break on
|
// If this is a failure and the user wants the debugger to break on
|
||||||
// failures ...
|
// failures ...
|
||||||
@ -3291,6 +3294,21 @@ namespace internal {
|
|||||||
|
|
||||||
UnitTestImpl::UnitTestImpl(UnitTest* parent)
|
UnitTestImpl::UnitTestImpl(UnitTest* parent)
|
||||||
: parent_(parent),
|
: parent_(parent),
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push) // Saves the current warning state.
|
||||||
|
#pragma warning(disable:4355) // Temporarily disables warning 4355
|
||||||
|
// (using this in initializer).
|
||||||
|
default_global_test_part_result_reporter_(this),
|
||||||
|
default_per_thread_test_part_result_reporter_(this),
|
||||||
|
#pragma warning(pop) // Restores the warning state again.
|
||||||
|
#else
|
||||||
|
default_global_test_part_result_reporter_(this),
|
||||||
|
default_per_thread_test_part_result_reporter_(this),
|
||||||
|
#endif // _MSC_VER
|
||||||
|
global_test_part_result_repoter_(
|
||||||
|
&default_global_test_part_result_reporter_),
|
||||||
|
per_thread_test_part_result_reporter_(
|
||||||
|
&default_per_thread_test_part_result_reporter_),
|
||||||
test_cases_(),
|
test_cases_(),
|
||||||
last_death_test_case_(NULL),
|
last_death_test_case_(NULL),
|
||||||
current_test_case_(NULL),
|
current_test_case_(NULL),
|
||||||
@ -3305,10 +3323,6 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
|
|||||||
#else
|
#else
|
||||||
elapsed_time_(0) {
|
elapsed_time_(0) {
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
// We do the assignment here instead of in the initializer list, as
|
|
||||||
// doing that latter causes MSVC to issue a warning about using
|
|
||||||
// 'this' in initializers.
|
|
||||||
test_part_result_reporter_ = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitTestImpl::~UnitTestImpl() {
|
UnitTestImpl::~UnitTestImpl() {
|
||||||
|
@ -115,7 +115,7 @@ class MayDie {
|
|||||||
// A member function that may die.
|
// A member function that may die.
|
||||||
void MemberFunction() const {
|
void MemberFunction() const {
|
||||||
if (should_die_) {
|
if (should_die_) {
|
||||||
GTEST_LOG(FATAL, "death inside MayDie::MemberFunction().");
|
GTEST_LOG_(FATAL, "death inside MayDie::MemberFunction().");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,26 +126,26 @@ class MayDie {
|
|||||||
|
|
||||||
// A global function that's expected to die.
|
// A global function that's expected to die.
|
||||||
void GlobalFunction() {
|
void GlobalFunction() {
|
||||||
GTEST_LOG(FATAL, "death inside GlobalFunction().");
|
GTEST_LOG_(FATAL, "death inside GlobalFunction().");
|
||||||
}
|
}
|
||||||
|
|
||||||
// A non-void function that's expected to die.
|
// A non-void function that's expected to die.
|
||||||
int NonVoidFunction() {
|
int NonVoidFunction() {
|
||||||
GTEST_LOG(FATAL, "death inside NonVoidFunction().");
|
GTEST_LOG_(FATAL, "death inside NonVoidFunction().");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A unary function that may die.
|
// A unary function that may die.
|
||||||
void DieIf(bool should_die) {
|
void DieIf(bool should_die) {
|
||||||
if (should_die) {
|
if (should_die) {
|
||||||
GTEST_LOG(FATAL, "death inside DieIf().");
|
GTEST_LOG_(FATAL, "death inside DieIf().");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A binary function that may die.
|
// A binary function that may die.
|
||||||
bool DieIfLessThan(int x, int y) {
|
bool DieIfLessThan(int x, int y) {
|
||||||
if (x < y) {
|
if (x < y) {
|
||||||
GTEST_LOG(FATAL, "death inside DieIfLessThan().");
|
GTEST_LOG_(FATAL, "death inside DieIfLessThan().");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ void DeathTestSubroutine() {
|
|||||||
int DieInDebugElse12(int* sideeffect) {
|
int DieInDebugElse12(int* sideeffect) {
|
||||||
if (sideeffect) *sideeffect = 12;
|
if (sideeffect) *sideeffect = 12;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
GTEST_LOG(FATAL, "debug death inside DieInDebugElse12()");
|
GTEST_LOG_(FATAL, "debug death inside DieInDebugElse12()");
|
||||||
#endif // NDEBUG
|
#endif // NDEBUG
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
@ -717,7 +717,7 @@ bool MockDeathTestFactory::Create(const char* statement,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A test fixture for testing the logic of the GTEST_DEATH_TEST macro.
|
// A test fixture for testing the logic of the GTEST_DEATH_TEST_ macro.
|
||||||
// It installs a MockDeathTestFactory that is used for the duration
|
// It installs a MockDeathTestFactory that is used for the duration
|
||||||
// of the test case.
|
// of the test case.
|
||||||
class MacroLogicDeathTest : public testing::Test {
|
class MacroLogicDeathTest : public testing::Test {
|
||||||
|
@ -286,9 +286,12 @@ TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
|
|||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
// Windows CE _does_ consider an empty directory to exist.
|
||||||
TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
|
TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
|
||||||
EXPECT_FALSE(FilePath("").DirectoryExists());
|
EXPECT_FALSE(FilePath("").DirectoryExists());
|
||||||
}
|
}
|
||||||
|
#endif // ! _WIN32_WCE
|
||||||
|
|
||||||
TEST(DirectoryTest, CurrentDirectoryExists) {
|
TEST(DirectoryTest, CurrentDirectoryExists) {
|
||||||
#ifdef GTEST_OS_WINDOWS // We are on Windows.
|
#ifdef GTEST_OS_WINDOWS // We are on Windows.
|
||||||
|
138
test/gtest-test-part_test.cc
Normal file
138
test/gtest-test-part_test.cc
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
// Copyright 2008 Google Inc. All Rights Reserved.
|
||||||
|
// Author: mheule@google.com (Markus Heule)
|
||||||
|
|
||||||
|
#include <gtest/gtest-test-part.h>
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
using testing::Test;
|
||||||
|
using testing::TestPartResult;
|
||||||
|
using testing::TestPartResultArray;
|
||||||
|
|
||||||
|
using testing::TPRT_FATAL_FAILURE;
|
||||||
|
using testing::TPRT_NONFATAL_FAILURE;
|
||||||
|
using testing::TPRT_SUCCESS;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Tests the TestPartResult class.
|
||||||
|
|
||||||
|
// The test fixture for testing TestPartResult.
|
||||||
|
class TestPartResultTest : public Test {
|
||||||
|
protected:
|
||||||
|
TestPartResultTest()
|
||||||
|
: r1_(TPRT_SUCCESS, "foo/bar.cc", 10, "Success!"),
|
||||||
|
r2_(TPRT_NONFATAL_FAILURE, "foo/bar.cc", -1, "Failure!"),
|
||||||
|
r3_(TPRT_FATAL_FAILURE, NULL, -1, "Failure!") {}
|
||||||
|
|
||||||
|
TestPartResult r1_, r2_, r3_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Tests TestPartResult::type().
|
||||||
|
TEST_F(TestPartResultTest, type) {
|
||||||
|
EXPECT_EQ(TPRT_SUCCESS, r1_.type());
|
||||||
|
EXPECT_EQ(TPRT_NONFATAL_FAILURE, r2_.type());
|
||||||
|
EXPECT_EQ(TPRT_FATAL_FAILURE, r3_.type());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests TestPartResult::file_name().
|
||||||
|
TEST_F(TestPartResultTest, file_name) {
|
||||||
|
EXPECT_STREQ("foo/bar.cc", r1_.file_name());
|
||||||
|
EXPECT_STREQ(NULL, r3_.file_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests TestPartResult::line_number().
|
||||||
|
TEST_F(TestPartResultTest, line_number) {
|
||||||
|
EXPECT_EQ(10, r1_.line_number());
|
||||||
|
EXPECT_EQ(-1, r2_.line_number());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests TestPartResult::message().
|
||||||
|
TEST_F(TestPartResultTest, message) {
|
||||||
|
EXPECT_STREQ("Success!", r1_.message());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests TestPartResult::passed().
|
||||||
|
TEST_F(TestPartResultTest, Passed) {
|
||||||
|
EXPECT_TRUE(r1_.passed());
|
||||||
|
EXPECT_FALSE(r2_.passed());
|
||||||
|
EXPECT_FALSE(r3_.passed());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests TestPartResult::failed().
|
||||||
|
TEST_F(TestPartResultTest, Failed) {
|
||||||
|
EXPECT_FALSE(r1_.failed());
|
||||||
|
EXPECT_TRUE(r2_.failed());
|
||||||
|
EXPECT_TRUE(r3_.failed());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests TestPartResult::fatally_failed().
|
||||||
|
TEST_F(TestPartResultTest, FatallyFailed) {
|
||||||
|
EXPECT_FALSE(r1_.fatally_failed());
|
||||||
|
EXPECT_FALSE(r2_.fatally_failed());
|
||||||
|
EXPECT_TRUE(r3_.fatally_failed());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests TestPartResult::nonfatally_failed().
|
||||||
|
TEST_F(TestPartResultTest, NonfatallyFailed) {
|
||||||
|
EXPECT_FALSE(r1_.nonfatally_failed());
|
||||||
|
EXPECT_TRUE(r2_.nonfatally_failed());
|
||||||
|
EXPECT_FALSE(r3_.nonfatally_failed());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests the TestPartResultArray class.
|
||||||
|
|
||||||
|
class TestPartResultArrayTest : public Test {
|
||||||
|
protected:
|
||||||
|
TestPartResultArrayTest()
|
||||||
|
: r1_(TPRT_NONFATAL_FAILURE, "foo/bar.cc", -1, "Failure 1"),
|
||||||
|
r2_(TPRT_FATAL_FAILURE, "foo/bar.cc", -1, "Failure 2") {}
|
||||||
|
|
||||||
|
const TestPartResult r1_, r2_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Tests that TestPartResultArray initially has size 0.
|
||||||
|
TEST_F(TestPartResultArrayTest, InitialSizeIsZero) {
|
||||||
|
TestPartResultArray results;
|
||||||
|
EXPECT_EQ(0, results.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests that TestPartResultArray contains the given TestPartResult
|
||||||
|
// after one Append() operation.
|
||||||
|
TEST_F(TestPartResultArrayTest, ContainsGivenResultAfterAppend) {
|
||||||
|
TestPartResultArray results;
|
||||||
|
results.Append(r1_);
|
||||||
|
EXPECT_EQ(1, results.size());
|
||||||
|
EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests that TestPartResultArray contains the given TestPartResults
|
||||||
|
// after two Append() operations.
|
||||||
|
TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
|
||||||
|
TestPartResultArray results;
|
||||||
|
results.Append(r1_);
|
||||||
|
results.Append(r2_);
|
||||||
|
EXPECT_EQ(2, results.size());
|
||||||
|
EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
|
||||||
|
EXPECT_STREQ("Failure 2", results.GetTestPartResult(1).message());
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
|
typedef TestPartResultArrayTest TestPartResultArrayDeathTest;
|
||||||
|
|
||||||
|
// Tests that the program dies when GetTestPartResult() is called with
|
||||||
|
// an invalid index.
|
||||||
|
TEST_F(TestPartResultArrayDeathTest, DiesWhenIndexIsOutOfBound) {
|
||||||
|
TestPartResultArray results;
|
||||||
|
results.Append(r1_);
|
||||||
|
|
||||||
|
EXPECT_DEATH(results.GetTestPartResult(-1), "");
|
||||||
|
EXPECT_DEATH(results.GetTestPartResult(1), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
|
// TODO(mheule@google.com): Add a test for the class HasNewFatalFailureHelper.
|
||||||
|
|
||||||
|
} // namespace
|
@ -36,7 +36,7 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
GTEST_DECLARE_string(filter);
|
GTEST_DECLARE_string_(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -46,14 +46,20 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if GTEST_HAS_PTHREAD
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif // GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
#ifdef GTEST_OS_LINUX
|
#ifdef GTEST_OS_LINUX
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <pthread.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#endif // GTEST_OS_LINUX
|
#endif // GTEST_OS_LINUX
|
||||||
|
|
||||||
|
using testing::ScopedFakeTestPartResultReporter;
|
||||||
|
using testing::TestPartResultArray;
|
||||||
|
|
||||||
// Tests catching fatal failures.
|
// Tests catching fatal failures.
|
||||||
|
|
||||||
// A subroutine used by the following test.
|
// A subroutine used by the following test.
|
||||||
@ -790,6 +796,134 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
|
|||||||
|
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
|
// Tests various failure conditions of
|
||||||
|
// EXPECT_{,NON}FATAL_FAILURE{,_ON_ALL_THREADS}.
|
||||||
|
class ExpectFailureTest : public testing::Test {
|
||||||
|
protected:
|
||||||
|
enum FailureMode {
|
||||||
|
FATAL_FAILURE,
|
||||||
|
NONFATAL_FAILURE
|
||||||
|
};
|
||||||
|
static void AddFailure(FailureMode failure) {
|
||||||
|
if (failure == FATAL_FAILURE) {
|
||||||
|
FAIL() << "Expected fatal failure.";
|
||||||
|
} else {
|
||||||
|
ADD_FAILURE() << "Expected non-fatal failure.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, ExpectFatalFailure) {
|
||||||
|
// Expected fatal failure, but succeeds.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_FATAL_FAILURE(SUCCEED(), "Expected fatal failure.");
|
||||||
|
// Expected fatal failure, but got a non-fatal failure.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_FATAL_FAILURE(AddFailure(NONFATAL_FAILURE), "Expected non-fatal "
|
||||||
|
"failure.");
|
||||||
|
// Wrong message.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_FATAL_FAILURE(AddFailure(FATAL_FAILURE), "Some other fatal failure "
|
||||||
|
"expected.");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
|
||||||
|
// Expected non-fatal failure, but succeeds.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_NONFATAL_FAILURE(SUCCEED(), "Expected non-fatal failure.");
|
||||||
|
// Expected non-fatal failure, but got a fatal failure.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_NONFATAL_FAILURE(AddFailure(FATAL_FAILURE), "Expected fatal failure.");
|
||||||
|
// Wrong message.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_NONFATAL_FAILURE(AddFailure(NONFATAL_FAILURE), "Some other non-fatal "
|
||||||
|
"failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
|
class ExpectFailureWithThreadsTest : public ExpectFailureTest {
|
||||||
|
protected:
|
||||||
|
static void AddFailureInOtherThread(FailureMode failure) {
|
||||||
|
pthread_t tid;
|
||||||
|
pthread_create(&tid,
|
||||||
|
NULL,
|
||||||
|
ExpectFailureWithThreadsTest::FailureThread,
|
||||||
|
&failure);
|
||||||
|
pthread_join(tid, NULL);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
static void* FailureThread(void* attr) {
|
||||||
|
FailureMode* failure = static_cast<FailureMode*>(attr);
|
||||||
|
AddFailure(*failure);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailure) {
|
||||||
|
// We only intercept the current thread.
|
||||||
|
printf("(expecting 2 failures)\n");
|
||||||
|
EXPECT_FATAL_FAILURE(AddFailureInOtherThread(FATAL_FAILURE),
|
||||||
|
"Expected fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailure) {
|
||||||
|
// We only intercept the current thread.
|
||||||
|
printf("(expecting 2 failures)\n");
|
||||||
|
EXPECT_NONFATAL_FAILURE(AddFailureInOtherThread(NONFATAL_FAILURE),
|
||||||
|
"Expected non-fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef ExpectFailureWithThreadsTest ScopedFakeTestPartResultReporterTest;
|
||||||
|
|
||||||
|
// Tests that the ScopedFakeTestPartResultReporter only catches failures from
|
||||||
|
// the current thread if it is instantiated with INTERCEPT_ONLY_CURRENT_THREAD.
|
||||||
|
TEST_F(ScopedFakeTestPartResultReporterTest, InterceptOnlyCurrentThread) {
|
||||||
|
printf("(expecting 2 failures)\n");
|
||||||
|
TestPartResultArray results;
|
||||||
|
{
|
||||||
|
ScopedFakeTestPartResultReporter reporter(
|
||||||
|
ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,
|
||||||
|
&results);
|
||||||
|
AddFailureInOtherThread(FATAL_FAILURE);
|
||||||
|
AddFailureInOtherThread(NONFATAL_FAILURE);
|
||||||
|
}
|
||||||
|
// The two failures should not have been intercepted.
|
||||||
|
EXPECT_EQ(0, results.size()) << "This shouldn't fail.";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, ExpectFatalFailureOnAllThreads) {
|
||||||
|
// Expected fatal failure, but succeeds.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected fatal failure.");
|
||||||
|
// Expected fatal failure, but got a non-fatal failure.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
|
||||||
|
"Expected non-fatal failure.");
|
||||||
|
// Wrong message.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),
|
||||||
|
"Some other fatal failure expected.");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
|
||||||
|
// Expected non-fatal failure, but succeeds.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected non-fatal "
|
||||||
|
"failure.");
|
||||||
|
// Expected non-fatal failure, but got a fatal failure.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),
|
||||||
|
"Expected fatal failure.");
|
||||||
|
// Wrong message.
|
||||||
|
printf("(expecting 1 failure)\n");
|
||||||
|
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
|
||||||
|
"Some other non-fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Two test environments for testing testing::AddGlobalTestEnvironment().
|
// Two test environments for testing testing::AddGlobalTestEnvironment().
|
||||||
|
|
||||||
class FooEnvironment : public testing::Environment {
|
class FooEnvironment : public testing::Environment {
|
||||||
|
@ -7,7 +7,7 @@ Expected: true
|
|||||||
gtest_output_test_.cc:#: Failure
|
gtest_output_test_.cc:#: Failure
|
||||||
Value of: 3
|
Value of: 3
|
||||||
Expected: 2
|
Expected: 2
|
||||||
[0;32m[==========] [mRunning 48 tests from 21 test cases.
|
[0;32m[==========] [mRunning 52 tests from 22 test cases.
|
||||||
[0;32m[----------] [mGlobal test environment set-up.
|
[0;32m[----------] [mGlobal test environment set-up.
|
||||||
FooEnvironment::SetUp() called.
|
FooEnvironment::SetUp() called.
|
||||||
BarEnvironment::SetUp() called.
|
BarEnvironment::SetUp() called.
|
||||||
@ -386,6 +386,107 @@ Value of: TypeParam()
|
|||||||
Expected: 1
|
Expected: 1
|
||||||
Expected failure
|
Expected failure
|
||||||
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure
|
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure
|
||||||
|
[0;32m[----------] [m4 tests from ExpectFailureTest
|
||||||
|
[0;32m[ RUN ] [mExpectFailureTest.ExpectFatalFailure
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Success:
|
||||||
|
Succeeded
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Non-fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected non-fatal failure.
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 fatal failure containing "Some other fatal failure expected."
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected fatal failure.
|
||||||
|
|
||||||
|
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailure
|
||||||
|
[0;32m[ RUN ] [mExpectFailureTest.ExpectNonFatalFailure
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 non-fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Success:
|
||||||
|
Succeeded
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 non-fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected fatal failure.
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 non-fatal failure containing "Some other non-fatal failure."
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Non-fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected non-fatal failure.
|
||||||
|
|
||||||
|
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailure
|
||||||
|
[0;32m[ RUN ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Success:
|
||||||
|
Succeeded
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Non-fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected non-fatal failure.
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 fatal failure containing "Some other fatal failure expected."
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected fatal failure.
|
||||||
|
|
||||||
|
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
|
||||||
|
[0;32m[ RUN ] [mExpectFailureTest.ExpectNonFatalFailureOnAllThreads
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 non-fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Success:
|
||||||
|
Succeeded
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 non-fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected fatal failure.
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: Failure
|
||||||
|
Expected: 1 non-fatal failure containing "Some other non-fatal failure."
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Non-fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected non-fatal failure.
|
||||||
|
|
||||||
|
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailureOnAllThreads
|
||||||
[0;32m[----------] [mGlobal test environment tear-down
|
[0;32m[----------] [mGlobal test environment tear-down
|
||||||
BarEnvironment::TearDown() called.
|
BarEnvironment::TearDown() called.
|
||||||
gtest_output_test_.cc:#: Failure
|
gtest_output_test_.cc:#: Failure
|
||||||
@ -395,9 +496,9 @@ FooEnvironment::TearDown() called.
|
|||||||
gtest_output_test_.cc:#: Failure
|
gtest_output_test_.cc:#: Failure
|
||||||
Failed
|
Failed
|
||||||
Expected fatal failure.
|
Expected fatal failure.
|
||||||
[0;32m[==========] [m48 tests from 21 test cases ran.
|
[0;32m[==========] [m52 tests from 22 test cases ran.
|
||||||
[0;32m[ PASSED ] [m19 tests.
|
[0;32m[ PASSED ] [m19 tests.
|
||||||
[0;31m[ FAILED ] [m29 tests, listed below:
|
[0;31m[ FAILED ] [m33 tests, listed below:
|
||||||
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine
|
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine
|
||||||
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInNestedSubroutine
|
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInNestedSubroutine
|
||||||
[0;31m[ FAILED ] [mFatalFailureTest.NonfatalFailureInSubroutine
|
[0;31m[ FAILED ] [mFatalFailureTest.NonfatalFailureInSubroutine
|
||||||
@ -427,8 +528,12 @@ Expected fatal failure.
|
|||||||
[0;31m[ FAILED ] [mTypedTest/0.Failure, where TypeParam = int
|
[0;31m[ FAILED ] [mTypedTest/0.Failure, where TypeParam = int
|
||||||
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
|
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
|
||||||
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
|
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
|
||||||
|
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailure
|
||||||
|
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailure
|
||||||
|
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
|
||||||
|
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailureOnAllThreads
|
||||||
|
|
||||||
29 FAILED TESTS
|
33 FAILED TESTS
|
||||||
The non-test part of the code is expected to have 2 failures.
|
The non-test part of the code is expected to have 2 failures.
|
||||||
|
|
||||||
gtest_output_test_.cc:#: Failure
|
gtest_output_test_.cc:#: Failure
|
||||||
|
@ -5,7 +5,7 @@ gtest_output_test_.cc:#: error: Value of: false
|
|||||||
Expected: true
|
Expected: true
|
||||||
gtest_output_test_.cc:#: error: Value of: 3
|
gtest_output_test_.cc:#: error: Value of: 3
|
||||||
Expected: 2
|
Expected: 2
|
||||||
[==========] Running 46 tests from 19 test cases.
|
[==========] Running 50 tests from 20 test cases.
|
||||||
[----------] Global test environment set-up.
|
[----------] Global test environment set-up.
|
||||||
FooEnvironment::SetUp() called.
|
FooEnvironment::SetUp() called.
|
||||||
BarEnvironment::SetUp() called.
|
BarEnvironment::SetUp() called.
|
||||||
@ -344,6 +344,95 @@ gtest_output_test_.cc:#: error: Value of: TypeParam()
|
|||||||
Expected: 1
|
Expected: 1
|
||||||
Expected failure
|
Expected failure
|
||||||
[ FAILED ] Unsigned/TypedTestP/1.Failure
|
[ FAILED ] Unsigned/TypedTestP/1.Failure
|
||||||
|
[----------] 4 tests from ExpectFailureTest
|
||||||
|
[ RUN ] ExpectFailureTest.ExpectFatalFailure
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Success:
|
||||||
|
Succeeded
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Non-fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected non-fatal failure.
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 fatal failure containing "Some other fatal failure expected."
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected fatal failure.
|
||||||
|
|
||||||
|
[ FAILED ] ExpectFailureTest.ExpectFatalFailure
|
||||||
|
[ RUN ] ExpectFailureTest.ExpectNonFatalFailure
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 non-fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Success:
|
||||||
|
Succeeded
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 non-fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected fatal failure.
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 non-fatal failure containing "Some other non-fatal failure."
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Non-fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected non-fatal failure.
|
||||||
|
|
||||||
|
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
|
||||||
|
[ RUN ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Success:
|
||||||
|
Succeeded
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Non-fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected non-fatal failure.
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 fatal failure containing "Some other fatal failure expected."
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected fatal failure.
|
||||||
|
|
||||||
|
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
|
||||||
|
[ RUN ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 non-fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Success:
|
||||||
|
Succeeded
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 non-fatal failure
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected fatal failure.
|
||||||
|
|
||||||
|
(expecting 1 failure)
|
||||||
|
gtest.cc:#: error: Expected: 1 non-fatal failure containing "Some other non-fatal failure."
|
||||||
|
Actual:
|
||||||
|
gtest_output_test_.cc:#: Non-fatal failure:
|
||||||
|
Failed
|
||||||
|
Expected non-fatal failure.
|
||||||
|
|
||||||
|
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
|
||||||
[----------] Global test environment tear-down
|
[----------] Global test environment tear-down
|
||||||
BarEnvironment::TearDown() called.
|
BarEnvironment::TearDown() called.
|
||||||
gtest_output_test_.cc:#: error: Failed
|
gtest_output_test_.cc:#: error: Failed
|
||||||
@ -351,9 +440,9 @@ Expected non-fatal failure.
|
|||||||
FooEnvironment::TearDown() called.
|
FooEnvironment::TearDown() called.
|
||||||
gtest_output_test_.cc:#: error: Failed
|
gtest_output_test_.cc:#: error: Failed
|
||||||
Expected fatal failure.
|
Expected fatal failure.
|
||||||
[==========] 46 tests from 19 test cases ran.
|
[==========] 50 tests from 20 test cases ran.
|
||||||
[ PASSED ] 14 tests.
|
[ PASSED ] 14 tests.
|
||||||
[ FAILED ] 32 tests, listed below:
|
[ FAILED ] 36 tests, listed below:
|
||||||
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
|
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
|
||||||
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
|
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
|
||||||
[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
|
[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
|
||||||
@ -386,8 +475,12 @@ Expected fatal failure.
|
|||||||
[ FAILED ] TypedTest/0.Failure, where TypeParam = int
|
[ FAILED ] TypedTest/0.Failure, where TypeParam = int
|
||||||
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
|
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
|
||||||
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
|
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
|
||||||
|
[ FAILED ] ExpectFailureTest.ExpectFatalFailure
|
||||||
|
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
|
||||||
|
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
|
||||||
|
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
|
||||||
|
|
||||||
32 FAILED TESTS
|
36 FAILED TESTS
|
||||||
The non-test part of the code is expected to have 2 failures.
|
The non-test part of the code is expected to have 2 failures.
|
||||||
|
|
||||||
gtest_output_test_.cc:#: error: Value of: false
|
gtest_output_test_.cc:#: error: Value of: false
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
// (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.
|
||||||
|
|
||||||
// This file is AUTOMATICALLY GENERATED on 06/11/2008 by command
|
// This file is AUTOMATICALLY GENERATED on 10/02/2008 by command
|
||||||
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
|
// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
|
||||||
|
|
||||||
// Regression test for gtest_pred_impl.h
|
// Regression test for gtest_pred_impl.h
|
||||||
|
@ -46,9 +46,9 @@
|
|||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
GTEST_DECLARE_string(death_test_style);
|
GTEST_DECLARE_string_(death_test_style);
|
||||||
GTEST_DECLARE_string(filter);
|
GTEST_DECLARE_string_(filter);
|
||||||
GTEST_DECLARE_int32(repeat);
|
GTEST_DECLARE_int32_(repeat);
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
57
test/gtest_sole_header_test.cc
Normal file
57
test/gtest_sole_header_test.cc
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright 2008, 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.
|
||||||
|
//
|
||||||
|
// Author: mheule@google.com (Markus Heule)
|
||||||
|
//
|
||||||
|
// This test verifies that it's possible to use Google Test by including
|
||||||
|
// the gtest.h header file alone.
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void Subroutine() {
|
||||||
|
EXPECT_EQ(42, 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(NoFatalFailureTest, ExpectNoFatalFailure) {
|
||||||
|
EXPECT_NO_FATAL_FAILURE(;);
|
||||||
|
EXPECT_NO_FATAL_FAILURE(SUCCEED());
|
||||||
|
EXPECT_NO_FATAL_FAILURE(Subroutine());
|
||||||
|
EXPECT_NO_FATAL_FAILURE({ SUCCEED(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(NoFatalFailureTest, AssertNoFatalFailure) {
|
||||||
|
ASSERT_NO_FATAL_FAILURE(;);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(SUCCEED());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(Subroutine());
|
||||||
|
ASSERT_NO_FATAL_FAILURE({ SUCCEED(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
@ -112,6 +112,36 @@ TEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) {
|
|||||||
// ManyAsserts() in many threads here.
|
// ManyAsserts() in many threads here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(NoFatalFailureTest, ExpectNoFatalFailureIgnoresFailuresInOtherThreads) {
|
||||||
|
// TODO(mheule@google.com): Test this works correctly when Google
|
||||||
|
// Test is made thread-safe.
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(NoFatalFailureTest, AssertNoFatalFailureIgnoresFailuresInOtherThreads) {
|
||||||
|
// TODO(mheule@google.com): Test this works correctly when Google
|
||||||
|
// Test is made thread-safe.
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(FatalFailureTest, ExpectFatalFailureIgnoresFailuresInOtherThreads) {
|
||||||
|
// TODO(mheule@google.com): Test this works correctly when Google
|
||||||
|
// Test is made thread-safe.
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(FatalFailureOnAllThreadsTest, ExpectFatalFailureOnAllThreads) {
|
||||||
|
// TODO(wan@google.com): Test this works correctly when Google Test
|
||||||
|
// is made thread-safe.
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(NonFatalFailureTest, ExpectNonFatalFailureIgnoresFailuresInOtherThreads) {
|
||||||
|
// TODO(mheule@google.com): Test this works correctly when Google
|
||||||
|
// Test is made thread-safe.
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(NonFatalFailureOnAllThreadsTest, ExpectNonFatalFailureOnAllThreads) {
|
||||||
|
// TODO(wan@google.com): Test this works correctly when Google Test
|
||||||
|
// is made thread-safe.
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
@ -46,11 +46,14 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if GTEST_HAS_PTHREAD
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif // GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
#ifdef GTEST_OS_LINUX
|
#ifdef GTEST_OS_LINUX
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <pthread.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -68,8 +71,8 @@ using testing::internal::ParseInt32Flag;
|
|||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
GTEST_DECLARE_string(output);
|
GTEST_DECLARE_string_(output);
|
||||||
GTEST_DECLARE_string(color);
|
GTEST_DECLARE_string_(color);
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
bool ShouldUseColor(bool stdout_is_tty);
|
bool ShouldUseColor(bool stdout_is_tty);
|
||||||
@ -114,6 +117,7 @@ using testing::internal::StreamableToString;
|
|||||||
using testing::internal::String;
|
using testing::internal::String;
|
||||||
using testing::internal::TestProperty;
|
using testing::internal::TestProperty;
|
||||||
using testing::internal::TestResult;
|
using testing::internal::TestResult;
|
||||||
|
using testing::internal::ThreadLocal;
|
||||||
using testing::internal::UnitTestImpl;
|
using testing::internal::UnitTestImpl;
|
||||||
using testing::internal::WideStringToUtf8;
|
using testing::internal::WideStringToUtf8;
|
||||||
|
|
||||||
@ -142,31 +146,31 @@ TEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) {
|
|||||||
EXPECT_STREQ("-3", FormatTimeInMillisAsSeconds(-3000));
|
EXPECT_STREQ("-3", FormatTimeInMillisAsSeconds(-3000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __SYMBIAN32__
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
// NULL testing does not work with Symbian compilers.
|
// NULL testing does not work with Symbian compilers.
|
||||||
|
|
||||||
// Tests that GTEST_IS_NULL_LITERAL(x) is true when x is a null
|
// Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null
|
||||||
// pointer literal.
|
// pointer literal.
|
||||||
TEST(NullLiteralTest, IsTrueForNullLiterals) {
|
TEST(NullLiteralTest, IsTrueForNullLiterals) {
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(NULL));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(NULL));
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(0));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0));
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(1 - 1));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(1 - 1));
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(0U));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U));
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(0L));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L));
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(false));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(false));
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL(true && false));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(true && false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that GTEST_IS_NULL_LITERAL(x) is false when x is not a null
|
// Tests that GTEST_IS_NULL_LITERAL_(x) is false when x is not a null
|
||||||
// pointer literal.
|
// pointer literal.
|
||||||
TEST(NullLiteralTest, IsFalseForNonNullLiterals) {
|
TEST(NullLiteralTest, IsFalseForNonNullLiterals) {
|
||||||
EXPECT_FALSE(GTEST_IS_NULL_LITERAL(1));
|
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(1));
|
||||||
EXPECT_FALSE(GTEST_IS_NULL_LITERAL(0.0));
|
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(0.0));
|
||||||
EXPECT_FALSE(GTEST_IS_NULL_LITERAL('a'));
|
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_('a'));
|
||||||
EXPECT_FALSE(GTEST_IS_NULL_LITERAL(static_cast<void*>(NULL)));
|
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(NULL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __SYMBIAN32__
|
#endif // GTEST_OS_SYMBIAN
|
||||||
//
|
//
|
||||||
// Tests CodePointToUtf8().
|
// Tests CodePointToUtf8().
|
||||||
|
|
||||||
@ -662,120 +666,31 @@ TEST(TestPropertyTest, ReplaceStringValue) {
|
|||||||
EXPECT_STREQ("2", property.value());
|
EXPECT_STREQ("2", property.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests the TestPartResult class.
|
class ScopedFakeTestPartResultReporterTest : public Test {
|
||||||
|
|
||||||
// The test fixture for testing TestPartResult.
|
|
||||||
class TestPartResultTest : public Test {
|
|
||||||
protected:
|
protected:
|
||||||
TestPartResultTest()
|
enum FailureMode {
|
||||||
: r1_(TPRT_SUCCESS, "foo/bar.cc", 10, "Success!"),
|
FATAL_FAILURE,
|
||||||
r2_(TPRT_NONFATAL_FAILURE, "foo/bar.cc", -1, "Failure!"),
|
NONFATAL_FAILURE
|
||||||
r3_(TPRT_FATAL_FAILURE, NULL, -1, "Failure!") {}
|
};
|
||||||
|
static void AddFailure(FailureMode failure) {
|
||||||
TestPartResult r1_, r2_, r3_;
|
if (failure == FATAL_FAILURE) {
|
||||||
};
|
|
||||||
|
|
||||||
// Tests TestPartResult::type()
|
|
||||||
TEST_F(TestPartResultTest, type) {
|
|
||||||
EXPECT_EQ(TPRT_SUCCESS, r1_.type());
|
|
||||||
EXPECT_EQ(TPRT_NONFATAL_FAILURE, r2_.type());
|
|
||||||
EXPECT_EQ(TPRT_FATAL_FAILURE, r3_.type());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests TestPartResult::file_name()
|
|
||||||
TEST_F(TestPartResultTest, file_name) {
|
|
||||||
EXPECT_STREQ("foo/bar.cc", r1_.file_name());
|
|
||||||
EXPECT_STREQ(NULL, r3_.file_name());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests TestPartResult::line_number()
|
|
||||||
TEST_F(TestPartResultTest, line_number) {
|
|
||||||
EXPECT_EQ(10, r1_.line_number());
|
|
||||||
EXPECT_EQ(-1, r2_.line_number());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests TestPartResult::message()
|
|
||||||
TEST_F(TestPartResultTest, message) {
|
|
||||||
EXPECT_STREQ("Success!", r1_.message());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests TestPartResult::passed()
|
|
||||||
TEST_F(TestPartResultTest, Passed) {
|
|
||||||
EXPECT_TRUE(r1_.passed());
|
|
||||||
EXPECT_FALSE(r2_.passed());
|
|
||||||
EXPECT_FALSE(r3_.passed());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests TestPartResult::failed()
|
|
||||||
TEST_F(TestPartResultTest, Failed) {
|
|
||||||
EXPECT_FALSE(r1_.failed());
|
|
||||||
EXPECT_TRUE(r2_.failed());
|
|
||||||
EXPECT_TRUE(r3_.failed());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests TestPartResult::fatally_failed()
|
|
||||||
TEST_F(TestPartResultTest, FatallyFailed) {
|
|
||||||
EXPECT_FALSE(r1_.fatally_failed());
|
|
||||||
EXPECT_FALSE(r2_.fatally_failed());
|
|
||||||
EXPECT_TRUE(r3_.fatally_failed());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests TestPartResult::nonfatally_failed()
|
|
||||||
TEST_F(TestPartResultTest, NonfatallyFailed) {
|
|
||||||
EXPECT_FALSE(r1_.nonfatally_failed());
|
|
||||||
EXPECT_TRUE(r2_.nonfatally_failed());
|
|
||||||
EXPECT_FALSE(r3_.nonfatally_failed());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests the TestPartResultArray class.
|
|
||||||
|
|
||||||
class TestPartResultArrayTest : public Test {
|
|
||||||
protected:
|
|
||||||
TestPartResultArrayTest()
|
|
||||||
: r1_(TPRT_NONFATAL_FAILURE, "foo/bar.cc", -1, "Failure 1"),
|
|
||||||
r2_(TPRT_FATAL_FAILURE, "foo/bar.cc", -1, "Failure 2") {}
|
|
||||||
|
|
||||||
const TestPartResult r1_, r2_;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Tests that TestPartResultArray initially has size 0.
|
|
||||||
TEST_F(TestPartResultArrayTest, InitialSizeIsZero) {
|
|
||||||
TestPartResultArray results;
|
|
||||||
EXPECT_EQ(0, results.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests that TestPartResultArray contains the given TestPartResult
|
|
||||||
// after one Append() operation.
|
|
||||||
TEST_F(TestPartResultArrayTest, ContainsGivenResultAfterAppend) {
|
|
||||||
TestPartResultArray results;
|
|
||||||
results.Append(r1_);
|
|
||||||
EXPECT_EQ(1, results.size());
|
|
||||||
EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests that TestPartResultArray contains the given TestPartResults
|
|
||||||
// after two Append() operations.
|
|
||||||
TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
|
|
||||||
TestPartResultArray results;
|
|
||||||
results.Append(r1_);
|
|
||||||
results.Append(r2_);
|
|
||||||
EXPECT_EQ(2, results.size());
|
|
||||||
EXPECT_STREQ("Failure 1", results.GetTestPartResult(0).message());
|
|
||||||
EXPECT_STREQ("Failure 2", results.GetTestPartResult(1).message());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScopedFakeTestPartResultReporterTestHelper() {
|
|
||||||
FAIL() << "Expected fatal failure.";
|
FAIL() << "Expected fatal failure.";
|
||||||
}
|
} else {
|
||||||
|
ADD_FAILURE() << "Expected non-fatal failure.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Tests that ScopedFakeTestPartResultReporter intercepts test
|
// Tests that ScopedFakeTestPartResultReporter intercepts test
|
||||||
// failures.
|
// failures.
|
||||||
TEST(ScopedFakeTestPartResultReporterTest, InterceptsTestFailures) {
|
TEST_F(ScopedFakeTestPartResultReporterTest, InterceptsTestFailures) {
|
||||||
TestPartResultArray results;
|
TestPartResultArray results;
|
||||||
{
|
{
|
||||||
ScopedFakeTestPartResultReporter reporter(&results);
|
ScopedFakeTestPartResultReporter reporter(
|
||||||
ADD_FAILURE() << "Expected non-fatal failure.";
|
ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,
|
||||||
ScopedFakeTestPartResultReporterTestHelper();
|
&results);
|
||||||
|
AddFailure(NONFATAL_FAILURE);
|
||||||
|
AddFailure(FATAL_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(2, results.size());
|
EXPECT_EQ(2, results.size());
|
||||||
@ -783,6 +698,128 @@ TEST(ScopedFakeTestPartResultReporterTest, InterceptsTestFailures) {
|
|||||||
EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());
|
EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ScopedFakeTestPartResultReporterTest, DeprecatedConstructor) {
|
||||||
|
TestPartResultArray results;
|
||||||
|
{
|
||||||
|
// Tests, that the deprecated constructor still works.
|
||||||
|
ScopedFakeTestPartResultReporter reporter(&results);
|
||||||
|
AddFailure(NONFATAL_FAILURE);
|
||||||
|
}
|
||||||
|
EXPECT_EQ(1, results.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
#if GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
|
class ScopedFakeTestPartResultReporterWithThreadsTest
|
||||||
|
: public ScopedFakeTestPartResultReporterTest {
|
||||||
|
protected:
|
||||||
|
static void AddFailureInOtherThread(FailureMode failure) {
|
||||||
|
pthread_t tid;
|
||||||
|
pthread_create(&tid,
|
||||||
|
NULL,
|
||||||
|
ScopedFakeTestPartResultReporterWithThreadsTest::
|
||||||
|
FailureThread,
|
||||||
|
&failure);
|
||||||
|
pthread_join(tid, NULL);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
static void* FailureThread(void* attr) {
|
||||||
|
FailureMode* failure = static_cast<FailureMode*>(attr);
|
||||||
|
AddFailure(*failure);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(ScopedFakeTestPartResultReporterWithThreadsTest,
|
||||||
|
InterceptsTestFailuresInAllThreads) {
|
||||||
|
TestPartResultArray results;
|
||||||
|
{
|
||||||
|
ScopedFakeTestPartResultReporter reporter(
|
||||||
|
ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, &results);
|
||||||
|
AddFailure(NONFATAL_FAILURE);
|
||||||
|
AddFailure(FATAL_FAILURE);
|
||||||
|
AddFailureInOtherThread(NONFATAL_FAILURE);
|
||||||
|
AddFailureInOtherThread(FATAL_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_EQ(4, results.size());
|
||||||
|
EXPECT_TRUE(results.GetTestPartResult(0).nonfatally_failed());
|
||||||
|
EXPECT_TRUE(results.GetTestPartResult(1).fatally_failed());
|
||||||
|
EXPECT_TRUE(results.GetTestPartResult(2).nonfatally_failed());
|
||||||
|
EXPECT_TRUE(results.GetTestPartResult(3).fatally_failed());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
|
// Tests EXPECT_{,NON}FATAL_FAILURE{,ON_ALL_THREADS}.
|
||||||
|
|
||||||
|
typedef ScopedFakeTestPartResultReporterTest ExpectFailureTest;
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, ExpectFatalFaliure) {
|
||||||
|
EXPECT_FATAL_FAILURE(AddFailure(FATAL_FAILURE), "Expected fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
|
||||||
|
EXPECT_NONFATAL_FAILURE(AddFailure(NONFATAL_FAILURE),
|
||||||
|
"Expected non-fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, ExpectFatalFailureOnAllThreads) {
|
||||||
|
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(FATAL_FAILURE),
|
||||||
|
"Expected fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
|
||||||
|
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
|
||||||
|
"Expected non-fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests that the EXPECT_{,NON}FATAL_FAILURE{,_ON_ALL_THREADS} accepts
|
||||||
|
// a statement that contains a macro which expands to code containing
|
||||||
|
// an unprotected comma.
|
||||||
|
|
||||||
|
static int global_var = 0;
|
||||||
|
#define GTEST_USE_UNPROTECTED_COMMA_ global_var++, global_var++
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureTest, AcceptsMacroThatExpandsToUnprotectedComma) {
|
||||||
|
EXPECT_FATAL_FAILURE({
|
||||||
|
GTEST_USE_UNPROTECTED_COMMA_;
|
||||||
|
AddFailure(FATAL_FAILURE);
|
||||||
|
}, "");
|
||||||
|
|
||||||
|
EXPECT_FATAL_FAILURE_ON_ALL_THREADS({
|
||||||
|
GTEST_USE_UNPROTECTED_COMMA_;
|
||||||
|
AddFailure(FATAL_FAILURE);
|
||||||
|
}, "");
|
||||||
|
|
||||||
|
EXPECT_NONFATAL_FAILURE({
|
||||||
|
GTEST_USE_UNPROTECTED_COMMA_;
|
||||||
|
AddFailure(NONFATAL_FAILURE);
|
||||||
|
}, "");
|
||||||
|
|
||||||
|
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS({
|
||||||
|
GTEST_USE_UNPROTECTED_COMMA_;
|
||||||
|
AddFailure(NONFATAL_FAILURE);
|
||||||
|
}, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
|
typedef ScopedFakeTestPartResultReporterWithThreadsTest
|
||||||
|
ExpectFailureWithThreadsTest;
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailureOnAllThreads) {
|
||||||
|
EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailureInOtherThread(FATAL_FAILURE),
|
||||||
|
"Expected fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailureOnAllThreads) {
|
||||||
|
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(
|
||||||
|
AddFailureInOtherThread(NONFATAL_FAILURE), "Expected non-fatal failure.");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GTEST_IS_THREADSAFE && GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
// Tests the TestResult class
|
// Tests the TestResult class
|
||||||
|
|
||||||
// The test fixture for testing TestResult.
|
// The test fixture for testing TestResult.
|
||||||
@ -1875,6 +1912,8 @@ TEST_F(FloatTest, LargeDiff) {
|
|||||||
TEST_F(FloatTest, Infinity) {
|
TEST_F(FloatTest, Infinity) {
|
||||||
EXPECT_FLOAT_EQ(infinity_, close_to_infinity_);
|
EXPECT_FLOAT_EQ(infinity_, close_to_infinity_);
|
||||||
EXPECT_FLOAT_EQ(-infinity_, -close_to_infinity_);
|
EXPECT_FLOAT_EQ(-infinity_, -close_to_infinity_);
|
||||||
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
|
// Nokia's STLport crashes if we try to output infinity or NaN.
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(infinity_, -infinity_),
|
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(infinity_, -infinity_),
|
||||||
"-infinity_");
|
"-infinity_");
|
||||||
|
|
||||||
@ -1882,10 +1921,13 @@ TEST_F(FloatTest, Infinity) {
|
|||||||
// are only 1 DLP apart.
|
// are only 1 DLP apart.
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(infinity_, nan1_),
|
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(infinity_, nan1_),
|
||||||
"nan1_");
|
"nan1_");
|
||||||
|
#endif // ! GTEST_OS_SYMBIAN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that comparing with NAN always returns false.
|
// Tests that comparing with NAN always returns false.
|
||||||
TEST_F(FloatTest, NaN) {
|
TEST_F(FloatTest, NaN) {
|
||||||
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
|
// Nokia's STLport crashes if we try to output infinity or NaN.
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(nan1_, nan1_),
|
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(nan1_, nan1_),
|
||||||
"nan1_");
|
"nan1_");
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(nan1_, nan2_),
|
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(nan1_, nan2_),
|
||||||
@ -1895,6 +1937,7 @@ TEST_F(FloatTest, NaN) {
|
|||||||
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(nan1_, infinity_),
|
EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(nan1_, infinity_),
|
||||||
"infinity_");
|
"infinity_");
|
||||||
|
#endif // ! GTEST_OS_SYMBIAN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that *_FLOAT_EQ are reflexive.
|
// Tests that *_FLOAT_EQ are reflexive.
|
||||||
@ -1956,6 +1999,8 @@ TEST_F(FloatTest, FloatLEFails) {
|
|||||||
EXPECT_PRED_FORMAT2(FloatLE, further_from_one_, 1.0f);
|
EXPECT_PRED_FORMAT2(FloatLE, further_from_one_, 1.0f);
|
||||||
}, "(further_from_one_) <= (1.0f)");
|
}, "(further_from_one_) <= (1.0f)");
|
||||||
|
|
||||||
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
|
// Nokia's STLport crashes if we try to output infinity or NaN.
|
||||||
// or when either val1 or val2 is NaN.
|
// or when either val1 or val2 is NaN.
|
||||||
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
||||||
EXPECT_PRED_FORMAT2(FloatLE, nan1_, infinity_);
|
EXPECT_PRED_FORMAT2(FloatLE, nan1_, infinity_);
|
||||||
@ -1967,6 +2012,7 @@ TEST_F(FloatTest, FloatLEFails) {
|
|||||||
EXPECT_FATAL_FAILURE({ // NOLINT
|
EXPECT_FATAL_FAILURE({ // NOLINT
|
||||||
ASSERT_PRED_FORMAT2(FloatLE, nan1_, nan1_);
|
ASSERT_PRED_FORMAT2(FloatLE, nan1_, nan1_);
|
||||||
}, "(nan1_) <= (nan1_)");
|
}, "(nan1_) <= (nan1_)");
|
||||||
|
#endif // ! GTEST_OS_SYMBIAN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiates FloatingPointTest for testing *_DOUBLE_EQ.
|
// Instantiates FloatingPointTest for testing *_DOUBLE_EQ.
|
||||||
@ -2021,6 +2067,8 @@ TEST_F(DoubleTest, LargeDiff) {
|
|||||||
TEST_F(DoubleTest, Infinity) {
|
TEST_F(DoubleTest, Infinity) {
|
||||||
EXPECT_DOUBLE_EQ(infinity_, close_to_infinity_);
|
EXPECT_DOUBLE_EQ(infinity_, close_to_infinity_);
|
||||||
EXPECT_DOUBLE_EQ(-infinity_, -close_to_infinity_);
|
EXPECT_DOUBLE_EQ(-infinity_, -close_to_infinity_);
|
||||||
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
|
// Nokia's STLport crashes if we try to output infinity or NaN.
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(infinity_, -infinity_),
|
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(infinity_, -infinity_),
|
||||||
"-infinity_");
|
"-infinity_");
|
||||||
|
|
||||||
@ -2028,22 +2076,29 @@ TEST_F(DoubleTest, Infinity) {
|
|||||||
// are only 1 DLP apart.
|
// are only 1 DLP apart.
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(infinity_, nan1_),
|
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(infinity_, nan1_),
|
||||||
"nan1_");
|
"nan1_");
|
||||||
|
#endif // ! GTEST_OS_SYMBIAN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that comparing with NAN always returns false.
|
// Tests that comparing with NAN always returns false.
|
||||||
TEST_F(DoubleTest, NaN) {
|
TEST_F(DoubleTest, NaN) {
|
||||||
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
|
// Nokia's STLport crashes if we try to output infinity or NaN.
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(nan1_, nan1_),
|
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(nan1_, nan1_),
|
||||||
"nan1_");
|
"nan1_");
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(nan1_, nan2_), "nan2_");
|
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(nan1_, nan2_), "nan2_");
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1.0, nan1_), "nan1_");
|
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1.0, nan1_), "nan1_");
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_DOUBLE_EQ(nan1_, infinity_), "infinity_");
|
EXPECT_FATAL_FAILURE(ASSERT_DOUBLE_EQ(nan1_, infinity_), "infinity_");
|
||||||
|
#endif // ! GTEST_OS_SYMBIAN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that *_DOUBLE_EQ are reflexive.
|
// Tests that *_DOUBLE_EQ are reflexive.
|
||||||
TEST_F(DoubleTest, Reflexive) {
|
TEST_F(DoubleTest, Reflexive) {
|
||||||
EXPECT_DOUBLE_EQ(0.0, 0.0);
|
EXPECT_DOUBLE_EQ(0.0, 0.0);
|
||||||
EXPECT_DOUBLE_EQ(1.0, 1.0);
|
EXPECT_DOUBLE_EQ(1.0, 1.0);
|
||||||
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
|
// Nokia's STLport crashes if we try to output infinity or NaN.
|
||||||
ASSERT_DOUBLE_EQ(infinity_, infinity_);
|
ASSERT_DOUBLE_EQ(infinity_, infinity_);
|
||||||
|
#endif // ! GTEST_OS_SYMBIAN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that *_DOUBLE_EQ are commutative.
|
// Tests that *_DOUBLE_EQ are commutative.
|
||||||
@ -2059,38 +2114,22 @@ TEST_F(DoubleTest, Commutative) {
|
|||||||
TEST_F(DoubleTest, EXPECT_NEAR) {
|
TEST_F(DoubleTest, EXPECT_NEAR) {
|
||||||
EXPECT_NEAR(-1.0, -1.1, 0.2);
|
EXPECT_NEAR(-1.0, -1.1, 0.2);
|
||||||
EXPECT_NEAR(2.0, 3.0, 1.0);
|
EXPECT_NEAR(2.0, 3.0, 1.0);
|
||||||
#ifdef __SYMBIAN32__
|
|
||||||
// Symbian STLport has currently a buggy floating point output.
|
|
||||||
// TODO(mikie): fix STLport.
|
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0, 1.2, 0.1), // NOLINT
|
|
||||||
"The difference between 1.0 and 1.2 is 0.19999:, "
|
|
||||||
"which exceeds 0.1");
|
|
||||||
#else // !__SYMBIAN32__
|
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0, 1.2, 0.1), // NOLINT
|
EXPECT_NONFATAL_FAILURE(EXPECT_NEAR(1.0, 1.2, 0.1), // NOLINT
|
||||||
"The difference between 1.0 and 1.2 is 0.2, "
|
"The difference between 1.0 and 1.2 is 0.2, "
|
||||||
"which exceeds 0.1");
|
"which exceeds 0.1");
|
||||||
// To work around a bug in gcc 2.95.0, there is intentionally no
|
// To work around a bug in gcc 2.95.0, there is intentionally no
|
||||||
// space after the first comma in the previous statement.
|
// space after the first comma in the previous statement.
|
||||||
#endif // __SYMBIAN32__
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests ASSERT_NEAR.
|
// Tests ASSERT_NEAR.
|
||||||
TEST_F(DoubleTest, ASSERT_NEAR) {
|
TEST_F(DoubleTest, ASSERT_NEAR) {
|
||||||
ASSERT_NEAR(-1.0, -1.1, 0.2);
|
ASSERT_NEAR(-1.0, -1.1, 0.2);
|
||||||
ASSERT_NEAR(2.0, 3.0, 1.0);
|
ASSERT_NEAR(2.0, 3.0, 1.0);
|
||||||
#ifdef __SYMBIAN32__
|
|
||||||
// Symbian STLport has currently a buggy floating point output.
|
|
||||||
// TODO(mikie): fix STLport.
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0, 1.2, 0.1), // NOLINT
|
|
||||||
"The difference between 1.0 and 1.2 is 0.19999:, "
|
|
||||||
"which exceeds 0.1");
|
|
||||||
#else // ! __SYMBIAN32__
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0, 1.2, 0.1), // NOLINT
|
EXPECT_FATAL_FAILURE(ASSERT_NEAR(1.0, 1.2, 0.1), // NOLINT
|
||||||
"The difference between 1.0 and 1.2 is 0.2, "
|
"The difference between 1.0 and 1.2 is 0.2, "
|
||||||
"which exceeds 0.1");
|
"which exceeds 0.1");
|
||||||
// To work around a bug in gcc 2.95.0, there is intentionally no
|
// To work around a bug in gcc 2.95.0, there is intentionally no
|
||||||
// space after the first comma in the previous statement.
|
// space after the first comma in the previous statement.
|
||||||
#endif // __SYMBIAN32__
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests the cases where DoubleLE() should succeed.
|
// Tests the cases where DoubleLE() should succeed.
|
||||||
@ -2113,6 +2152,8 @@ TEST_F(DoubleTest, DoubleLEFails) {
|
|||||||
EXPECT_PRED_FORMAT2(DoubleLE, further_from_one_, 1.0);
|
EXPECT_PRED_FORMAT2(DoubleLE, further_from_one_, 1.0);
|
||||||
}, "(further_from_one_) <= (1.0)");
|
}, "(further_from_one_) <= (1.0)");
|
||||||
|
|
||||||
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
|
// Nokia's STLport crashes if we try to output infinity or NaN.
|
||||||
// or when either val1 or val2 is NaN.
|
// or when either val1 or val2 is NaN.
|
||||||
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
||||||
EXPECT_PRED_FORMAT2(DoubleLE, nan1_, infinity_);
|
EXPECT_PRED_FORMAT2(DoubleLE, nan1_, infinity_);
|
||||||
@ -2123,6 +2164,7 @@ TEST_F(DoubleTest, DoubleLEFails) {
|
|||||||
EXPECT_FATAL_FAILURE({ // NOLINT
|
EXPECT_FATAL_FAILURE({ // NOLINT
|
||||||
ASSERT_PRED_FORMAT2(DoubleLE, nan1_, nan1_);
|
ASSERT_PRED_FORMAT2(DoubleLE, nan1_, nan1_);
|
||||||
}, "(nan1_) <= (nan1_)");
|
}, "(nan1_) <= (nan1_)");
|
||||||
|
#endif // ! GTEST_OS_SYMBIAN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2389,6 +2431,97 @@ TEST_F(SingleEvaluationTest, ExceptionTests) {
|
|||||||
|
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
#endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
|
// Tests {ASSERT|EXPECT}_NO_FATAL_FAILURE.
|
||||||
|
class NoFatalFailureTest : public Test {
|
||||||
|
protected:
|
||||||
|
void Succeeds() {}
|
||||||
|
void FailsNonFatal() {
|
||||||
|
ADD_FAILURE() << "some non-fatal failure";
|
||||||
|
}
|
||||||
|
void Fails() {
|
||||||
|
FAIL() << "some fatal failure";
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoAssertNoFatalFailureOnFails() {
|
||||||
|
ASSERT_NO_FATAL_FAILURE(Fails());
|
||||||
|
ADD_FAILURE() << "shold not reach here.";
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoExpectNoFatalFailureOnFails() {
|
||||||
|
EXPECT_NO_FATAL_FAILURE(Fails());
|
||||||
|
ADD_FAILURE() << "other failure";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(NoFatalFailureTest, NoFailure) {
|
||||||
|
EXPECT_NO_FATAL_FAILURE(Succeeds());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(Succeeds());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(NoFatalFailureTest, NonFatalIsNoFailure) {
|
||||||
|
EXPECT_NONFATAL_FAILURE(
|
||||||
|
EXPECT_NO_FATAL_FAILURE(FailsNonFatal()),
|
||||||
|
"some non-fatal failure");
|
||||||
|
EXPECT_NONFATAL_FAILURE(
|
||||||
|
ASSERT_NO_FATAL_FAILURE(FailsNonFatal()),
|
||||||
|
"some non-fatal failure");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(NoFatalFailureTest, AssertNoFatalFailureOnFatalFailure) {
|
||||||
|
TestPartResultArray gtest_failures;
|
||||||
|
{
|
||||||
|
ScopedFakeTestPartResultReporter gtest_reporter(>est_failures);
|
||||||
|
DoAssertNoFatalFailureOnFails();
|
||||||
|
}
|
||||||
|
ASSERT_EQ(2, gtest_failures.size());
|
||||||
|
EXPECT_EQ(testing::TPRT_FATAL_FAILURE,
|
||||||
|
gtest_failures.GetTestPartResult(0).type());
|
||||||
|
EXPECT_EQ(testing::TPRT_FATAL_FAILURE,
|
||||||
|
gtest_failures.GetTestPartResult(1).type());
|
||||||
|
EXPECT_PRED_FORMAT2(testing::IsSubstring, "some fatal failure",
|
||||||
|
gtest_failures.GetTestPartResult(0).message());
|
||||||
|
EXPECT_PRED_FORMAT2(testing::IsSubstring, "it does",
|
||||||
|
gtest_failures.GetTestPartResult(1).message());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(NoFatalFailureTest, ExpectNoFatalFailureOnFatalFailure) {
|
||||||
|
TestPartResultArray gtest_failures;
|
||||||
|
{
|
||||||
|
ScopedFakeTestPartResultReporter gtest_reporter(>est_failures);
|
||||||
|
DoExpectNoFatalFailureOnFails();
|
||||||
|
}
|
||||||
|
ASSERT_EQ(3, gtest_failures.size());
|
||||||
|
EXPECT_EQ(testing::TPRT_FATAL_FAILURE,
|
||||||
|
gtest_failures.GetTestPartResult(0).type());
|
||||||
|
EXPECT_EQ(testing::TPRT_NONFATAL_FAILURE,
|
||||||
|
gtest_failures.GetTestPartResult(1).type());
|
||||||
|
EXPECT_EQ(testing::TPRT_NONFATAL_FAILURE,
|
||||||
|
gtest_failures.GetTestPartResult(2).type());
|
||||||
|
EXPECT_PRED_FORMAT2(testing::IsSubstring, "some fatal failure",
|
||||||
|
gtest_failures.GetTestPartResult(0).message());
|
||||||
|
EXPECT_PRED_FORMAT2(testing::IsSubstring, "it does",
|
||||||
|
gtest_failures.GetTestPartResult(1).message());
|
||||||
|
EXPECT_PRED_FORMAT2(testing::IsSubstring, "other failure",
|
||||||
|
gtest_failures.GetTestPartResult(2).message());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(NoFatalFailureTest, MessageIsStreamable) {
|
||||||
|
TestPartResultArray gtest_failures;
|
||||||
|
{
|
||||||
|
ScopedFakeTestPartResultReporter gtest_reporter(>est_failures);
|
||||||
|
EXPECT_NO_FATAL_FAILURE(FAIL() << "foo") << "my message";
|
||||||
|
}
|
||||||
|
ASSERT_EQ(2, gtest_failures.size());
|
||||||
|
EXPECT_EQ(testing::TPRT_NONFATAL_FAILURE,
|
||||||
|
gtest_failures.GetTestPartResult(0).type());
|
||||||
|
EXPECT_EQ(testing::TPRT_NONFATAL_FAILURE,
|
||||||
|
gtest_failures.GetTestPartResult(1).type());
|
||||||
|
EXPECT_PRED_FORMAT2(testing::IsSubstring, "foo",
|
||||||
|
gtest_failures.GetTestPartResult(0).message());
|
||||||
|
EXPECT_PRED_FORMAT2(testing::IsSubstring, "my message",
|
||||||
|
gtest_failures.GetTestPartResult(1).message());
|
||||||
|
}
|
||||||
|
|
||||||
// Tests non-string assertions.
|
// Tests non-string assertions.
|
||||||
|
|
||||||
// Tests EqFailure(), used for implementing *EQ* assertions.
|
// Tests EqFailure(), used for implementing *EQ* assertions.
|
||||||
@ -2492,7 +2625,7 @@ TEST(AssertionTest, ASSERT_EQ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tests ASSERT_EQ(NULL, pointer).
|
// Tests ASSERT_EQ(NULL, pointer).
|
||||||
#ifndef __SYMBIAN32__
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
// The NULL-detection template magic fails to compile with
|
// The NULL-detection template magic fails to compile with
|
||||||
// the Nokia compiler and crashes the ARM compiler, hence
|
// the Nokia compiler and crashes the ARM compiler, hence
|
||||||
// not testing on Symbian.
|
// not testing on Symbian.
|
||||||
@ -2506,7 +2639,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) {
|
|||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),
|
||||||
"Value of: &n\n");
|
"Value of: &n\n");
|
||||||
}
|
}
|
||||||
#endif // __SYMBIAN32__
|
#endif // GTEST_OS_SYMBIAN
|
||||||
|
|
||||||
// Tests ASSERT_EQ(0, non_pointer). Since the literal 0 can be
|
// Tests ASSERT_EQ(0, non_pointer). Since the literal 0 can be
|
||||||
// treated as a null pointer by the compiler, we need to make sure
|
// treated as a null pointer by the compiler, we need to make sure
|
||||||
@ -2807,7 +2940,7 @@ TEST(HRESULTAssertionTest, Streaming) {
|
|||||||
#endif // defined(GTEST_OS_WINDOWS)
|
#endif // defined(GTEST_OS_WINDOWS)
|
||||||
|
|
||||||
// Tests that the assertion macros behave like single statements.
|
// Tests that the assertion macros behave like single statements.
|
||||||
TEST(AssertionSyntaxTest, BehavesLikeSingleStatement) {
|
TEST(AssertionSyntaxTest, BasicAssertionsBehavesLikeSingleStatement) {
|
||||||
if (false)
|
if (false)
|
||||||
ASSERT_TRUE(false) << "This should never be executed; "
|
ASSERT_TRUE(false) << "This should never be executed; "
|
||||||
"It's a compilation test only.";
|
"It's a compilation test only.";
|
||||||
@ -2824,8 +2957,10 @@ TEST(AssertionSyntaxTest, BehavesLikeSingleStatement) {
|
|||||||
;
|
;
|
||||||
else
|
else
|
||||||
EXPECT_GT(3, 2) << "";
|
EXPECT_GT(3, 2) << "";
|
||||||
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_EXCEPTIONS
|
#if GTEST_HAS_EXCEPTIONS
|
||||||
|
TEST(AssertionSyntaxTest, ExceptionAssertionsBehavesLikeSingleStatement) {
|
||||||
if (false)
|
if (false)
|
||||||
EXPECT_THROW(1, bool);
|
EXPECT_THROW(1, bool);
|
||||||
|
|
||||||
@ -2849,7 +2984,30 @@ TEST(AssertionSyntaxTest, BehavesLikeSingleStatement) {
|
|||||||
EXPECT_ANY_THROW(ThrowAnInteger());
|
EXPECT_ANY_THROW(ThrowAnInteger());
|
||||||
else
|
else
|
||||||
;
|
;
|
||||||
|
}
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
#endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
|
TEST(AssertionSyntaxTest, NoFatalFailureAssertionsBehavesLikeSingleStatement) {
|
||||||
|
if (false)
|
||||||
|
EXPECT_NO_FATAL_FAILURE(FAIL()) << "This should never be executed. "
|
||||||
|
<< "It's a compilation test only.";
|
||||||
|
else
|
||||||
|
;
|
||||||
|
|
||||||
|
if (false)
|
||||||
|
ASSERT_NO_FATAL_FAILURE(FAIL()) << "";
|
||||||
|
else
|
||||||
|
;
|
||||||
|
|
||||||
|
if (true)
|
||||||
|
EXPECT_NO_FATAL_FAILURE(SUCCEED());
|
||||||
|
else
|
||||||
|
;
|
||||||
|
|
||||||
|
if (false)
|
||||||
|
;
|
||||||
|
else
|
||||||
|
ASSERT_NO_FATAL_FAILURE(SUCCEED());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that the assertion macros work well with switch statements.
|
// Tests that the assertion macros work well with switch statements.
|
||||||
@ -2984,7 +3142,7 @@ TEST(ExpectTest, EXPECT_EQ_Double) {
|
|||||||
"5.1");
|
"5.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __SYMBIAN32__
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
// Tests EXPECT_EQ(NULL, pointer).
|
// Tests EXPECT_EQ(NULL, pointer).
|
||||||
TEST(ExpectTest, EXPECT_EQ_NULL) {
|
TEST(ExpectTest, EXPECT_EQ_NULL) {
|
||||||
// A success.
|
// A success.
|
||||||
@ -2996,7 +3154,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) {
|
|||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
|
||||||
"Value of: &n\n");
|
"Value of: &n\n");
|
||||||
}
|
}
|
||||||
#endif // __SYMBIAN32__
|
#endif // GTEST_OS_SYMBIAN
|
||||||
|
|
||||||
// Tests EXPECT_EQ(0, non_pointer). Since the literal 0 can be
|
// Tests EXPECT_EQ(0, non_pointer). Since the literal 0 can be
|
||||||
// treated as a null pointer by the compiler, we need to make sure
|
// treated as a null pointer by the compiler, we need to make sure
|
||||||
@ -4739,7 +4897,24 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
|
|||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __SYMBIAN32__
|
TEST(ThreadLocalTest, DefaultConstructor) {
|
||||||
|
ThreadLocal<int> t1;
|
||||||
|
EXPECT_EQ(0, t1.get());
|
||||||
|
|
||||||
|
ThreadLocal<void*> t2;
|
||||||
|
EXPECT_TRUE(t2.get() == NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(ThreadLocalTest, Init) {
|
||||||
|
ThreadLocal<int> t1(123);
|
||||||
|
EXPECT_EQ(123, t1.get());
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
ThreadLocal<int*> t2(&i);
|
||||||
|
EXPECT_EQ(&i, t2.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef GTEST_OS_SYMBIAN
|
||||||
// We will want to integrate running the unittests to a different
|
// We will want to integrate running the unittests to a different
|
||||||
// main application on Symbian.
|
// main application on Symbian.
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
@ -4756,4 +4931,4 @@ int main(int argc, char** argv) {
|
|||||||
// Runs all tests using Google Test.
|
// Runs all tests using Google Test.
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
#endif // __SYMBIAN32_
|
#endif // GTEST_OS_SYMBIAN
|
||||||
|
@ -24,7 +24,9 @@ test_executables=("$BUILT_PRODUCTS_DIR/sample1_unittest"
|
|||||||
"$BUILT_PRODUCTS_DIR/gtest_main_unittest"
|
"$BUILT_PRODUCTS_DIR/gtest_main_unittest"
|
||||||
"$BUILT_PRODUCTS_DIR/gtest_prod_test"
|
"$BUILT_PRODUCTS_DIR/gtest_prod_test"
|
||||||
"$BUILT_PRODUCTS_DIR/gtest_repeat_test"
|
"$BUILT_PRODUCTS_DIR/gtest_repeat_test"
|
||||||
|
"$BUILT_PRODUCTS_DIR/gtest_sole_header_test"
|
||||||
"$BUILT_PRODUCTS_DIR/gtest_stress_test"
|
"$BUILT_PRODUCTS_DIR/gtest_stress_test"
|
||||||
|
"$BUILT_PRODUCTS_DIR/gtest_test_part_test"
|
||||||
"$BUILT_PRODUCTS_DIR/gtest-typed-test_test"
|
"$BUILT_PRODUCTS_DIR/gtest-typed-test_test"
|
||||||
|
|
||||||
"$BUILT_PRODUCTS_DIR/gtest_output_test.py"
|
"$BUILT_PRODUCTS_DIR/gtest_output_test.py"
|
||||||
@ -41,6 +43,7 @@ test_executables=("$BUILT_PRODUCTS_DIR/sample1_unittest"
|
|||||||
# Now execute each one in turn keeping track of how many succeeded and failed.
|
# Now execute each one in turn keeping track of how many succeeded and failed.
|
||||||
succeeded=0
|
succeeded=0
|
||||||
failed=0
|
failed=0
|
||||||
|
failed_list=()
|
||||||
for test in ${test_executables[*]}; do
|
for test in ${test_executables[*]}; do
|
||||||
"$test"
|
"$test"
|
||||||
result=$?
|
result=$?
|
||||||
@ -48,9 +51,14 @@ for test in ${test_executables[*]}; do
|
|||||||
succeeded=$(( $succeeded + 1 ))
|
succeeded=$(( $succeeded + 1 ))
|
||||||
else
|
else
|
||||||
failed=$(( failed + 1 ))
|
failed=$(( failed + 1 ))
|
||||||
|
failed_list="$failed_list $test"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Report the successes and failures to the console
|
# Report the successes and failures to the console
|
||||||
echo "Tests complete with $succeeded successes and $failed failures."
|
echo "Tests complete with $succeeded successes and $failed failures."
|
||||||
|
if [ $failed -ne 0 ]; then
|
||||||
|
echo "The following tests failed:"
|
||||||
|
echo $failed_list
|
||||||
|
fi
|
||||||
exit $failed
|
exit $failed
|
||||||
|
@ -38,7 +38,9 @@
|
|||||||
3B238F8F0E828B7100846E11 /* PBXTargetDependency */,
|
3B238F8F0E828B7100846E11 /* PBXTargetDependency */,
|
||||||
3B238F910E828B7100846E11 /* PBXTargetDependency */,
|
3B238F910E828B7100846E11 /* PBXTargetDependency */,
|
||||||
3B238F930E828B7100846E11 /* PBXTargetDependency */,
|
3B238F930E828B7100846E11 /* PBXTargetDependency */,
|
||||||
|
22C44F370E9EB800004F2913 /* PBXTargetDependency */,
|
||||||
3B238F950E828B7100846E11 /* PBXTargetDependency */,
|
3B238F950E828B7100846E11 /* PBXTargetDependency */,
|
||||||
|
22C44F390E9EB808004F2913 /* PBXTargetDependency */,
|
||||||
3B238F970E828B7100846E11 /* PBXTargetDependency */,
|
3B238F970E828B7100846E11 /* PBXTargetDependency */,
|
||||||
3B238F990E828B7100846E11 /* PBXTargetDependency */,
|
3B238F990E828B7100846E11 /* PBXTargetDependency */,
|
||||||
3B238F9B0E828B7100846E11 /* PBXTargetDependency */,
|
3B238F9B0E828B7100846E11 /* PBXTargetDependency */,
|
||||||
@ -74,6 +76,11 @@
|
|||||||
/* End PBXAggregateTarget section */
|
/* End PBXAggregateTarget section */
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
222ECC950E9EB33A00BEED94 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B87D22D0E96C038000D1852 /* gtest.framework */; };
|
||||||
|
222ECCA60E9EB47B00BEED94 /* gtest-test-part_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0E0E7FE13C00846E11 /* gtest-test-part_test.cc */; };
|
||||||
|
222ECCA80E9EB47B00BEED94 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B87D22D0E96C038000D1852 /* gtest.framework */; };
|
||||||
|
224A12A00E9EAD8F00BD17FD /* gtest-test-part.cc in Sources */ = {isa = PBXBuildFile; fileRef = 224A129F0E9EAD8F00BD17FD /* gtest-test-part.cc */; };
|
||||||
|
224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */ = {isa = PBXBuildFile; fileRef = 224A12A20E9EADCC00BD17FD /* gtest-test-part.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
22A865FD0E70A35700F7AE6E /* gtest-typed-test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 22A865FC0E70A35700F7AE6E /* gtest-typed-test.cc */; };
|
22A865FD0E70A35700F7AE6E /* gtest-typed-test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 22A865FC0E70A35700F7AE6E /* gtest-typed-test.cc */; };
|
||||||
22A866190E70A41000F7AE6E /* sample6_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 22A866180E70A41000F7AE6E /* sample6_unittest.cc */; };
|
22A866190E70A41000F7AE6E /* sample6_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 22A866180E70A41000F7AE6E /* sample6_unittest.cc */; };
|
||||||
3B238D1D0E8283EA00846E11 /* gtest-death-test_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238BF10E7FE13B00846E11 /* gtest-death-test_test.cc */; };
|
3B238D1D0E8283EA00846E11 /* gtest-death-test_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238BF10E7FE13B00846E11 /* gtest-death-test_test.cc */; };
|
||||||
@ -94,7 +101,6 @@
|
|||||||
3B238F500E828B0000846E11 /* gtest_pred_impl_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */; };
|
3B238F500E828B0000846E11 /* gtest_pred_impl_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */; };
|
||||||
3B238F510E828B0400846E11 /* gtest_prod_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */; };
|
3B238F510E828B0400846E11 /* gtest_prod_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */; };
|
||||||
3B238F520E828B0800846E11 /* gtest_repeat_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */; };
|
3B238F520E828B0800846E11 /* gtest_repeat_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */; };
|
||||||
3B238F530E828B0D00846E11 /* gtest_stress_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C0E0E7FE13C00846E11 /* gtest_stress_test.cc */; };
|
|
||||||
3B238F540E828B1700846E11 /* gtest_uninitialized_test_.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */; };
|
3B238F540E828B1700846E11 /* gtest_uninitialized_test_.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */; };
|
||||||
3B238F550E828B1F00846E11 /* gtest_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */; };
|
3B238F550E828B1F00846E11 /* gtest_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C120E7FE13C00846E11 /* gtest_unittest.cc */; };
|
||||||
3B238F560E828B2400846E11 /* gtest_xml_outfile1_test_.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C130E7FE13C00846E11 /* gtest_xml_outfile1_test_.cc */; };
|
3B238F560E828B2400846E11 /* gtest_xml_outfile1_test_.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238C130E7FE13C00846E11 /* gtest_xml_outfile1_test_.cc */; };
|
||||||
@ -163,8 +169,6 @@
|
|||||||
4048860C0E2F840E00CF7658 /* sample5_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 404884030E2F799B00CF7658 /* sample5_unittest.cc */; };
|
4048860C0E2F840E00CF7658 /* sample5_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 404884030E2F799B00CF7658 /* sample5_unittest.cc */; };
|
||||||
404886140E2F849100CF7658 /* sample1.cc in Sources */ = {isa = PBXBuildFile; fileRef = 404883F80E2F799B00CF7658 /* sample1.cc */; };
|
404886140E2F849100CF7658 /* sample1.cc in Sources */ = {isa = PBXBuildFile; fileRef = 404883F80E2F799B00CF7658 /* sample1.cc */; };
|
||||||
406B542C0E9CD54B0041F37C /* gtest_xml_outfiles_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C150E7FE13C00846E11 /* gtest_xml_outfiles_test.py */; };
|
406B542C0E9CD54B0041F37C /* gtest_xml_outfiles_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C150E7FE13C00846E11 /* gtest_xml_outfiles_test.py */; };
|
||||||
408453E00E96CE0800AC66C2 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 408453CD0E96CE0700AC66C2 /* gtest.framework */; };
|
|
||||||
408453E20E96CE0800AC66C2 /* gtest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 408453CD0E96CE0700AC66C2 /* gtest.framework */; };
|
|
||||||
4084541B0E96D2A100AC66C2 /* gtest_break_on_failure_unittest.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238BF80E7FE13B00846E11 /* gtest_break_on_failure_unittest.py */; };
|
4084541B0E96D2A100AC66C2 /* gtest_break_on_failure_unittest.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238BF80E7FE13B00846E11 /* gtest_break_on_failure_unittest.py */; };
|
||||||
408454350E96D3F600AC66C2 /* gtest_test_utils.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */; };
|
408454350E96D3F600AC66C2 /* gtest_test_utils.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */; };
|
||||||
408454740E96DBC300AC66C2 /* gtest_output_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C070E7FE13B00846E11 /* gtest_output_test.py */; };
|
408454740E96DBC300AC66C2 /* gtest_output_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C070E7FE13B00846E11 /* gtest_output_test.py */; };
|
||||||
@ -178,9 +182,25 @@
|
|||||||
4084548A0E96DD8200AC66C2 /* gtest_nc_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C050E7FE13B00846E11 /* gtest_nc_test.py */; };
|
4084548A0E96DD8200AC66C2 /* gtest_nc_test.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C050E7FE13B00846E11 /* gtest_nc_test.py */; };
|
||||||
4084548F0E97066B00AC66C2 /* gtest_xml_test_utils.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C180E7FE13C00846E11 /* gtest_xml_test_utils.py */; };
|
4084548F0E97066B00AC66C2 /* gtest_xml_test_utils.py in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3B238C180E7FE13C00846E11 /* gtest_xml_test_utils.py */; };
|
||||||
408454BC0E97098200AC66C2 /* gtest-typed-test2_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238BF50E7FE13B00846E11 /* gtest-typed-test2_test.cc */; };
|
408454BC0E97098200AC66C2 /* gtest-typed-test2_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3B238BF50E7FE13B00846E11 /* gtest-typed-test2_test.cc */; };
|
||||||
|
40D2095B0E9FFBE500191629 /* gtest_sole_header_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 40D209590E9FFBAA00191629 /* gtest_sole_header_test.cc */; };
|
||||||
|
40D2095C0E9FFC0700191629 /* gtest_stress_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 40D2095A0E9FFBAA00191629 /* gtest_stress_test.cc */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
222ECC910E9EB33A00BEED94 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
|
||||||
|
remoteInfo = gtest;
|
||||||
|
};
|
||||||
|
222ECCA40E9EB47B00BEED94 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
|
||||||
|
remoteInfo = gtest;
|
||||||
|
};
|
||||||
22A866030E70A39900F7AE6E /* PBXContainerItemProxy */ = {
|
22A866030E70A39900F7AE6E /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
@ -188,6 +208,20 @@
|
|||||||
remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
|
remoteGlobalIDString = 8D07F2BC0486CC7A007CD1D0;
|
||||||
remoteInfo = gtest;
|
remoteInfo = gtest;
|
||||||
};
|
};
|
||||||
|
22C44F360E9EB800004F2913 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 222ECC8F0E9EB33A00BEED94;
|
||||||
|
remoteInfo = gtest_sole_header_test;
|
||||||
|
};
|
||||||
|
22C44F380E9EB808004F2913 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 222ECCA20E9EB47B00BEED94;
|
||||||
|
remoteInfo = gtest_test_part_test;
|
||||||
|
};
|
||||||
3B238C980E81B92000846E11 /* PBXContainerItemProxy */ = {
|
3B238C980E81B92000846E11 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
@ -605,14 +639,14 @@
|
|||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
proxyType = 1;
|
proxyType = 1;
|
||||||
remoteGlobalIDString = 3B238E920E82894A00846E11 /* gtest_no_test_unittest */;
|
remoteGlobalIDString = 3B238E920E82894A00846E11;
|
||||||
remoteInfo = gtest_no_test_unittest;
|
remoteInfo = gtest_no_test_unittest;
|
||||||
};
|
};
|
||||||
406B54280E9CD4D70041F37C /* PBXContainerItemProxy */ = {
|
406B54280E9CD4D70041F37C /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
proxyType = 1;
|
proxyType = 1;
|
||||||
remoteGlobalIDString = 3B238F0A0E828A3800846E11 /* gtest_xml_outfile1_test_ */;
|
remoteGlobalIDString = 3B238F0A0E828A3800846E11;
|
||||||
remoteInfo = gtest_xml_outfile1_test_;
|
remoteInfo = gtest_xml_outfile1_test_;
|
||||||
};
|
};
|
||||||
408454360E96D40600AC66C2 /* PBXContainerItemProxy */ = {
|
408454360E96D40600AC66C2 /* PBXContainerItemProxy */ = {
|
||||||
@ -833,6 +867,11 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
222ECC990E9EB33A00BEED94 /* gtest_sole_header_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = gtest_sole_header_test; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
222ECCAC0E9EB47B00BEED94 /* gtest_test_part_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = gtest_test_part_test; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
224A129F0E9EAD8F00BD17FD /* gtest-test-part.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-test-part.cc"; sourceTree = "<group>"; };
|
||||||
|
224A12A10E9EADA700BD17FD /* gtest-all.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-all.cc"; sourceTree = "<group>"; };
|
||||||
|
224A12A20E9EADCC00BD17FD /* gtest-test-part.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "gtest-test-part.h"; sourceTree = "<group>"; };
|
||||||
22A865FC0E70A35700F7AE6E /* gtest-typed-test.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-typed-test.cc"; sourceTree = "<group>"; };
|
22A865FC0E70A35700F7AE6E /* gtest-typed-test.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-typed-test.cc"; sourceTree = "<group>"; };
|
||||||
22A866180E70A41000F7AE6E /* sample6_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = sample6_unittest.cc; sourceTree = "<group>"; };
|
22A866180E70A41000F7AE6E /* sample6_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = sample6_unittest.cc; sourceTree = "<group>"; };
|
||||||
3B238BF10E7FE13B00846E11 /* gtest-death-test_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-death-test_test.cc"; sourceTree = "<group>"; };
|
3B238BF10E7FE13B00846E11 /* gtest-death-test_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-death-test_test.cc"; sourceTree = "<group>"; };
|
||||||
@ -864,7 +903,7 @@
|
|||||||
3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_pred_impl_unittest.cc; sourceTree = "<group>"; };
|
3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_pred_impl_unittest.cc; sourceTree = "<group>"; };
|
||||||
3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_prod_test.cc; sourceTree = "<group>"; };
|
3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_prod_test.cc; sourceTree = "<group>"; };
|
||||||
3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_repeat_test.cc; sourceTree = "<group>"; };
|
3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_repeat_test.cc; sourceTree = "<group>"; };
|
||||||
3B238C0E0E7FE13C00846E11 /* gtest_stress_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_stress_test.cc; sourceTree = "<group>"; };
|
3B238C0E0E7FE13C00846E11 /* gtest-test-part_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "gtest-test-part_test.cc"; sourceTree = "<group>"; };
|
||||||
3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = gtest_test_utils.py; sourceTree = "<group>"; };
|
3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = gtest_test_utils.py; sourceTree = "<group>"; };
|
||||||
3B238C100E7FE13C00846E11 /* gtest_uninitialized_test.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = gtest_uninitialized_test.py; sourceTree = "<group>"; };
|
3B238C100E7FE13C00846E11 /* gtest_uninitialized_test.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = gtest_uninitialized_test.py; sourceTree = "<group>"; };
|
||||||
3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_uninitialized_test_.cc; sourceTree = "<group>"; };
|
3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_uninitialized_test_.cc; sourceTree = "<group>"; };
|
||||||
@ -947,7 +986,9 @@
|
|||||||
404884A90E2F7CD900CF7658 /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CHANGES; path = ../CHANGES; sourceTree = SOURCE_ROOT; };
|
404884A90E2F7CD900CF7658 /* CHANGES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CHANGES; path = ../CHANGES; sourceTree = SOURCE_ROOT; };
|
||||||
404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CONTRIBUTORS; path = ../CONTRIBUTORS; sourceTree = SOURCE_ROOT; };
|
404884AA0E2F7CD900CF7658 /* CONTRIBUTORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CONTRIBUTORS; path = ../CONTRIBUTORS; sourceTree = SOURCE_ROOT; };
|
||||||
404884AB0E2F7CD900CF7658 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../COPYING; sourceTree = SOURCE_ROOT; };
|
404884AB0E2F7CD900CF7658 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../COPYING; sourceTree = SOURCE_ROOT; };
|
||||||
408453CD0E96CE0700AC66C2 /* gtest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = gtest.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
408453CD0E96CE0700AC66C2 /* gtest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = gtest.framework; path = /Volumes/Work/Repository/perforce/gtest/src/depot/branches/open_gtest_branch/google3/third_party/gtest/xcode/build/Debug/gtest.framework; sourceTree = "<absolute>"; };
|
||||||
|
40D209590E9FFBAA00191629 /* gtest_sole_header_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_sole_header_test.cc; sourceTree = "<group>"; };
|
||||||
|
40D2095A0E9FFBAA00191629 /* gtest_stress_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gtest_stress_test.cc; sourceTree = "<group>"; };
|
||||||
40D4CDF10E30E07400294801 /* DebugProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugProject.xcconfig; sourceTree = "<group>"; };
|
40D4CDF10E30E07400294801 /* DebugProject.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugProject.xcconfig; sourceTree = "<group>"; };
|
||||||
40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FrameworkTarget.xcconfig; sourceTree = "<group>"; };
|
40D4CDF20E30E07400294801 /* FrameworkTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FrameworkTarget.xcconfig; sourceTree = "<group>"; };
|
||||||
40D4CDF30E30E07400294801 /* General.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = General.xcconfig; sourceTree = "<group>"; };
|
40D4CDF30E30E07400294801 /* General.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = General.xcconfig; sourceTree = "<group>"; };
|
||||||
@ -956,6 +997,22 @@
|
|||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
222ECC940E9EB33A00BEED94 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
222ECC950E9EB33A00BEED94 /* gtest.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
222ECCA70E9EB47B00BEED94 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
222ECCA80E9EB47B00BEED94 /* gtest.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
22A866070E70A39900F7AE6E /* Frameworks */ = {
|
22A866070E70A39900F7AE6E /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@ -1057,7 +1114,6 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
3B87D25E0E96C038000D1852 /* gtest.framework in Frameworks */,
|
3B87D25E0E96C038000D1852 /* gtest.framework in Frameworks */,
|
||||||
408453E00E96CE0800AC66C2 /* gtest.framework in Frameworks */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -1074,7 +1130,6 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
3B87D2580E96C038000D1852 /* gtest.framework in Frameworks */,
|
3B87D2580E96C038000D1852 /* gtest.framework in Frameworks */,
|
||||||
408453E20E96CE0800AC66C2 /* gtest.framework in Frameworks */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -1209,12 +1264,16 @@
|
|||||||
3B87D2320E96C038000D1852 /* sample3_unittest */,
|
3B87D2320E96C038000D1852 /* sample3_unittest */,
|
||||||
3B87D2350E96C038000D1852 /* sample2_unittest */,
|
3B87D2350E96C038000D1852 /* sample2_unittest */,
|
||||||
3B87D2380E96C038000D1852 /* sample4_unittest */,
|
3B87D2380E96C038000D1852 /* sample4_unittest */,
|
||||||
|
3B87D2800E96C039000D1852 /* sample5_unittest */,
|
||||||
|
3B87D2830E96C039000D1852 /* sample6_unittest */,
|
||||||
3B87D23B0E96C038000D1852 /* gtest_xml_output_unittest_ */,
|
3B87D23B0E96C038000D1852 /* gtest_xml_output_unittest_ */,
|
||||||
3B87D23E0E96C038000D1852 /* gtest_xml_outfile2_test_ */,
|
3B87D23E0E96C038000D1852 /* gtest_xml_outfile2_test_ */,
|
||||||
3B87D2410E96C038000D1852 /* gtest_xml_outfile1_test_ */,
|
3B87D2410E96C038000D1852 /* gtest_xml_outfile1_test_ */,
|
||||||
3B87D2440E96C038000D1852 /* gtest_unittest */,
|
3B87D2440E96C038000D1852 /* gtest_unittest */,
|
||||||
3B87D2470E96C038000D1852 /* gtest_uninitialized_test_ */,
|
3B87D2470E96C038000D1852 /* gtest_uninitialized_test_ */,
|
||||||
|
222ECC990E9EB33A00BEED94 /* gtest_sole_header_test */,
|
||||||
3B87D24A0E96C038000D1852 /* gtest_stress_test */,
|
3B87D24A0E96C038000D1852 /* gtest_stress_test */,
|
||||||
|
222ECCAC0E9EB47B00BEED94 /* gtest_test_part_test */,
|
||||||
3B87D24D0E96C038000D1852 /* gtest_repeat_test */,
|
3B87D24D0E96C038000D1852 /* gtest_repeat_test */,
|
||||||
3B87D2500E96C038000D1852 /* gtest_prod_test */,
|
3B87D2500E96C038000D1852 /* gtest_prod_test */,
|
||||||
3B87D2530E96C038000D1852 /* gtest_pred_impl_unittest */,
|
3B87D2530E96C038000D1852 /* gtest_pred_impl_unittest */,
|
||||||
@ -1231,11 +1290,8 @@
|
|||||||
3B87D2740E96C039000D1852 /* gtest-typed-test_test */,
|
3B87D2740E96C039000D1852 /* gtest-typed-test_test */,
|
||||||
3B87D27A0E96C039000D1852 /* gtest-options_test */,
|
3B87D27A0E96C039000D1852 /* gtest-options_test */,
|
||||||
3B87D27D0E96C039000D1852 /* gtest-message_test */,
|
3B87D27D0E96C039000D1852 /* gtest-message_test */,
|
||||||
3B87D2800E96C039000D1852 /* sample5_unittest */,
|
|
||||||
3B87D2830E96C039000D1852 /* sample6_unittest */,
|
|
||||||
3B87D2860E96C039000D1852 /* gtest-death-test_test */,
|
3B87D2860E96C039000D1852 /* gtest-death-test_test */,
|
||||||
3B87D2890E96C039000D1852 /* gtest-filepath_test */,
|
3B87D2890E96C039000D1852 /* gtest-filepath_test */,
|
||||||
408453CD0E96CE0700AC66C2 /* gtest.framework */,
|
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1299,7 +1355,9 @@
|
|||||||
3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */,
|
3B238C0B0E7FE13B00846E11 /* gtest_pred_impl_unittest.cc */,
|
||||||
3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */,
|
3B238C0C0E7FE13C00846E11 /* gtest_prod_test.cc */,
|
||||||
3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */,
|
3B238C0D0E7FE13C00846E11 /* gtest_repeat_test.cc */,
|
||||||
3B238C0E0E7FE13C00846E11 /* gtest_stress_test.cc */,
|
40D209590E9FFBAA00191629 /* gtest_sole_header_test.cc */,
|
||||||
|
40D2095A0E9FFBAA00191629 /* gtest_stress_test.cc */,
|
||||||
|
3B238C0E0E7FE13C00846E11 /* gtest-test-part_test.cc */,
|
||||||
3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */,
|
3B238C0F0E7FE13C00846E11 /* gtest_test_utils.py */,
|
||||||
3B238C100E7FE13C00846E11 /* gtest_uninitialized_test.py */,
|
3B238C100E7FE13C00846E11 /* gtest_uninitialized_test.py */,
|
||||||
3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */,
|
3B238C110E7FE13C00846E11 /* gtest_uninitialized_test_.cc */,
|
||||||
@ -1338,6 +1396,7 @@
|
|||||||
404883DA0E2F799B00CF7658 /* gtest */ = {
|
404883DA0E2F799B00CF7658 /* gtest */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
224A12A20E9EADCC00BD17FD /* gtest-test-part.h */,
|
||||||
404883DB0E2F799B00CF7658 /* gtest-death-test.h */,
|
404883DB0E2F799B00CF7658 /* gtest-death-test.h */,
|
||||||
404883DC0E2F799B00CF7658 /* gtest-message.h */,
|
404883DC0E2F799B00CF7658 /* gtest-message.h */,
|
||||||
404883DD0E2F799B00CF7658 /* gtest-spi.h */,
|
404883DD0E2F799B00CF7658 /* gtest-spi.h */,
|
||||||
@ -1387,6 +1446,8 @@
|
|||||||
404884070E2F799B00CF7658 /* src */ = {
|
404884070E2F799B00CF7658 /* src */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
224A12A10E9EADA700BD17FD /* gtest-all.cc */,
|
||||||
|
224A129F0E9EAD8F00BD17FD /* gtest-test-part.cc */,
|
||||||
404884080E2F799B00CF7658 /* gtest-death-test.cc */,
|
404884080E2F799B00CF7658 /* gtest-death-test.cc */,
|
||||||
404884090E2F799B00CF7658 /* gtest-filepath.cc */,
|
404884090E2F799B00CF7658 /* gtest-filepath.cc */,
|
||||||
4048840A0E2F799B00CF7658 /* gtest-internal-inl.h */,
|
4048840A0E2F799B00CF7658 /* gtest-internal-inl.h */,
|
||||||
@ -1434,12 +1495,47 @@
|
|||||||
4048843B0E2F799B00CF7658 /* gtest.h in Headers */,
|
4048843B0E2F799B00CF7658 /* gtest.h in Headers */,
|
||||||
4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */,
|
4048843C0E2F799B00CF7658 /* gtest_pred_impl.h in Headers */,
|
||||||
4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */,
|
4048843D0E2F799B00CF7658 /* gtest_prod.h in Headers */,
|
||||||
|
224A12A30E9EADCC00BD17FD /* gtest-test-part.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXHeadersBuildPhase section */
|
/* End PBXHeadersBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
|
222ECC8F0E9EB33A00BEED94 /* gtest_sole_header_test */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 222ECC960E9EB33A00BEED94 /* Build configuration list for PBXNativeTarget "gtest_sole_header_test" */;
|
||||||
|
buildPhases = (
|
||||||
|
222ECC920E9EB33A00BEED94 /* Sources */,
|
||||||
|
222ECC940E9EB33A00BEED94 /* Frameworks */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
222ECC900E9EB33A00BEED94 /* PBXTargetDependency */,
|
||||||
|
);
|
||||||
|
name = gtest_sole_header_test;
|
||||||
|
productName = TypedTest2;
|
||||||
|
productReference = 222ECC990E9EB33A00BEED94 /* gtest_sole_header_test */;
|
||||||
|
productType = "com.apple.product-type.tool";
|
||||||
|
};
|
||||||
|
222ECCA20E9EB47B00BEED94 /* gtest_test_part_test */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 222ECCA90E9EB47B00BEED94 /* Build configuration list for PBXNativeTarget "gtest_test_part_test" */;
|
||||||
|
buildPhases = (
|
||||||
|
222ECCA50E9EB47B00BEED94 /* Sources */,
|
||||||
|
222ECCA70E9EB47B00BEED94 /* Frameworks */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
222ECCA30E9EB47B00BEED94 /* PBXTargetDependency */,
|
||||||
|
);
|
||||||
|
name = gtest_test_part_test;
|
||||||
|
productName = TypedTest2;
|
||||||
|
productReference = 222ECCAC0E9EB47B00BEED94 /* gtest_test_part_test */;
|
||||||
|
productType = "com.apple.product-type.tool";
|
||||||
|
};
|
||||||
22A866010E70A39900F7AE6E /* sample6_unittest */ = {
|
22A866010E70A39900F7AE6E /* sample6_unittest */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 22A866090E70A39900F7AE6E /* Build configuration list for PBXNativeTarget "sample6_unittest" */;
|
buildConfigurationList = 22A866090E70A39900F7AE6E /* Build configuration list for PBXNativeTarget "sample6_unittest" */;
|
||||||
@ -2033,7 +2129,9 @@
|
|||||||
3B238E7A0E82894300846E11 /* gtest_main_unittest */,
|
3B238E7A0E82894300846E11 /* gtest_main_unittest */,
|
||||||
3B238EC30E8289C100846E11 /* gtest_prod_test */,
|
3B238EC30E8289C100846E11 /* gtest_prod_test */,
|
||||||
3B238ECE0E8289C300846E11 /* gtest_repeat_test */,
|
3B238ECE0E8289C300846E11 /* gtest_repeat_test */,
|
||||||
|
222ECC8F0E9EB33A00BEED94 /* gtest_sole_header_test */,
|
||||||
3B238EDB0E8289C700846E11 /* gtest_stress_test */,
|
3B238EDB0E8289C700846E11 /* gtest_stress_test */,
|
||||||
|
222ECCA20E9EB47B00BEED94 /* gtest_test_part_test */,
|
||||||
3B238E0F0E82887E00846E11 /* gtest-typed-test_test */,
|
3B238E0F0E82887E00846E11 /* gtest-typed-test_test */,
|
||||||
3B238E9F0E82894D00846E11 /* gtest_output_test_ */,
|
3B238E9F0E82894D00846E11 /* gtest_output_test_ */,
|
||||||
3B238E270E82888800846E11 /* gtest_color_test_ */,
|
3B238E270E82888800846E11 /* gtest_color_test_ */,
|
||||||
@ -2110,6 +2208,22 @@
|
|||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
222ECC920E9EB33A00BEED94 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
40D2095B0E9FFBE500191629 /* gtest_sole_header_test.cc in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
222ECCA50E9EB47B00BEED94 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
222ECCA60E9EB47B00BEED94 /* gtest-test-part_test.cc in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
22A866040E70A39900F7AE6E /* Sources */ = {
|
22A866040E70A39900F7AE6E /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@ -2268,7 +2382,7 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
3B238F530E828B0D00846E11 /* gtest_stress_test.cc in Sources */,
|
40D2095C0E9FFC0700191629 /* gtest_stress_test.cc in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -2366,17 +2480,38 @@
|
|||||||
404884630E2F799B00CF7658 /* gtest.cc in Sources */,
|
404884630E2F799B00CF7658 /* gtest.cc in Sources */,
|
||||||
404884640E2F799B00CF7658 /* gtest_main.cc in Sources */,
|
404884640E2F799B00CF7658 /* gtest_main.cc in Sources */,
|
||||||
22A865FD0E70A35700F7AE6E /* gtest-typed-test.cc in Sources */,
|
22A865FD0E70A35700F7AE6E /* gtest-typed-test.cc in Sources */,
|
||||||
|
224A12A00E9EAD8F00BD17FD /* gtest-test-part.cc in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXTargetDependency section */
|
/* Begin PBXTargetDependency section */
|
||||||
|
222ECC900E9EB33A00BEED94 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
|
||||||
|
targetProxy = 222ECC910E9EB33A00BEED94 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
|
222ECCA30E9EB47B00BEED94 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
|
||||||
|
targetProxy = 222ECCA40E9EB47B00BEED94 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
22A866020E70A39900F7AE6E /* PBXTargetDependency */ = {
|
22A866020E70A39900F7AE6E /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
|
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
|
||||||
targetProxy = 22A866030E70A39900F7AE6E /* PBXContainerItemProxy */;
|
targetProxy = 22A866030E70A39900F7AE6E /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
22C44F370E9EB800004F2913 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 222ECC8F0E9EB33A00BEED94 /* gtest_sole_header_test */;
|
||||||
|
targetProxy = 22C44F360E9EB800004F2913 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
|
22C44F390E9EB808004F2913 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 222ECCA20E9EB47B00BEED94 /* gtest_test_part_test */;
|
||||||
|
targetProxy = 22C44F380E9EB808004F2913 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
3B238C990E81B92000846E11 /* PBXTargetDependency */ = {
|
3B238C990E81B92000846E11 /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
|
target = 8D07F2BC0486CC7A007CD1D0 /* gtest */;
|
||||||
@ -2745,6 +2880,62 @@
|
|||||||
/* End PBXTargetDependency section */
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
/* Begin XCBuildConfiguration section */
|
||||||
|
222ECC970E9EB33A00BEED94 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 3B238D190E82837D00846E11 /* InternalTestTarget.xcconfig */;
|
||||||
|
buildSettings = {
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
|
||||||
|
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
|
||||||
|
);
|
||||||
|
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Debug\"";
|
||||||
|
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/build/Debug\"";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
222ECC980E9EB33A00BEED94 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 3B238D190E82837D00846E11 /* InternalTestTarget.xcconfig */;
|
||||||
|
buildSettings = {
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
|
||||||
|
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
|
||||||
|
);
|
||||||
|
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Debug\"";
|
||||||
|
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/build/Debug\"";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
222ECCAA0E9EB47B00BEED94 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 3B238D190E82837D00846E11 /* InternalTestTarget.xcconfig */;
|
||||||
|
buildSettings = {
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
|
||||||
|
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
|
||||||
|
);
|
||||||
|
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Debug\"";
|
||||||
|
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/build/Debug\"";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
222ECCAB0E9EB47B00BEED94 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 3B238D190E82837D00846E11 /* InternalTestTarget.xcconfig */;
|
||||||
|
buildSettings = {
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
|
||||||
|
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
|
||||||
|
);
|
||||||
|
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Debug\"";
|
||||||
|
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/build/Debug\"";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
22A8660A0E70A39900F7AE6E /* Debug */ = {
|
22A8660A0E70A39900F7AE6E /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = 3B23903C0E830EA800846E11 /* TestTarget.xcconfig */;
|
baseConfigurationReference = 3B23903C0E830EA800846E11 /* TestTarget.xcconfig */;
|
||||||
@ -3689,6 +3880,24 @@
|
|||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
|
222ECC960E9EB33A00BEED94 /* Build configuration list for PBXNativeTarget "gtest_sole_header_test" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
222ECC970E9EB33A00BEED94 /* Debug */,
|
||||||
|
222ECC980E9EB33A00BEED94 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
222ECCA90E9EB47B00BEED94 /* Build configuration list for PBXNativeTarget "gtest_test_part_test" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
222ECCAA0E9EB47B00BEED94 /* Debug */,
|
||||||
|
222ECCAB0E9EB47B00BEED94 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
22A866090E70A39900F7AE6E /* Build configuration list for PBXNativeTarget "sample6_unittest" */ = {
|
22A866090E70A39900F7AE6E /* Build configuration list for PBXNativeTarget "sample6_unittest" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user