diff options
author | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-11-04 17:56:23 (GMT) |
---|---|---|
committer | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-11-04 17:56:23 (GMT) |
commit | 8965a6a0d2165f32e6413594bba6367f271f51e7 (patch) | |
tree | ab0e0f5e0fd23697673ec2e0edca67079375dd2c /include/gtest | |
parent | 829402edcffe712ed4c79412ca020525cd8295ad (diff) | |
download | googletest-8965a6a0d2165f32e6413594bba6367f271f51e7.zip googletest-8965a6a0d2165f32e6413594bba6367f271f51e7.tar.gz googletest-8965a6a0d2165f32e6413594bba6367f271f51e7.tar.bz2 |
Improves conformance to the Google C++ Style Guide (by Greg Miller).
Diffstat (limited to 'include/gtest')
-rw-r--r-- | include/gtest/gtest-spi.h | 2 | ||||
-rw-r--r-- | include/gtest/gtest-test-part.h | 1 | ||||
-rw-r--r-- | include/gtest/gtest.h | 6 | ||||
-rw-r--r-- | include/gtest/gtest_pred_impl.h | 12 | ||||
-rw-r--r-- | include/gtest/internal/gtest-port.h | 4 | ||||
-rw-r--r-- | include/gtest/internal/gtest-string.h | 8 | ||||
-rw-r--r-- | include/gtest/internal/gtest-tuple.h | 88 | ||||
-rw-r--r-- | include/gtest/internal/gtest-tuple.h.pump | 9 | ||||
-rw-r--r-- | include/gtest/internal/gtest-type-util.h | 6 | ||||
-rw-r--r-- | include/gtest/internal/gtest-type-util.h.pump | 6 |
10 files changed, 97 insertions, 45 deletions
diff --git a/include/gtest/gtest-spi.h b/include/gtest/gtest-spi.h index b226e55..f63fa9a 100644 --- a/include/gtest/gtest-spi.h +++ b/include/gtest/gtest-spi.h @@ -223,7 +223,7 @@ class GTEST_API_ SingleFailureChecker { (substr));\ {\ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\ + ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ >est_failures);\ if (::testing::internal::AlwaysTrue()) { statement; }\ }\ diff --git a/include/gtest/gtest-test-part.h b/include/gtest/gtest-test-part.h index 8aeea14..4615147 100644 --- a/include/gtest/gtest-test-part.h +++ b/include/gtest/gtest-test-part.h @@ -96,6 +96,7 @@ class GTEST_API_ TestPartResult { // Returns true iff the test part fatally failed. bool fatally_failed() const { return type_ == kFatalFailure; } + private: Type type_; diff --git a/include/gtest/gtest.h b/include/gtest/gtest.h index c196990..2d570a2 100644 --- a/include/gtest/gtest.h +++ b/include/gtest/gtest.h @@ -52,6 +52,7 @@ #define GTEST_INCLUDE_GTEST_GTEST_H_ #include <limits> +#include <ostream> #include <vector> #include "gtest/internal/gtest-internal.h" @@ -672,7 +673,6 @@ class GTEST_API_ TestInfo { const TestResult* result() const { return &result_; } private: - #if GTEST_HAS_DEATH_TEST friend class internal::DefaultDeathTestFactory; #endif // GTEST_HAS_DEATH_TEST @@ -1456,11 +1456,11 @@ GTEST_IMPL_CMP_HELPER_(NE, !=); // Implements the helper function for {ASSERT|EXPECT}_LE GTEST_IMPL_CMP_HELPER_(LE, <=); // 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 GTEST_IMPL_CMP_HELPER_(GE, >=); // Implements the helper function for {ASSERT|EXPECT}_GT -GTEST_IMPL_CMP_HELPER_(GT, > ); +GTEST_IMPL_CMP_HELPER_(GT, >); #undef GTEST_IMPL_CMP_HELPER_ diff --git a/include/gtest/gtest_pred_impl.h b/include/gtest/gtest_pred_impl.h index 3805f85..30ae712 100644 --- a/include/gtest/gtest_pred_impl.h +++ b/include/gtest/gtest_pred_impl.h @@ -27,7 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// This file is AUTOMATICALLY GENERATED on 09/24/2010 by command +// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND! // // Implements a family of generic predicate assertion macros. @@ -98,7 +98,7 @@ AssertionResult AssertPred1Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1. // Don't use this in your code. #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, v1),\ + GTEST_ASSERT_(pred_format(#v1, v1), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use @@ -144,7 +144,7 @@ AssertionResult AssertPred2Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2. // Don't use this in your code. #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) // Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use @@ -197,7 +197,7 @@ AssertionResult AssertPred3Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3. // Don't use this in your code. #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) // Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use @@ -257,7 +257,7 @@ AssertionResult AssertPred4Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4. // Don't use this in your code. #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) // Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use @@ -324,7 +324,7 @@ AssertionResult AssertPred5Helper(const char* pred_text, // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5. // Don't use this in your code. #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) // Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index 0493892..3c8463b 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -812,6 +812,7 @@ class scoped_ptr { ptr_ = p; } } + private: T* ptr_; @@ -1110,7 +1111,7 @@ class Notification { // Blocks until the controller thread notifies. Must be called from a test // thread. void WaitForNotification() { - while(!notified_) { + while (!notified_) { SleepMilliseconds(10); } } @@ -1754,7 +1755,6 @@ class TypeWithSize<4> { template <> class TypeWithSize<8> { public: - #if GTEST_OS_WINDOWS typedef __int64 Int; typedef unsigned __int64 UInt; diff --git a/include/gtest/internal/gtest-string.h b/include/gtest/internal/gtest-string.h index dc3a07b..a902450 100644 --- a/include/gtest/internal/gtest-string.h +++ b/include/gtest/internal/gtest-string.h @@ -47,10 +47,10 @@ #endif #include <string.h> -#include "gtest/internal/gtest-port.h" - #include <string> +#include "gtest/internal/gtest-port.h" + namespace testing { namespace internal { @@ -223,14 +223,14 @@ class GTEST_API_ String { // Converting a ::std::string or ::string containing an embedded NUL // character to a String will result in the prefix up to the first // NUL character. - String(const ::std::string& str) { + String(const ::std::string& str) { // NOLINT ConstructNonNull(str.c_str(), str.length()); } operator ::std::string() const { return ::std::string(c_str(), length()); } #if GTEST_HAS_GLOBAL_STRING - String(const ::string& str) { + String(const ::string& str) { // NOLINT ConstructNonNull(str.c_str(), str.length()); } diff --git a/include/gtest/internal/gtest-tuple.h b/include/gtest/internal/gtest-tuple.h index d1af50e..399e84d 100644 --- a/include/gtest/internal/gtest-tuple.h +++ b/include/gtest/internal/gtest-tuple.h @@ -1,4 +1,6 @@ -// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! +// This file was GENERATED by command: +// pump.py gtest-tuple.h.pump +// DO NOT EDIT BY HAND!!! // Copyright 2009 Google Inc. // All Rights Reserved. @@ -140,34 +142,54 @@ template <bool kIndexValid, int kIndex, class Tuple> struct TupleElement; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; }; +struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { + typedef T0 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; }; +struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { + typedef T1 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; }; +struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { + typedef T2 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; }; +struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { + typedef T3 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; }; +struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { + typedef T4 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; }; +struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { + typedef T5 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; }; +struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { + typedef T6 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; }; +struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { + typedef T7 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; }; +struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { + typedef T8 type; +}; template <GTEST_10_TYPENAMES_(T)> -struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; }; +struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { + typedef T9 type; +}; } // namespace gtest_internal @@ -708,37 +730,59 @@ inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, template <typename Tuple> struct tuple_size; template <GTEST_0_TYPENAMES_(T)> -struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; }; +struct tuple_size<GTEST_0_TUPLE_(T)> { + static const int value = 0; +}; template <GTEST_1_TYPENAMES_(T)> -struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; }; +struct tuple_size<GTEST_1_TUPLE_(T)> { + static const int value = 1; +}; template <GTEST_2_TYPENAMES_(T)> -struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; }; +struct tuple_size<GTEST_2_TUPLE_(T)> { + static const int value = 2; +}; template <GTEST_3_TYPENAMES_(T)> -struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; }; +struct tuple_size<GTEST_3_TUPLE_(T)> { + static const int value = 3; +}; template <GTEST_4_TYPENAMES_(T)> -struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; }; +struct tuple_size<GTEST_4_TUPLE_(T)> { + static const int value = 4; +}; template <GTEST_5_TYPENAMES_(T)> -struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; }; +struct tuple_size<GTEST_5_TUPLE_(T)> { + static const int value = 5; +}; template <GTEST_6_TYPENAMES_(T)> -struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; }; +struct tuple_size<GTEST_6_TUPLE_(T)> { + static const int value = 6; +}; template <GTEST_7_TYPENAMES_(T)> -struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; }; +struct tuple_size<GTEST_7_TUPLE_(T)> { + static const int value = 7; +}; template <GTEST_8_TYPENAMES_(T)> -struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; }; +struct tuple_size<GTEST_8_TUPLE_(T)> { + static const int value = 8; +}; template <GTEST_9_TYPENAMES_(T)> -struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; }; +struct tuple_size<GTEST_9_TUPLE_(T)> { + static const int value = 9; +}; template <GTEST_10_TYPENAMES_(T)> -struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; }; +struct tuple_size<GTEST_10_TUPLE_(T)> { + static const int value = 10; +}; template <int k, class Tuple> struct tuple_element { diff --git a/include/gtest/internal/gtest-tuple.h.pump b/include/gtest/internal/gtest-tuple.h.pump index ef51909..238e8fc 100644 --- a/include/gtest/internal/gtest-tuple.h.pump +++ b/include/gtest/internal/gtest-tuple.h.pump @@ -118,8 +118,9 @@ struct TupleElement; $for i [[ template <GTEST_$(n)_TYPENAMES_(T)> -struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T)> [[]] -{ typedef T$i type; }; +struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T)> { + typedef T$i type; +}; ]] @@ -220,7 +221,9 @@ template <typename Tuple> struct tuple_size; $for j [[ template <GTEST_$(j)_TYPENAMES_(T)> -struct tuple_size<GTEST_$(j)_TUPLE_(T)> { static const int value = $j; }; +struct tuple_size<GTEST_$(j)_TUPLE_(T)> { + static const int value = $j; +}; ]] diff --git a/include/gtest/internal/gtest-type-util.h b/include/gtest/internal/gtest-type-util.h index 597aeaf..ed58fce 100644 --- a/include/gtest/internal/gtest-type-util.h +++ b/include/gtest/internal/gtest-type-util.h @@ -72,7 +72,7 @@ String GetTypeName() { // so we have to demangle it. # if GTEST_HAS_CXXABI_H_ using abi::__cxa_demangle; -# endif // GTEST_HAS_CXXABI_H_ +# endif // GTEST_HAS_CXXABI_H_ char* const readable_name = __cxa_demangle(name, 0, 0, &status); const String name_str(status == 0 ? readable_name : name); free(readable_name); @@ -3300,7 +3300,9 @@ struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, // INSTANTIATE_TYPED_TEST_CASE_P(). template <typename T> -struct TypeList { typedef Types1<T> type; }; +struct TypeList { + typedef Types1<T> type; +}; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, diff --git a/include/gtest/internal/gtest-type-util.h.pump b/include/gtest/internal/gtest-type-util.h.pump index 8198e10..cdeb7a4 100644 --- a/include/gtest/internal/gtest-type-util.h.pump +++ b/include/gtest/internal/gtest-type-util.h.pump @@ -70,7 +70,7 @@ String GetTypeName() { // so we have to demangle it. # if GTEST_HAS_CXXABI_H_ using abi::__cxa_demangle; -# endif // GTEST_HAS_CXXABI_H_ +# endif // GTEST_HAS_CXXABI_H_ char* const readable_name = __cxa_demangle(name, 0, 0, &status); const String name_str(status == 0 ? readable_name : name); free(readable_name); @@ -279,7 +279,9 @@ struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> { // INSTANTIATE_TYPED_TEST_CASE_P(). template <typename T> -struct TypeList { typedef Types1<T> type; }; +struct TypeList { + typedef Types1<T> type; +}; $range i 1..n |