X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=googletest%2Fscripts%2Fgen_gtest_pred_impl.py;h=e09a6e01778d974ead976a5edf79fb5d434a3632;hb=548497ee798bf6e0a300e2d9848109ea1265a56b;hp=b43efdf41e5c02740f72b35532be5cf049794835;hpb=ea17aef41dec775b644330ec50fa99e945f6b308;p=platform%2Fupstream%2Fgtest.git diff --git a/googletest/scripts/gen_gtest_pred_impl.py b/googletest/scripts/gen_gtest_pred_impl.py index b43efdf..e09a6e0 100755 --- a/googletest/scripts/gen_gtest_pred_impl.py +++ b/googletest/scripts/gen_gtest_pred_impl.py @@ -78,7 +78,7 @@ def HeaderPreamble(n): } return ( -"""// Copyright 2006, Google Inc. + """// Copyright 2006, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -111,6 +111,8 @@ def HeaderPreamble(n): // '%(command)s'. DO NOT EDIT BY HAND! // // Implements a family of generic predicate assertion macros. +// GOOGLETEST_CM0001 DO NOT DELETE + #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ @@ -246,8 +248,10 @@ AssertionResult AssertPred%(n)sHelper(const char* pred_text""" % DEFS impl += ' << ") evaluates to false, where"' - impl += Iter(n, """ - << "\\n" << e%s << " evaluates to " << v%s""") + impl += Iter( + n, """ + << "\\n" << e%s << " evaluates to " << ::testing::PrintToString(v%s)""" + ) impl += """; } @@ -333,7 +337,7 @@ def UnitTestPreamble(): } return ( -"""// Copyright 2006, Google Inc. + """// Copyright 2006, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -427,7 +431,7 @@ def TestsForArity(n): } tests = ( -"""// Sample functions/functors for testing %(arity)s predicate assertions. + """// Sample functions/functors for testing %(arity)s predicate assertions. // A %(arity)s predicate function. template <%(types)s> @@ -435,9 +439,8 @@ bool PredFunction%(n)s(%(tvs)s) { return %(v_sum)s > 0; } -// The following two functions are needed to circumvent a bug in -// gcc 2.95.3, which sometimes has problem with the above template -// function. +// The following two functions are needed because a compiler doesn't have +// a context yet to know which template function must be instantiated. bool PredFunction%(n)sInt(%(int_vs)s) { return %(v_sum)s > 0; } @@ -510,7 +513,7 @@ struct PredFormatFunctor%(n)s { class Predicate%(n)sTest : public testing::Test { protected: - virtual void SetUp() { + void SetUp() override { expected_to_finish_ = true; finished_ = false;""" % DEFS @@ -520,7 +523,7 @@ class Predicate%(n)sTest : public testing::Test { """ tests += """ - virtual void TearDown() { + void TearDown() override { // Verifies that each of the predicate's arguments was evaluated // exactly once.""" @@ -540,10 +543,10 @@ class Predicate%(n)sTest : public testing::Test { } } - // true iff the test function is expected to run to finish. + // true if and only if the test function is expected to run to finish. static bool expected_to_finish_; - // true iff the test function did run to finish. + // true if and only if the test function did run to finish. static bool finished_; """ % DEFS @@ -572,12 +575,12 @@ typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest; """Returns the test for a predicate assertion macro. Args: - use_format: true iff the assertion is a *_PRED_FORMAT*. - use_assert: true iff the assertion is a ASSERT_*. - expect_failure: true iff the assertion is expected to fail. - use_functor: true iff the first argument of the assertion is + use_format: true if and only if the assertion is a *_PRED_FORMAT*. + use_assert: true if and only if the assertion is a ASSERT_*. + expect_failure: true if and only if the assertion is expected to fail. + use_functor: true if and only if the first argument of the assertion is a functor (as opposed to a function) - use_user_type: true iff the predicate functor/function takes + use_user_type: true if and only if the predicate functor/function takes argument(s) of a user-defined type. Example: @@ -588,7 +591,7 @@ typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest; if use_assert: assrt = 'ASSERT' # 'assert' is reserved, so we cannot use - # that identifier here. + # that identifier here. else: assrt = 'EXPECT'