diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-06-02 22:02:11 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-06-02 22:02:11 +0000 |
commit | 190f8ee25a6977ac6eb71b816498df42f17ad9a7 (patch) | |
tree | 658b8c02fce43448931b29c311631a0fda983ed6 /utils/unittest/googletest/include/gtest/gtest-test-part.h | |
parent | e4b9c93fc1b531fe0cfe25a042f6b81c1e7c15c0 (diff) | |
download | external_llvm-190f8ee25a6977ac6eb71b816498df42f17ad9a7.zip external_llvm-190f8ee25a6977ac6eb71b816498df42f17ad9a7.tar.gz external_llvm-190f8ee25a6977ac6eb71b816498df42f17ad9a7.tar.bz2 |
Merge gtest-1.4.0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/unittest/googletest/include/gtest/gtest-test-part.h')
-rw-r--r-- | utils/unittest/googletest/include/gtest/gtest-test-part.h | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/utils/unittest/googletest/include/gtest/gtest-test-part.h b/utils/unittest/googletest/include/gtest/gtest-test-part.h index 1a281af..58e7df9 100644 --- a/utils/unittest/googletest/include/gtest/gtest-test-part.h +++ b/utils/unittest/googletest/include/gtest/gtest-test-part.h @@ -39,24 +39,24 @@ 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: + // The possible outcomes of a test part (i.e. an assertion or an + // explicit SUCCEED(), FAIL(), or ADD_FAILURE()). + enum Type { + kSuccess, // Succeeded. + kNonFatalFailure, // Failed but the test can continue. + kFatalFailure // Failed and the test should be terminated. + }; + // C'tor. TestPartResult does NOT have a default constructor. // Always use this constructor (with parameters) to create a // TestPartResult object. - TestPartResult(TestPartResultType type, + TestPartResult(Type type, const char* file_name, int line_number, const char* message) @@ -68,7 +68,7 @@ class TestPartResult { } // Gets the outcome of the test part. - TestPartResultType type() const { return type_; } + Type type() const { return type_; } // Gets the name of the source file where the test part took place, or // NULL if it's unknown. @@ -85,18 +85,18 @@ class TestPartResult { const char* message() const { return message_.c_str(); } // Returns true iff the test part passed. - bool passed() const { return type_ == TPRT_SUCCESS; } + bool passed() const { return type_ == kSuccess; } // Returns true iff the test part failed. - bool failed() const { return type_ != TPRT_SUCCESS; } + bool failed() const { return type_ != kSuccess; } // Returns true iff the test part non-fatally failed. - bool nonfatally_failed() const { return type_ == TPRT_NONFATAL_FAILURE; } + bool nonfatally_failed() const { return type_ == kNonFatalFailure; } // Returns true iff the test part fatally failed. - bool fatally_failed() const { return type_ == TPRT_FATAL_FAILURE; } + bool fatally_failed() const { return type_ == kFatalFailure; } private: - TestPartResultType type_; + Type type_; // Gets the summary of the failure message by omitting the stack // trace in it. @@ -136,9 +136,8 @@ class TestPartResultArray { // 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_; + // Internally we use a Vector to implement the array. + internal::Vector<TestPartResult>* const array_; GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray); }; |