Unverified Commit edadfecd authored by Akash Patel's avatar Akash Patel Committed by GitHub
Browse files

Update gtest to 1.11.0 (#1086)

Properly resolves #1083, #996.
parent 26e3b704
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
// A sample program demonstrating using Google C++ testing framework. // A sample program demonstrating using Google C++ testing framework.
#ifndef GTEST_SAMPLES_SAMPLE3_INL_H_ #ifndef GOOGLETEST_SAMPLES_SAMPLE3_INL_H_
#define GTEST_SAMPLES_SAMPLE3_INL_H_ #define GOOGLETEST_SAMPLES_SAMPLE3_INL_H_
#include <stddef.h> #include <stddef.h>
...@@ -169,4 +169,4 @@ class Queue { ...@@ -169,4 +169,4 @@ class Queue {
const Queue& operator = (const Queue&); const Queue& operator = (const Queue&);
}; };
#endif // GTEST_SAMPLES_SAMPLE3_INL_H_ #endif // GOOGLETEST_SAMPLES_SAMPLE3_INL_H_
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework. // A sample program demonstrating using Google C++ testing framework.
#ifndef GTEST_SAMPLES_SAMPLE4_H_ #ifndef GOOGLETEST_SAMPLES_SAMPLE4_H_
#define GTEST_SAMPLES_SAMPLE4_H_ #define GOOGLETEST_SAMPLES_SAMPLE4_H_
// A simple monotonic counter. // A simple monotonic counter.
class Counter { class Counter {
...@@ -50,4 +50,4 @@ class Counter { ...@@ -50,4 +50,4 @@ class Counter {
void Print() const; void Print() const;
}; };
#endif // GTEST_SAMPLES_SAMPLE4_H_ #endif // GOOGLETEST_SAMPLES_SAMPLE4_H_
...@@ -73,8 +73,6 @@ class PrimeTableTest : public testing::Test { ...@@ -73,8 +73,6 @@ class PrimeTableTest : public testing::Test {
PrimeTable* const table_; PrimeTable* const table_;
}; };
#if GTEST_HAS_TYPED_TEST
using testing::Types; using testing::Types;
// Google Test offers two ways for reusing tests for different types. // Google Test offers two ways for reusing tests for different types.
...@@ -134,10 +132,6 @@ TYPED_TEST(PrimeTableTest, CanGetNextPrime) { ...@@ -134,10 +132,6 @@ TYPED_TEST(PrimeTableTest, CanGetNextPrime) {
// in the type list specified in TYPED_TEST_SUITE. Sit back and be // in the type list specified in TYPED_TEST_SUITE. Sit back and be
// happy that you don't have to define them multiple times. // happy that you don't have to define them multiple times.
#endif // GTEST_HAS_TYPED_TEST
#if GTEST_HAS_TYPED_TEST_P
using testing::Types; using testing::Types;
// Sometimes, however, you don't yet know all the types that you want // Sometimes, however, you don't yet know all the types that you want
...@@ -220,5 +214,4 @@ INSTANTIATE_TYPED_TEST_SUITE_P(OnTheFlyAndPreCalculated, // Instance name ...@@ -220,5 +214,4 @@ INSTANTIATE_TYPED_TEST_SUITE_P(OnTheFlyAndPreCalculated, // Instance name
PrimeTableTest2, // Test case name PrimeTableTest2, // Test case name
PrimeTableImplementations); // Type list PrimeTableImplementations); // Type list
#endif // GTEST_HAS_TYPED_TEST_P
} // namespace } // namespace
# Please Note:
Files in this directory are no longer supported by the maintainers. They
represent mosty historical artifacts and supported by the community only. There
is no guarantee whatsoever that these scripts still work.
...@@ -78,7 +78,7 @@ def HeaderPreamble(n): ...@@ -78,7 +78,7 @@ def HeaderPreamble(n):
} }
return ( return (
"""// Copyright 2006, Google Inc. """// Copyright 2006, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
...@@ -111,6 +111,8 @@ def HeaderPreamble(n): ...@@ -111,6 +111,8 @@ def HeaderPreamble(n):
// '%(command)s'. DO NOT EDIT BY HAND! // '%(command)s'. DO NOT EDIT BY HAND!
// //
// Implements a family of generic predicate assertion macros. // Implements a family of generic predicate assertion macros.
// GOOGLETEST_CM0001 DO NOT DELETE
#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
#define 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 ...@@ -246,8 +248,10 @@ AssertionResult AssertPred%(n)sHelper(const char* pred_text""" % DEFS
impl += ' << ") evaluates to false, where"' impl += ' << ") evaluates to false, where"'
impl += Iter(n, """ impl += Iter(
<< "\\n" << e%s << " evaluates to " << v%s""") n, """
<< "\\n" << e%s << " evaluates to " << ::testing::PrintToString(v%s)"""
)
impl += """; impl += """;
} }
...@@ -333,7 +337,7 @@ def UnitTestPreamble(): ...@@ -333,7 +337,7 @@ def UnitTestPreamble():
} }
return ( return (
"""// Copyright 2006, Google Inc. """// Copyright 2006, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
...@@ -427,7 +431,7 @@ def TestsForArity(n): ...@@ -427,7 +431,7 @@ def TestsForArity(n):
} }
tests = ( tests = (
"""// Sample functions/functors for testing %(arity)s predicate assertions. """// Sample functions/functors for testing %(arity)s predicate assertions.
// A %(arity)s predicate function. // A %(arity)s predicate function.
template <%(types)s> template <%(types)s>
...@@ -435,9 +439,8 @@ bool PredFunction%(n)s(%(tvs)s) { ...@@ -435,9 +439,8 @@ bool PredFunction%(n)s(%(tvs)s) {
return %(v_sum)s > 0; return %(v_sum)s > 0;
} }
// The following two functions are needed to circumvent a bug in // The following two functions are needed because a compiler doesn't have
// gcc 2.95.3, which sometimes has problem with the above template // a context yet to know which template function must be instantiated.
// function.
bool PredFunction%(n)sInt(%(int_vs)s) { bool PredFunction%(n)sInt(%(int_vs)s) {
return %(v_sum)s > 0; return %(v_sum)s > 0;
} }
...@@ -510,7 +513,7 @@ struct PredFormatFunctor%(n)s { ...@@ -510,7 +513,7 @@ struct PredFormatFunctor%(n)s {
class Predicate%(n)sTest : public testing::Test { class Predicate%(n)sTest : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
expected_to_finish_ = true; expected_to_finish_ = true;
finished_ = false;""" % DEFS finished_ = false;""" % DEFS
...@@ -520,7 +523,7 @@ class Predicate%(n)sTest : public testing::Test { ...@@ -520,7 +523,7 @@ class Predicate%(n)sTest : public testing::Test {
""" """
tests += """ tests += """
virtual void TearDown() { void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated // Verifies that each of the predicate's arguments was evaluated
// exactly once.""" // exactly once."""
...@@ -540,10 +543,10 @@ class Predicate%(n)sTest : public testing::Test { ...@@ -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_; 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_; static bool finished_;
""" % DEFS """ % DEFS
...@@ -572,12 +575,12 @@ typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest; ...@@ -572,12 +575,12 @@ typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest;
"""Returns the test for a predicate assertion macro. """Returns the test for a predicate assertion macro.
Args: Args:
use_format: true iff the assertion is a *_PRED_FORMAT*. use_format: true if and only if the assertion is a *_PRED_FORMAT*.
use_assert: true iff the assertion is a ASSERT_*. use_assert: true if and only if the assertion is a ASSERT_*.
expect_failure: true iff the assertion is expected to fail. expect_failure: true if and only if the assertion is expected to fail.
use_functor: true iff the first argument of the assertion is use_functor: true if and only if the first argument of the assertion is
a functor (as opposed to a function) 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. argument(s) of a user-defined type.
Example: Example:
...@@ -588,7 +591,7 @@ typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest; ...@@ -588,7 +591,7 @@ typedef Predicate%(n)sTest ASSERT_PRED%(n)sTest;
if use_assert: if use_assert:
assrt = 'ASSERT' # 'assert' is reserved, so we cannot use assrt = 'ASSERT' # 'assert' is reserved, so we cannot use
# that identifier here. # that identifier here.
else: else:
assrt = 'EXPECT' assrt = 'EXPECT'
......
...@@ -37,7 +37,7 @@ SYNOPSIS ...@@ -37,7 +37,7 @@ SYNOPSIS
interlinked wiki files. When we release a new version of interlinked wiki files. When we release a new version of
Google Test or Google Mock, we need to branch the wiki files Google Test or Google Mock, we need to branch the wiki files
such that users of a specific version of Google Test/Mock can such that users of a specific version of Google Test/Mock can
look up documenation relevant for that version. This script look up documentation relevant for that version. This script
automates that process by: automates that process by:
- branching the current wiki pages (which document the - branching the current wiki pages (which document the
......
#!/usr/bin/env python
#
# Copyright 2010 Google Inc. All Rights Reserved.
"""Runs program specified in the command line with the substituted PATH.
This script is needed for to support building under Pulse which is unable
to override the existing PATH variable.
"""
import os
import subprocess
import sys
SUBST_PATH_ENV_VAR_NAME = "SUBST_PATH"
def main():
if SUBST_PATH_ENV_VAR_NAME in os.environ:
os.environ["PATH"] = os.environ[SUBST_PATH_ENV_VAR_NAME]
exit_code = subprocess.Popen(sys.argv[1:]).wait()
# exit_code is negative (-signal) if the process has been terminated by
# a signal. Returning negative exit code is not portable and so we return
# 100 instead.
if exit_code < 0:
exit_code = 100
sys.exit(exit_code)
if __name__ == "__main__":
main()
#!/usr/bin/env python #!/usr/bin/env python
# #
# Copyright 2007 Google Inc. # Copyright 2007, Google Inc.
# All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Redistribution and use in source and binary forms, with or without
# you may not use this file except in compliance with the License. # modification, are permitted provided that the following conditions are
# You may obtain a copy of the License at # met:
# #
# http://www.apache.org/licenses/LICENSE-2.0 # * 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.
# #
# Unless required by applicable law or agreed to in writing, software # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# distributed under the License is distributed on an "AS IS" BASIS, # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# See the License for the specific language governing permissions and # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# limitations under the License. # 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.
"""Tool for uploading diffs from a version control system to the codereview app. """Tool for uploading diffs from a version control system to the codereview app.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment