diff options
104 files changed, 2377 insertions, 7431 deletions
diff --git a/.travis.yml b/.travis.yml index 56f7d7c..04b51dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,7 @@ addons: packages: - ccache - gcc@4.9 - - llvm@3.9 + - llvm@4 update: true notifications: diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fae2f9..f11bbb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ if (POLICY CMP0048) endif (POLICY CMP0048) project(googletest-distribution) -set(GOOGLETEST_VERSION 1.9.0) +set(GOOGLETEST_VERSION 1.10.0) if (CMAKE_VERSION VERSION_LESS "3.1") add_definitions(-std=c++11) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30c8d89..4c18499 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -133,10 +133,10 @@ All tests should pass. Some of Google Test's source files are generated from templates (not in the C++ sense) using a script. For example, the file -include/gtest/internal/gtest-type-util.h.pump is used to generate -gtest-type-util.h in the same directory. +*googlemock/include/gmock/gmock-generated-actions.h.pump* is used to generate +*gmock-generated-actions.h* in the same directory. You don't need to worry about regenerating the source files unless you need to modify them. You would then modify the corresponding `.pump` files and run the -'[pump.py](googletest/scripts/pump.py)' generator script. See the -[Pump Manual](googletest/docs/pump_manual.md). +'[pump.py](googlemock/scripts/pump.py)' generator script. See the +[Pump Manual](googlemock/docs/pump_manual.md). @@ -5,24 +5,19 @@ [![Build Status](https://api.travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest) [![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master) -### Future Plans +### Announcements: -#### 1.8.x Release: +#### Release 1.10.x -[the 1.8.x](https://github.com/google/googletest/releases/tag/release-1.8.1) is -the last release that works with pre-C++11 compilers. The 1.8.x will not accept -any requests for any new features and any bugfix requests will only be accepted -if proven "critical" +[Release 1.10.x](https://github.com/google/googletest/releases/tag/release-1.10.0) +is now available. -#### Post 1.8.x: +#### Coming Soon -On-going work to improve/cleanup/pay technical debt. When this work is completed -there will be a 1.9.x tagged release - -#### Post 1.9.x - -Post 1.9.x googletest will follow -[Abseil Live at Head philosophy](https://abseil.io/about/philosophy) +* Post 1.10.x googletest will follow + [Abseil Live at Head philosophy](https://abseil.io/about/philosophy) +* We are also planning to take a dependency on + [Abseil](https://github.com/abseil/abseil-cpp). ## Welcome to **Google Test**, Google's C++ test framework! @@ -107,6 +102,9 @@ runs tests from your binary in parallel to provide significant speed-up. is a VS Code extension allowing to view Google Tests in a tree view, and run/debug your tests. +[Cornichon](https://pypi.org/project/cornichon/) is a small Gherkin DSL parser +that generates stub code for Google Test. + ## Requirements Google Test is designed to have fairly minimal requirements to build and use diff --git a/ci/install-osx.sh b/ci/install-osx.sh index f2baebd..cc47508 100755 --- a/ci/install-osx.sh +++ b/ci/install-osx.sh @@ -37,4 +37,4 @@ if [ "${TRAVIS_OS_NAME}" != "osx" ]; then fi brew update -brew install ccache gcc@4.9 llvm@3.9 +brew install ccache gcc@4.9 diff --git a/googlemock/cmake/gmock.pc.in b/googlemock/cmake/gmock.pc.in index 08e0454..2ef0fbc 100644 --- a/googlemock/cmake/gmock.pc.in +++ b/googlemock/cmake/gmock.pc.in @@ -1,6 +1,5 @@ -prefix=${pcfiledir}/../.. -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: gmock Description: GoogleMock (without main() function) diff --git a/googlemock/cmake/gmock_main.pc.in b/googlemock/cmake/gmock_main.pc.in index b22fe61..04658fe 100644 --- a/googlemock/cmake/gmock_main.pc.in +++ b/googlemock/cmake/gmock_main.pc.in @@ -1,6 +1,5 @@ -prefix=${pcfiledir}/../.. -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: gmock_main Description: GoogleMock (with main() function) diff --git a/googlemock/docs/cheat_sheet.md b/googlemock/docs/cheat_sheet.md index 239a4c6..975362b 100644 --- a/googlemock/docs/cheat_sheet.md +++ b/googlemock/docs/cheat_sheet.md @@ -202,6 +202,15 @@ EXPECT_CALL(mock-object, method (matchers)?) .RetiresOnSaturation(); ? ``` +For each item above, `?` means it can be used at most once, while `*` means it +can be used any number of times. + +In order to pass, `EXPECT_CALL` must be used before the calls are actually made. + +The `(matchers)` is a comma-separated list of matchers that correspond to each +of the arguments of `method`, and sets the expectation only for calls of +`method` that matches all of the matchers. + If `(matchers)` is omitted, the expectation is the same as if the matchers were set to anything matchers (for example, `(_, _, _, _)` for a four-arg method). @@ -221,17 +230,19 @@ and the default action will be taken each time. <!-- GOOGLETEST_CM0020 DO NOT DELETE --> A **matcher** matches a *single* argument. You can use it inside `ON_CALL()` or -`EXPECT_CALL()`, or use it to validate a value directly: +`EXPECT_CALL()`, or use it to validate a value directly using two macros: <!-- mdformat off(github rendering does not support multiline tables) --> -| Matcher | Description | +| Macro | Description | | :----------------------------------- | :------------------------------------ | | `EXPECT_THAT(actual_value, matcher)` | Asserts that `actual_value` matches `matcher`. | | `ASSERT_THAT(actual_value, matcher)` | The same as `EXPECT_THAT(actual_value, matcher)`, except that it generates a **fatal** failure. | <!-- mdformat on --> -Built-in matchers (where `argument` is the function argument) are divided into -several categories: +Built-in matchers (where `argument` is the function argument, e.g. +`actual_value` in the example above, or when used in the context of +`EXPECT_CALL(mock_object, method(matchers))`, the arguments of `method`) are +divided into several categories: #### Wildcard @@ -251,6 +262,8 @@ Matcher | Description | `Le(value)` | `argument <= value` | | `Lt(value)` | `argument < value` | | `Ne(value)` | `argument != value` | +| `IsFalse()` | `argument` evaluates to `false` in a Boolean context. | +| `IsTrue()` | `argument` evaluates to `true` in a Boolean context. | | `IsNull()` | `argument` is a `NULL` pointer (raw or smart). | | `NotNull()` | `argument` is a non-null pointer (raw or smart). | | `Optional(m)` | `argument` is `optional<>` that contains a value matching `m`. | @@ -274,6 +287,7 @@ is not changed afterwards, or the meaning of your matcher will be changed. | `FloatEq(a_float)` | `argument` is a `float` value approximately equal to `a_float`, treating two NaNs as unequal. | | `NanSensitiveDoubleEq(a_double)` | `argument` is a `double` value approximately equal to `a_double`, treating two NaNs as equal. | | `NanSensitiveFloatEq(a_float)` | `argument` is a `float` value approximately equal to `a_float`, treating two NaNs as equal. | +| `IsNan()` | `argument` is any floating-point type with a NaN value. | <!-- mdformat on --> The above matchers use ULP-based comparison (the same as used in googletest). @@ -312,9 +326,9 @@ The `argument` can be either a C string or a C++ string object: `ContainsRegex()` and `MatchesRegex()` take ownership of the `RE` object. They use the regular expression syntax defined -[here](../../googletest/docs/advanced.md#regular-expression-syntax). -`StrCaseEq()`, `StrCaseNe()`, `StrEq()`, and `StrNe()` work for wide strings as -well. +[here](../../googletest/docs/advanced.md#regular-expression-syntax). All of +these matchers, except `ContainsRegex()` and `MatchesRegex()` work for wide +strings as well. #### Container Matchers @@ -333,10 +347,8 @@ messages, you can use: | `ElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, where the *i*-th element matches `ei`, which can be a value or a matcher. | | `ElementsAreArray({e0, e1, ..., en})`, `ElementsAreArray(a_container)`, `ElementsAreArray(begin, end)`, `ElementsAreArray(array)`, or `ElementsAreArray(array, count)` | The same as `ElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, iterator range, or C-style array. | | `IsEmpty()` | `argument` is an empty container (`container.empty()`). | -| `IsFalse()` | `argument` evaluates to `false` in a Boolean context. | | `IsSubsetOf({e0, e1, ..., en})`, `IsSubsetOf(a_container)`, `IsSubsetOf(begin, end)`, `IsSubsetOf(array)`, or `IsSubsetOf(array, count)` | `argument` matches `UnorderedElementsAre(x0, x1, ..., xk)` for some subset `{x0, x1, ..., xk}` of the expected matchers. | | `IsSupersetOf({e0, e1, ..., en})`, `IsSupersetOf(a_container)`, `IsSupersetOf(begin, end)`, `IsSupersetOf(array)`, or `IsSupersetOf(array, count)` | Some subset of `argument` matches `UnorderedElementsAre(`expected matchers`)`. | -| `IsTrue()` | `argument` evaluates to `true` in a Boolean context. | | `Pointwise(m, container)`, `Pointwise(m, {e0, e1, ..., en})` | `argument` contains the same number of elements as in `container`, and for all i, (the i-th element in `argument`, the i-th element in `container`) match `m`, which is a matcher on 2-tuples. E.g. `Pointwise(Le(), upper_bounds)` verifies that each element in `argument` doesn't exceed the corresponding element in `upper_bounds`. See more detail below. | | `SizeIs(m)` | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`. | | `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under *some* permutation of the elements, each element matches an `ei` (for a different `i`), which can be a value or a matcher. | @@ -491,16 +503,17 @@ which must be a permanent callback. #### Returning a Value <!-- mdformat off(no multiline tables) --> -| | | -| :-------------------------- | :-------------------------------------------- | -| `Return()` | Return from a `void` mock function. | -| `Return(value)` | Return `value`. If the type of `value` is different to the mock function's return type, `value` is converted to the latter type <i>at the time the expectation is set</i>, not when the action is executed. | -| `ReturnArg<N>()` | Return the `N`-th (0-based) argument. | -| `ReturnNew<T>(a1, ..., ak)` | Return `new T(a1, ..., ak)`; a different object is created each time. | -| `ReturnNull()` | Return a null pointer. | -| `ReturnPointee(ptr)` | Return the value pointed to by `ptr`. | -| `ReturnRef(variable)` | Return a reference to `variable`. | -| `ReturnRefOfCopy(value)` | Return a reference to a copy of `value`; the copy lives as long as the action. | +| | | +| :-------------------------------- | :-------------------------------------------- | +| `Return()` | Return from a `void` mock function. | +| `Return(value)` | Return `value`. If the type of `value` is different to the mock function's return type, `value` is converted to the latter type <i>at the time the expectation is set</i>, not when the action is executed. | +| `ReturnArg<N>()` | Return the `N`-th (0-based) argument. | +| `ReturnNew<T>(a1, ..., ak)` | Return `new T(a1, ..., ak)`; a different object is created each time. | +| `ReturnNull()` | Return a null pointer. | +| `ReturnPointee(ptr)` | Return the value pointed to by `ptr`. | +| `ReturnRef(variable)` | Return a reference to `variable`. | +| `ReturnRefOfCopy(value)` | Return a reference to a copy of `value`; the copy lives as long as the action. | +| `ReturnRoundRobin({a1, ..., ak})` | Each call will return the next `ai` in the list, starting at the beginning when the end of the list is reached. | <!-- mdformat on --> #### Side Effects @@ -601,19 +614,6 @@ composite action - trying to do so will result in a run-time error. #### Defining Actions -<table border="1" cellspacing="0" cellpadding="1"> - <tr> - <td>`struct SumAction {` <br> -  `template <typename T>` <br> -  `T operator()(T x, Ty) { return x + y; }` <br> - `};` - </td> - <td> Defines a generic functor that can be used as an action summing its - arguments. </td> </tr> - <tr> - </tr> -</table> - <!-- mdformat off(no multiline tables) --> | | | | :--------------------------------- | :-------------------------------------- | @@ -731,12 +731,12 @@ you can do it earlier: using ::testing::Mock; ... // Verifies and removes the expectations on mock_obj; -// returns true if successful. +// returns true if and only if successful. Mock::VerifyAndClearExpectations(&mock_obj); ... // Verifies and removes the expectations on mock_obj; // also removes the default actions set by ON_CALL(); -// returns true if successful. +// returns true if and only if successful. Mock::VerifyAndClear(&mock_obj); ``` diff --git a/googlemock/docs/cook_book.md b/googlemock/docs/cook_book.md index 28f7ba1..ea55ab3 100644 --- a/googlemock/docs/cook_book.md +++ b/googlemock/docs/cook_book.md @@ -1,4 +1,4 @@ -## gMock Cookbook +# gMock Cookbook <!-- GOOGLETEST_CM0012 DO NOT DELETE --> @@ -10,7 +10,7 @@ recommended to write `using ::testing::Foo;` once in your file before using the name `Foo` defined by gMock. We omit such `using` statements in this section for brevity, but you should do it in your own code. -### Creating Mock Classes +## Creating Mock Classes Mock classes are defined as normal classes, using the `MOCK_METHOD` macro to generate mocked methods. The macro gets 3 or 4 parameters: @@ -36,7 +36,7 @@ generated method: * **`Calltype(...)`** - Sets the call type for the method (e.g. to `STDMETHODCALLTYPE`), useful in Windows. -#### Dealing with unprotected commas +### Dealing with unprotected commas Unprotected commas, i.e. commas which are not surrounded by parentheses, prevent `MOCK_METHOD` from parsing its arguments correctly: @@ -74,7 +74,7 @@ class MockFoo { }; ``` -#### Mocking Private or Protected Methods +### Mocking Private or Protected Methods You must always put a mock method definition (`MOCK_METHOD`) in a `public:` section of the mock class, regardless of the method being mocked being `public`, @@ -108,7 +108,7 @@ class MockFoo : public Foo { }; ``` -#### Mocking Overloaded Methods +### Mocking Overloaded Methods You can mock overloaded functions as usual. No special attention is required: @@ -152,7 +152,7 @@ class MockFoo : public Foo { }; ``` -#### Mocking Class Templates +### Mocking Class Templates You can mock class templates just like any class. @@ -175,7 +175,7 @@ class MockStack : public StackInterface<Elem> { }; ``` -#### Mocking Non-virtual Methods {#MockingNonVirtualMethods} +### Mocking Non-virtual Methods {#MockingNonVirtualMethods} gMock can mock non-virtual functions to be used in Hi-perf dependency injection.<!-- GOOGLETEST_CM0017 DO NOT DELETE --> @@ -243,7 +243,7 @@ tests. ... exercise reader ... ``` -#### Mocking Free Functions +### Mocking Free Functions It's possible to use gMock to mock a free function (i.e. a C-style function or a static method). You just need to rewrite your code to use an interface (abstract @@ -279,7 +279,7 @@ If you are concerned about the performance overhead incurred by virtual functions, and profiling confirms your concern, you can combine this with the recipe for [mocking non-virtual methods](#MockingNonVirtualMethods). -#### Old-Style `MOCK_METHODn` Macros +### Old-Style `MOCK_METHODn` Macros Before the generic `MOCK_METHOD` macro was introduced, mocks where created using a family of macros collectively called `MOCK_METHODn`. These macros are still @@ -337,7 +337,7 @@ Foo, bool(int))` </td> </tr> <tr> <td> New </td> <td> `MOCK_METHOD(bool, Foo, </table> -#### The Nice, the Strict, and the Naggy {#NiceStrictNaggy} +### The Nice, the Strict, and the Naggy {#NiceStrictNaggy} If a mock method has no `EXPECT_CALL` spec but is called, we say that it's an "uninteresting call", and the default action (which can be specified using @@ -444,7 +444,7 @@ nice mocks (not yet the default) most of the time, use naggy mocks (the current default) when developing or debugging tests, and use strict mocks only as the last resort. -#### Simplifying the Interface without Breaking Existing Code {#SimplerInterfaces} +### Simplifying the Interface without Breaking Existing Code {#SimplerInterfaces} Sometimes a method has a long list of arguments that is mostly uninteresting. For example: @@ -516,7 +516,7 @@ ON_CALL(factory, DoMakeTurtle) .WillByDefault(MakeMockTurtle()); ``` -#### Alternative to Mocking Concrete Classes +### Alternative to Mocking Concrete Classes Often you may find yourself using classes that don't implement interfaces. In order to test your code that uses such a class (let's call it `Concrete`), you @@ -578,7 +578,7 @@ I'd like to assure you that the Java community has been practicing this for a long time and it's a proven effective technique applicable in a wide variety of situations. :-) -#### Delegating Calls to a Fake {#DelegatingToFake} +### Delegating Calls to a Fake {#DelegatingToFake} Some times you have a non-trivial fake implementation of an interface. For example: @@ -696,7 +696,7 @@ Instead, you can define a `FileOps` interface and an `IOOps` interface and split `System`'s functionalities into the two. Then you can mock `IOOps` without mocking `FileOps`. -#### Delegating Calls to a Real Object +### Delegating Calls to a Real Object When using testing doubles (mocks, fakes, stubs, and etc), sometimes their behaviors will differ from those of the real objects. This difference could be @@ -747,7 +747,7 @@ arguments, in the right order, called the right number of times, etc), and a real object will answer the calls (so the behavior will be the same as in production). This gives you the best of both worlds. -#### Delegating Calls to a Parent Class +### Delegating Calls to a Parent Class Ideally, you should code to interfaces, whose methods are all pure virtual. In reality, sometimes you do need to mock a virtual method that is not pure (i.e, @@ -815,9 +815,9 @@ or tell the mock object that you don't want to mock `Concrete()`: `MockFoo::Concrete()` will be called (and cause an infinite recursion) since `Foo::Concrete()` is virtual. That's just how C++ works.) -### Using Matchers +## Using Matchers -#### Matching Argument Values Exactly +### Matching Argument Values Exactly You can specify exactly which arguments a mock method is expecting: @@ -829,7 +829,7 @@ using ::testing::Return; EXPECT_CALL(foo, DoThat("Hello", bar)); ``` -#### Using Simple Matchers +### Using Simple Matchers You can use matchers to match arguments that have a certain property: @@ -850,7 +850,7 @@ A frequently used matcher is `_`, which matches anything: ``` <!-- GOOGLETEST_CM0022 DO NOT DELETE --> -#### Combining Matchers {#CombiningMatchers} +### Combining Matchers {#CombiningMatchers} You can build complex matchers from existing ones using `AllOf()`, `AllOfArray()`, `AnyOf()`, `AnyOfArray()` and `Not()`: @@ -871,7 +871,7 @@ using ::testing::Not; NULL)); ``` -#### Casting Matchers {#SafeMatcherCast} +### Casting Matchers {#SafeMatcherCast} gMock matchers are statically typed, meaning that the compiler can catch your mistake if you use a matcher of the wrong type (for example, if you use `Eq(5)` @@ -926,7 +926,7 @@ can `static_cast` type `T` to type `U`. always safe as it could throw away information, for example), so be careful not to misuse/abuse it. -#### Selecting Between Overloaded Functions {#SelectOverload} +### Selecting Between Overloaded Functions {#SelectOverload} If you expect an overloaded function to be called, the compiler may need some help on which overloaded version it is. @@ -983,7 +983,7 @@ TEST(PrinterTest, Print) { } ``` -#### Performing Different Actions Based on the Arguments +### Performing Different Actions Based on the Arguments When a mock method is called, the *last* matching expectation that's still active will be selected (think "newer overrides older"). So, you can make a @@ -1005,7 +1005,7 @@ using ::testing::Return; Now, if `foo.DoThis()` is called with a value less than 5, `'a'` will be returned; otherwise `'b'` will be returned. -#### Matching Multiple Arguments as a Whole +### Matching Multiple Arguments as a Whole Sometimes it's not enough to match the arguments individually. For example, we may want to say that the first argument must be less than the second argument. @@ -1057,7 +1057,7 @@ Note that if you want to pass the arguments to a predicate of your own (e.g. take a `::std::tuple` as its argument; gMock will pass the `n` selected arguments as *one* single tuple to the predicate. -#### Using Matchers as Predicates +### Using Matchers as Predicates Have you noticed that a matcher is just a fancy predicate that also knows how to describe itself? Many existing algorithms take predicates as arguments (e.g. @@ -1095,7 +1095,7 @@ using testing::Ne; Matches(AllOf(Ge(0), Le(100), Ne(50))) ``` -#### Using Matchers in googletest Assertions +### Using Matchers in googletest Assertions Since matchers are basically predicates that also know how to describe themselves, there is a way to take advantage of them in googletest assertions. @@ -1143,7 +1143,7 @@ Expected: starts with "Hello" **Credit:** The idea of `(ASSERT|EXPECT)_THAT` was borrowed from Joe Walnes' Hamcrest project, which adds `assertThat()` to JUnit. -#### Using Predicates as Matchers +### Using Predicates as Matchers gMock provides a [built-in set](#MatcherList) of matchers. In case you find them lacking, you can use an arbitrary unary predicate function or functor as a @@ -1165,7 +1165,7 @@ works as long as the return value can be used as the condition in in statement <!-- GOOGLETEST_CM0023 DO NOT DELETE --> -#### Matching Arguments that Are Not Copyable +### Matching Arguments that Are Not Copyable When you do an `EXPECT_CALL(mock_obj, Foo(bar))`, gMock saves away a copy of `bar`. When `Foo()` is called later, gMock compares the argument to `Foo()` with @@ -1195,7 +1195,7 @@ using ::testing::Lt; Remember: if you do this, don't change `bar` after the `EXPECT_CALL()`, or the result is undefined. -#### Validating a Member of an Object +### Validating a Member of an Object Often a mock function takes a reference to object as an argument. When matching the argument, you may not want to compare the entire object against a fixed @@ -1262,7 +1262,7 @@ Matcher<Foo> IsFoo(const Foo& foo) { } ``` -#### Validating the Value Pointed to by a Pointer Argument +### Validating the Value Pointed to by a Pointer Argument C++ functions often take pointers as arguments. You can use matchers like `IsNull()`, `NotNull()`, and other comparison matchers to match a pointer, but @@ -1270,8 +1270,8 @@ what if you want to make sure the value *pointed to* by the pointer, instead of the pointer itself, has a certain property? Well, you can use the `Pointee(m)` matcher. -`Pointee(m)` matches a pointer if `m` matches the value the pointer points to. -For example: +`Pointee(m)` matches a pointer if and only if `m` matches the value the pointer +points to. For example: ```cpp using ::testing::Ge; @@ -1304,7 +1304,7 @@ What if you have a pointer to pointer? You guessed it - you can use nested `Pointee(Pointee(Lt(3)))` matches a pointer that points to a pointer that points to a number less than 3 (what a mouthful...). -#### Testing a Certain Property of an Object +### Testing a Certain Property of an Object Sometimes you want to specify that an object argument has a certain property, but there is no existing matcher that does this. If you want good error @@ -1350,7 +1350,7 @@ Matcher<const Foo&> BarPlusBazEq(int expected_sum) { EXPECT_CALL(..., DoThis(BarPlusBazEq(5)))...; ``` -#### Matching Containers +### Matching Containers Sometimes an STL container (e.g. list, vector, map, ...) is passed to a mock function and you may want to validate it. Since most STL containers support the @@ -1446,7 +1446,7 @@ using testing::Pair; with containers whose element order are undefined (e.g. `hash_map`) you should use `WhenSorted` around `ElementsAre`. -#### Sharing Matchers +### Sharing Matchers Under the hood, a gMock matcher object consists of a pointer to a ref-counted implementation object. Copying matchers is allowed and very efficient, as only @@ -1467,7 +1467,7 @@ using ::testing::Matcher; ... use in_range as a matcher in multiple EXPECT_CALLs ... ``` -#### Matchers must have no side-effects {#PureMatchers} +### Matchers must have no side-effects {#PureMatchers} WARNING: gMock does not guarantee when or how many times a matcher will be invoked. Therefore, all matchers must be *purely functional*: they cannot have @@ -1479,9 +1479,9 @@ it is one of the standard matchers, or a custom matcher). In particular, a matcher can never call a mock function, as that will affect the state of the mock object and gMock. -### Setting Expectations +## Setting Expectations -#### Knowing When to Expect {#UseOnCall} +### Knowing When to Expect {#UseOnCall} <!-- GOOGLETEST_CM0018 DO NOT DELETE --> @@ -1534,7 +1534,7 @@ message for specific methods by adding `EXPECT_CALL(...).Times(AnyNumber())`. DO NOT suppress it by blindly adding an `EXPECT_CALL(...)`, or you'll have a test that's a pain to maintain. -#### Ignoring Uninteresting Calls +### Ignoring Uninteresting Calls If you are not interested in how a mock method is called, just don't say anything about it. In this case, if the method is ever called, gMock will @@ -1547,7 +1547,7 @@ Please note that once you expressed interest in a particular mock method (via function is called but the arguments don't match any `EXPECT_CALL()` statement, it will be an error. -#### Disallowing Unexpected Calls +### Disallowing Unexpected Calls If a mock method shouldn't be called at all, explicitly say so: @@ -1573,7 +1573,7 @@ using ::testing::Gt; A call to `foo.Bar()` that doesn't match any of the `EXPECT_CALL()` statements will be an error. -#### Understanding Uninteresting vs Unexpected Calls {#uninteresting-vs-unexpected} +### Understanding Uninteresting vs Unexpected Calls {#uninteresting-vs-unexpected} *Uninteresting* calls and *unexpected* calls are different concepts in gMock. *Very* different. @@ -1648,7 +1648,7 @@ Note that the order of the two `EXPECT_CALL`s is important, as a newer For more on uninteresting calls, nice mocks, and strict mocks, read ["The Nice, the Strict, and the Naggy"](#NiceStrictNaggy). -#### Ignoring Uninteresting Arguments {#ParameterlessExpectations} +### Ignoring Uninteresting Arguments {#ParameterlessExpectations} If your test doesn't care about the parameters (it only cares about the number or order of calls), you can often simply omit the parameter list: @@ -1674,7 +1674,7 @@ SaveArg actions to [save the values for later verification](#SaveArgVerify). If you do that, you can easily differentiate calling the method the wrong number of times from calling it with the wrong arguments. -#### Expecting Ordered Calls {#OrderedCalls} +### Expecting Ordered Calls {#OrderedCalls} Although an `EXPECT_CALL()` statement defined earlier takes precedence when gMock tries to match a function call with an expectation, by default calls don't @@ -1705,7 +1705,7 @@ In this example, we expect a call to `foo.DoThis(5)`, followed by two calls to a call to `foo.DoThis(6)`. If a call occurred out-of-order, gMock will report an error. -#### Expecting Partially Ordered Calls {#PartialOrder} +### Expecting Partially Ordered Calls {#PartialOrder} Sometimes requiring everything to occur in a predetermined order can lead to brittle tests. For example, we may care about `A` occurring before both `B` and @@ -1763,7 +1763,7 @@ specifies the following DAG (where `s1` is `A -> B`, and `s2` is `A -> C -> D`): This means that A must occur before B and C, and C must occur before D. There's no restriction about the order other than these. -#### Controlling When an Expectation Retires +### Controlling When an Expectation Retires When a mock method is called, gMock only considers expectations that are still active. An expectation is active when created, and becomes inactive (aka @@ -1816,9 +1816,9 @@ Here #2 can be used only once, so if you have two warnings with the message `"File too large."`, the first will match #2 and the second will match #1 - there will be no error. -### Using Actions +## Using Actions -#### Returning References from Mock Methods +### Returning References from Mock Methods If a mock function's return type is a reference, you need to use `ReturnRef()` instead of `Return()` to return a result: @@ -1838,7 +1838,7 @@ class MockFoo : public Foo { ... ``` -#### Returning Live Values from Mock Methods +### Returning Live Values from Mock Methods The `Return(x)` action saves a copy of `x` when the action is created, and always returns the same value whenever it's executed. Sometimes you may want to @@ -1900,7 +1900,7 @@ using testing::ReturnPointee; EXPECT_EQ(42, foo.GetValue()); // This will succeed now. ``` -#### Combining Actions +### Combining Actions Want to do more than one thing when a function is called? That's fine. `DoAll()` allow you to do sequence of actions every time. Only the return value of the @@ -1922,7 +1922,7 @@ class MockFoo : public Foo { action_n)); ``` -#### Verifying Complex Arguments {#SaveArgVerify} +### Verifying Complex Arguments {#SaveArgVerify} If you want to verify that a method is called with a particular argument but the match criteria is complex, it can be difficult to distinguish between @@ -1946,7 +1946,7 @@ You can instead save the arguments and test them individually: EXPECT_THAT(actual_proto, EqualsProto( ... )); ``` -#### Mocking Side Effects {#MockingSideEffects} +### Mocking Side Effects {#MockingSideEffects} Sometimes a method exhibits its effect not via returning a value but via side effects. For example, it may change some global state or modify an output @@ -2045,7 +2045,7 @@ class MockRolodex : public Rolodex { .WillOnce(SetArrayArgument<0>(names.begin(), names.end())); ``` -#### Changing a Mock Object's Behavior Based on the State +### Changing a Mock Object's Behavior Based on the State If you expect a call to change the behavior of a mock object, you can use `::testing::InSequence` to specify different behaviors before and after the @@ -2091,7 +2091,7 @@ ACTION_P(ReturnPointee, p) { return *p; } Here `my_mock.GetPrevValue()` will always return the argument of the last `UpdateValue()` call. -#### Setting the Default Value for a Return Type {#DefaultValue} +### Setting the Default Value for a Return Type {#DefaultValue} If a mock method's return type is a built-in C++ type or pointer, by default it will return 0 when invoked. Also, in C++ 11 and above, a mock method whose @@ -2134,7 +2134,7 @@ to understand. We recommend you to use this feature judiciously. For example, you may want to make sure the `Set()` and `Clear()` calls are right next to the code that uses your mock. -#### Setting the Default Actions for a Mock Method +### Setting the Default Actions for a Mock Method You've learned how to change the default value of a given type. However, this may be too coarse for your purpose: perhaps you have two mock methods with the @@ -2172,7 +2172,7 @@ Note that both `ON_CALL` and `EXPECT_CALL` have the same "later statements take precedence" rule, but they don't interact. That is, `EXPECT_CALL`s have their own precedence order distinct from the `ON_CALL` precedence order. -#### Using Functions/Methods/Functors/Lambdas as Actions {#FunctionsAsActions} +### Using Functions/Methods/Functors/Lambdas as Actions {#FunctionsAsActions} If the built-in actions don't suit you, you can use an existing callable (function, `std::function`, method, functor, lambda as an action. @@ -2236,7 +2236,7 @@ as long as it's safe to do so - nice, huh? ... Invoke(implicit_cast<Closure*>(done)) ...; // The cast is necessary. ``` -#### Using Functions with Extra Info as Actions +### Using Functions with Extra Info as Actions The function or functor you call using `Invoke()` must have the same number of arguments as the mock function you use it for. Sometimes you may have a function @@ -2266,7 +2266,7 @@ TEST_F(FooTest, Test) { } ``` -#### Invoking a Function/Method/Functor/Lambda/Callback Without Arguments +### Invoking a Function/Method/Functor/Lambda/Callback Without Arguments `Invoke()` is very useful for doing actions that are more complex. It passes the mock function's arguments to the function, etc being invoked such that the @@ -2322,7 +2322,7 @@ bool Job2(int n, char c) { ... } // The cast is necessary. ``` -#### Invoking an Argument of the Mock Function +### Invoking an Argument of the Mock Function Sometimes a mock function will receive a function pointer, a functor (in other words, a "callable") as an argument, e.g. @@ -2421,7 +2421,7 @@ temporary value: // are kept inside the InvokeArgument action. ``` -#### Ignoring an Action's Result +### Ignoring an Action's Result Sometimes you have an action that returns *something*, but you need an action that returns `void` (perhaps you want to use it in a mock function that returns @@ -2459,7 +2459,7 @@ class MockFoo : public Foo { Note that you **cannot** use `IgnoreResult()` on an action that already returns `void`. Doing so will lead to ugly compiler errors. -#### Selecting an Action's Arguments {#SelectingArgs} +### Selecting an Action's Arguments {#SelectingArgs} Say you have a mock function `Foo()` that takes seven arguments, and you have a custom action that you want to invoke when `Foo()` is called. Trouble is, the @@ -2543,7 +2543,7 @@ Here are more tips: if the 4-th argument of the mock function is an `int` and `my_action` takes a `double`, `WithArg<4>(my_action)` will work. -#### Ignoring Arguments in Action Functions +### Ignoring Arguments in Action Functions The [selecting-an-action's-arguments](#SelectingArgs) recipe showed us one way to make a mock function and an action with incompatible argument lists fit @@ -2600,7 +2600,7 @@ double DistanceToOrigin(Unused, double x, double y) { .WillOnce(Invoke(DistanceToOrigin)); ``` -#### Sharing Actions +### Sharing Actions Just like matchers, a gMock action object consists of a pointer to a ref-counted implementation object. Therefore copying actions is also allowed and very @@ -2656,7 +2656,7 @@ using ::testing::Action; foo.DoThat(); // Returns 3 - the counter is shared. ``` -#### Testing Asynchronous Behavior +### Testing Asynchronous Behavior One oft-encountered problem with gMock is that it can be hard to test asynchronous behavior. Suppose you had a `EventQueue` class that you wanted to @@ -2705,9 +2705,9 @@ our test will run forever. It will eventually time-out and fail, but it will take longer and be slightly harder to debug. To alleviate this problem, you can use `WaitForNotificationWithTimeout(ms)` instead of `WaitForNotification()`. -### Misc Recipes on Using gMock +## Misc Recipes on Using gMock -#### Mocking Methods That Use Move-Only Types +### Mocking Methods That Use Move-Only Types C++11 introduced *move-only types*. A move-only-typed value can be moved from one object to another, but cannot be copied. `std::unique_ptr<T>` is probably @@ -2847,7 +2847,7 @@ implemented yet. If this is blocking you, please file a bug. A few actions (e.g. `DoAll`) copy their arguments internally, so they can never work with non-copyable objects; you'll have to use functors instead. -##### Legacy workarounds for move-only types {#LegacyMoveOnly} +#### Legacy workarounds for move-only types {#LegacyMoveOnly} Support for move-only function arguments was only introduced to gMock in April 2017. In older code, you may encounter the following workaround for the lack of @@ -2879,7 +2879,7 @@ method: mock_buzzer_.ShareBuzz(MakeUnique<Buzz>(AccessLevel::kInternal), 0); ``` -#### Making the Compilation Faster +### Making the Compilation Faster Believe it or not, the *vast majority* of the time spent on compiling a mock class is in generating its constructor and destructor, as they perform @@ -2943,7 +2943,7 @@ MockFoo::MockFoo() {} MockFoo::~MockFoo() {} ``` -#### Forcing a Verification +### Forcing a Verification When it's being destroyed, your friendly mock object will automatically verify that all expectations on it have been satisfied, and will generate googletest @@ -2984,7 +2984,7 @@ indicate whether the verification was successful (`true` for yes), so you can wrap that function call inside a `ASSERT_TRUE()` if there is no point going further when the verification has failed. -#### Using Check Points {#UsingCheckPoints} +### Using Check Points {#UsingCheckPoints} Sometimes you may want to "reset" a mock object at various check points in your test: at each check point, you verify that all existing expectations on the mock @@ -3048,7 +3048,7 @@ point "1", the second `Bar("a")` must happen after check point "2", and nothing should happen between the two check points. The explicit check points make it easy to tell which `Bar("a")` is called by which call to `Foo()`. -#### Mocking Destructors +### Mocking Destructors Sometimes you want to make sure a mock object is destructed at the right time, e.g. after `bar->A()` is called but before `bar->B()` is called. We already know @@ -3096,7 +3096,7 @@ testing when its `Die()` method is called: And that's that. -#### Using gMock and Threads {#UsingThreads} +### Using gMock and Threads {#UsingThreads} In a **unit** test, it's best if you could isolate and test a piece of code in a single-threaded context. That avoids race conditions and dead locks, and makes @@ -3154,7 +3154,7 @@ Also, remember that `DefaultValue<T>` is a global resource that potentially affects *all* living mock objects in your program. Naturally, you won't want to mess with it from multiple threads or when there still are mocks in action. -#### Controlling How Much Information gMock Prints +### Controlling How Much Information gMock Prints When gMock sees something that has the potential of being an error (e.g. a mock function with no expectation is called, a.k.a. an uninteresting call, which is @@ -3193,7 +3193,7 @@ warning messages, remember that you can control their amount with the Now, judiciously use the right flag to enable gMock serve you better! -#### Gaining Super Vision into Mock Calls +### Gaining Super Vision into Mock Calls You have a test using gMock. It fails: gMock tells you some expectations aren't satisfied. However, you aren't sure why: Is there a typo somewhere in the @@ -3273,7 +3273,7 @@ command line. <!-- GOOGLETEST_CM0025 DO NOT DELETE --> -#### Running Tests in Emacs +### Running Tests in Emacs If you build and run your tests in Emacs using the `M-x google-compile` command (as many googletest users do), the source file locations of gMock and googletest @@ -3293,9 +3293,9 @@ Then you can type `M-m` to start a build (if you want to run the test as well, just make sure `foo_test.run` or `runtests` is in the build command you supply after typing `M-m`), or `M-up`/`M-down` to move back and forth between errors. -### Extending gMock +## Extending gMock -#### Writing New Matchers Quickly {#NewMatchers} +### Writing New Matchers Quickly {#NewMatchers} WARNING: gMock does not guarantee when or how many times a matcher will be invoked. Therefore, all matchers must be functionally pure. See @@ -3409,7 +3409,7 @@ any type where the value of `(arg % 7) == 0` can be implicitly converted to a `int`, `arg_type` will be `int`; if it takes an `unsigned long`, `arg_type` will be `unsigned long`; and so on. -#### Writing New Parameterized Matchers Quickly +### Writing New Parameterized Matchers Quickly Sometimes you'll want to define a matcher that has parameters. For that you can use the macro: @@ -3546,7 +3546,7 @@ matcher parameters, which in general leads to better compiler error messages that pay off in the long run. They also allow overloading matchers based on parameter types (as opposed to just based on the number of parameters). -#### Writing New Monomorphic Matchers +### Writing New Monomorphic Matchers A matcher of argument type `T` implements `::testing::MatcherInterface<T>` and does two things: it tests whether a value of type `T` matches the matcher, and @@ -3573,7 +3573,7 @@ class MatcherInterface { public: virtual ~MatcherInterface(); - // Returns true if the matcher matches x; also explains the match + // Returns true if and only if the matcher matches x; also explains the match // result to 'listener'. virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0; @@ -3652,7 +3652,7 @@ Expected: is divisible by 7 Actual: 23 (the remainder is 2) ``` -#### Writing New Polymorphic Matchers +### Writing New Polymorphic Matchers You've learned how to write your own matchers in the previous recipe. Just one problem: a matcher created using `MakeMatcher()` only works for one particular @@ -3688,10 +3688,10 @@ class NotNullMatcher { } // Describes the property of a value matching this matcher. - void DescribeTo(::std::ostream* os) const { *os << "is not NULL"; } + void DescribeTo(std::ostream* os) const { *os << "is not NULL"; } // Describes the property of a value NOT matching this matcher. - void DescribeNegationTo(::std::ostream* os) const { *os << "is NULL"; } + void DescribeNegationTo(std::ostream* os) const { *os << "is NULL"; } }; // To construct a polymorphic matcher, pass an instance of the class @@ -3712,7 +3712,7 @@ virtual. Like in a monomorphic matcher, you may explain the match result by streaming additional information to the `listener` argument in `MatchAndExplain()`. -#### Writing New Cardinalities +### Writing New Cardinalities A cardinality is used in `Times()` to tell gMock how many times you expect a call to occur. It doesn't have to be exact. For example, you can say @@ -3727,14 +3727,15 @@ class CardinalityInterface { public: virtual ~CardinalityInterface(); - // Returns true if call_count calls will satisfy this cardinality. + // Returns true if and only if call_count calls will satisfy this cardinality. virtual bool IsSatisfiedByCallCount(int call_count) const = 0; - // Returns true if call_count calls will saturate this cardinality. + // Returns true if and only if call_count calls will saturate this + // cardinality. virtual bool IsSaturatedByCallCount(int call_count) const = 0; // Describes self to an ostream. - virtual void DescribeTo(::std::ostream* os) const = 0; + virtual void DescribeTo(std::ostream* os) const = 0; }; ``` @@ -3756,7 +3757,7 @@ class EvenNumberCardinality : public CardinalityInterface { return false; } - void DescribeTo(::std::ostream* os) const { + void DescribeTo(std::ostream* os) const { *os << "called even number of times"; } }; @@ -3770,7 +3771,7 @@ Cardinality EvenNumber() { .Times(EvenNumber()); ``` -#### Writing New Actions Quickly {#QuickNewActions} +### Writing New Actions Quickly {#QuickNewActions} If the built-in actions don't work for you, you can easily define your own one. Just define a functor class with a (possibly templated) call operator, matching @@ -3799,7 +3800,7 @@ struct MultiplyBy { // EXPECT_CALL(...).WillOnce(MultiplyBy{7}); ``` -##### Legacy macro-based Actions +#### Legacy macro-based Actions Before C++11, the functor-based actions were not supported; the old way of writing actions was through a set of `ACTION*` macros. We suggest to avoid them @@ -3878,7 +3879,7 @@ Pre-defined Symbol | Is Bound To `return_type` | the type `int` `function_type` | the type `int(bool, int*)` -##### Legacy macro-based parameterized Actions +#### Legacy macro-based parameterized Actions Sometimes you'll want to parameterize an action you define. For that we have another macro @@ -3937,7 +3938,7 @@ ACTION_P(Plus, a) { ... } ACTION_P2(Plus, a, b) { ... } ``` -#### Restricting the Type of an Argument or Parameter in an ACTION +### Restricting the Type of an Argument or Parameter in an ACTION For maximum brevity and reusability, the `ACTION*` macros don't ask you to provide the types of the mock function arguments and the action parameters. @@ -3965,7 +3966,7 @@ ACTION_P(Bar, param) { where `StaticAssertTypeEq` is a compile-time assertion in googletest that verifies two types are the same. -#### Writing New Action Templates Quickly +### Writing New Action Templates Quickly Sometimes you want to give an action explicit template parameters that cannot be inferred from its value parameters. `ACTION_TEMPLATE()` supports that and can be @@ -4035,7 +4036,7 @@ Are we using a single-template-parameter action where `bool` refers to the type of `x`, or a two-template-parameter action where the compiler is asked to infer the type of `x`? -#### Using the ACTION Object's Type +### Using the ACTION Object's Type If you are writing a function that returns an `ACTION` object, you'll need to know its type. The type depends on the macro used to define the action and the @@ -4062,7 +4063,7 @@ Note that we have to pick different suffixes (`Action`, `ActionP`, `ActionP2`, and etc) for actions with different numbers of value parameters, or the action definitions cannot be overloaded on the number of them. -#### Writing New Monomorphic Actions {#NewMonoActions} +### Writing New Monomorphic Actions {#NewMonoActions} While the `ACTION*` macros are very convenient, sometimes they are inappropriate. For example, despite the tricks shown in the previous recipes, @@ -4119,7 +4120,7 @@ Action<IncrementMethod> IncrementArgument() { foo.Baz(&n); // Should return 5 and change n to 6. ``` -#### Writing New Polymorphic Actions {#NewPolyActions} +### Writing New Polymorphic Actions {#NewPolyActions} The previous recipe showed you how to define your own action. This is all good, except that you need to know the type of the function in which the action will @@ -4195,7 +4196,7 @@ class MockFoo : public Foo { foo.DoThat(1, "Hi", "Bye"); // Will return "Hi". ``` -#### Teaching gMock How to Print Your Values +### Teaching gMock How to Print Your Values When an uninteresting or unexpected call occurs, gMock prints the argument values and the stack trace to help you debug. Assertion macros like @@ -4210,12 +4211,12 @@ prints the raw bytes in the value and hopes that you the user can figure it out. explains how to extend the printer to do a better job at printing your particular type than to dump the bytes. -### Useful Mocks Created Using gMock +## Useful Mocks Created Using gMock <!--#include file="includes/g3_testing_LOGs.md"--> <!--#include file="includes/g3_mock_callbacks.md"--> -#### Mock std::function {#MockFunction} +### Mock std::function {#MockFunction} `std::function` is a general function type introduced in C++11. It is a preferred way of passing callbacks to new interfaces. Functions are copiable, diff --git a/googlemock/docs/for_dummies.md b/googlemock/docs/for_dummies.md index e11c18d..93cf06f 100644 --- a/googlemock/docs/for_dummies.md +++ b/googlemock/docs/for_dummies.md @@ -213,7 +213,7 @@ specific domain much better than `Foo` does. Once you have a mock class, using it is easy. The typical work flow is: 1. Import the gMock names from the `testing` namespace such that you can use - them unqualified (You only have to do it once per file. Remember that + them unqualified (You only have to do it once per file). Remember that namespaces are a good idea. 2. Create some mock objects. 3. Specify your expectations on them (How many times will a method be called? diff --git a/googletest/docs/pump_manual.md b/googlemock/docs/pump_manual.md index 10b3c5f..10b3c5f 100644 --- a/googletest/docs/pump_manual.md +++ b/googlemock/docs/pump_manual.md diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index 9605c43..b040004 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -99,7 +99,8 @@ struct BuiltInDefaultValueGetter<T, false> { template <typename T> class BuiltInDefaultValue { public: - // This function returns true if type T has a built-in default value. + // This function returns true if and only if type T has a built-in default + // value. static bool Exists() { return ::std::is_default_constructible<T>::value; } @@ -208,7 +209,7 @@ class DefaultValue { producer_ = nullptr; } - // Returns true if the user has set the default value for type T. + // Returns true if and only if the user has set the default value for type T. static bool IsSet() { return producer_ != nullptr; } // Returns true if T has a default return value set by the user or there @@ -269,7 +270,7 @@ class DefaultValue<T&> { // Unsets the default value for type T&. static void Clear() { address_ = nullptr; } - // Returns true if the user has set the default value for type T&. + // Returns true if and only if the user has set the default value for type T&. static bool IsSet() { return address_ != nullptr; } // Returns true if T has a default return value set by the user or there @@ -375,7 +376,7 @@ class Action { template <typename Func> explicit Action(const Action<Func>& action) : fun_(action.fun_) {} - // Returns true if this is the DoDefault() action. + // Returns true if and only if this is the DoDefault() action. bool IsDoDefault() const { return fun_ == nullptr; } // Performs the action. Note that this method is const even though @@ -395,7 +396,7 @@ class Action { template <typename G> friend class Action; - // fun_ is an empty function if this is the DoDefault() action. + // fun_ is an empty function if and only if this is the DoDefault() action. ::std::function<F> fun_; }; @@ -619,7 +620,7 @@ class ReturnVoidAction { // Allows Return() to be used in any void-returning function. template <typename Result, typename ArgumentTuple> static void Perform(const ArgumentTuple&) { - CompileAssertTypesEqual<void, Result>(); + static_assert(std::is_void<Result>::value, "Result should be void."); } }; @@ -715,6 +716,36 @@ class ReturnRefOfCopyAction { GTEST_DISALLOW_ASSIGN_(ReturnRefOfCopyAction); }; +// Implements the polymorphic ReturnRoundRobin(v) action, which can be +// used in any function that returns the element_type of v. +template <typename T> +class ReturnRoundRobinAction { + public: + explicit ReturnRoundRobinAction(std::vector<T> values) { + GTEST_CHECK_(!values.empty()) + << "ReturnRoundRobin requires at least one element."; + state_->values = std::move(values); + } + + template <typename... Args> + T operator()(Args&&...) const { + return state_->Next(); + } + + private: + struct State { + T Next() { + T ret_val = values[i++]; + if (i == values.size()) i = 0; + return ret_val; + } + + std::vector<T> values; + size_t i = 0; + }; + std::shared_ptr<State> state_ = std::make_shared<State>(); +}; + // Implements the polymorphic DoDefault() action. class DoDefaultAction { public: @@ -842,7 +873,7 @@ class IgnoreResultAction { typedef typename internal::Function<F>::Result Result; // Asserts at compile time that F returns void. - CompileAssertTypesEqual<void, Result>(); + static_assert(std::is_void<Result>::value, "Result type should be void."); return Action<F>(new Impl<F>(action_)); } @@ -1021,6 +1052,10 @@ inline internal::ReturnRefAction<R> ReturnRef(R& x) { // NOLINT return internal::ReturnRefAction<R>(x); } +// Prevent using ReturnRef on reference to temporary. +template <typename R, R* = nullptr> +internal::ReturnRefAction<R> ReturnRef(R&&) = delete; + // Creates an action that returns the reference to a copy of the // argument. The copy is created when the action is constructed and // lives as long as the action. @@ -1038,6 +1073,23 @@ internal::ByMoveWrapper<R> ByMove(R x) { return internal::ByMoveWrapper<R>(std::move(x)); } +// Creates an action that returns an element of `vals`. Calling this action will +// repeatedly return the next value from `vals` until it reaches the end and +// will restart from the beginning. +template <typename T> +internal::ReturnRoundRobinAction<T> ReturnRoundRobin(std::vector<T> vals) { + return internal::ReturnRoundRobinAction<T>(std::move(vals)); +} + +// Creates an action that returns an element of `vals`. Calling this action will +// repeatedly return the next value from `vals` until it reaches the end and +// will restart from the beginning. +template <typename T> +internal::ReturnRoundRobinAction<T> ReturnRoundRobin( + std::initializer_list<T> vals) { + return internal::ReturnRoundRobinAction<T>(std::vector<T>(vals)); +} + // Creates an action that does the default action for the give mock function. inline internal::DoDefaultAction DoDefault() { return internal::DoDefaultAction(); @@ -1046,14 +1098,14 @@ inline internal::DoDefaultAction DoDefault() { // Creates an action that sets the variable pointed by the N-th // (0-based) function argument to 'value'. template <size_t N, typename T> -internal::SetArgumentPointeeAction<N, T> SetArgPointee(T x) { - return {std::move(x)}; +internal::SetArgumentPointeeAction<N, T> SetArgPointee(T value) { + return {std::move(value)}; } // The following version is DEPRECATED. template <size_t N, typename T> -internal::SetArgumentPointeeAction<N, T> SetArgumentPointee(T x) { - return {std::move(x)}; +internal::SetArgumentPointeeAction<N, T> SetArgumentPointee(T value) { + return {std::move(value)}; } // Creates an action that sets a pointer referent to a given value. diff --git a/googlemock/include/gmock/gmock-cardinalities.h b/googlemock/include/gmock/gmock-cardinalities.h index 4b269a3..46e01e1 100644 --- a/googlemock/include/gmock/gmock-cardinalities.h +++ b/googlemock/include/gmock/gmock-cardinalities.h @@ -70,10 +70,12 @@ class CardinalityInterface { virtual int ConservativeLowerBound() const { return 0; } virtual int ConservativeUpperBound() const { return INT_MAX; } - // Returns true if call_count calls will satisfy this cardinality. + // Returns true if and only if call_count calls will satisfy this + // cardinality. virtual bool IsSatisfiedByCallCount(int call_count) const = 0; - // Returns true if call_count calls will saturate this cardinality. + // Returns true if and only if call_count calls will saturate this + // cardinality. virtual bool IsSaturatedByCallCount(int call_count) const = 0; // Describes self to an ostream. @@ -98,17 +100,19 @@ class GTEST_API_ Cardinality { int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); } int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); } - // Returns true if call_count calls will satisfy this cardinality. + // Returns true if and only if call_count calls will satisfy this + // cardinality. bool IsSatisfiedByCallCount(int call_count) const { return impl_->IsSatisfiedByCallCount(call_count); } - // Returns true if call_count calls will saturate this cardinality. + // Returns true if and only if call_count calls will saturate this + // cardinality. bool IsSaturatedByCallCount(int call_count) const { return impl_->IsSaturatedByCallCount(call_count); } - // Returns true if call_count calls will over-saturate this + // Returns true if and only if call_count calls will over-saturate this // cardinality, i.e. exceed the maximum number of allowed calls. bool IsOverSaturatedByCallCount(int call_count) const { return impl_->IsSaturatedByCallCount(call_count) && diff --git a/googlemock/include/gmock/gmock-function-mocker.h b/googlemock/include/gmock/gmock-function-mocker.h index cc1535c..c529141 100644 --- a/googlemock/include/gmock/gmock-function-mocker.h +++ b/googlemock/include/gmock/gmock-function-mocker.h @@ -39,6 +39,13 @@ #include "gmock/gmock-generated-function-mockers.h" // NOLINT #include "gmock/internal/gmock-pp.h" +namespace testing { +namespace internal { +template <typename T> +using identity_t = T; +} // namespace internal +} // namespace testing + #define MOCK_METHOD(...) \ GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__) @@ -51,16 +58,17 @@ #define GMOCK_INTERNAL_MOCK_METHOD_ARG_3(_Ret, _MethodName, _Args) \ GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, ()) -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \ - GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \ - GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \ - GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \ - GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \ - GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \ - GMOCK_INTERNAL_MOCK_METHOD_IMPL( \ - GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \ - GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \ - GMOCK_INTERNAL_HAS_NOEXCEPT(_Spec), GMOCK_INTERNAL_GET_CALLTYPE(_Spec), \ +#define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \ + GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \ + GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \ + GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \ + GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \ + GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \ + GMOCK_INTERNAL_MOCK_METHOD_IMPL( \ + GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \ + GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \ + GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Spec), \ + GMOCK_INTERNAL_GET_CALLTYPE(_Spec), \ (GMOCK_INTERNAL_SIGNATURE(_Ret, _Args))) #define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \ @@ -100,15 +108,14 @@ GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec) #define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \ - _Override, _Final, _Noexcept, \ + _Override, _Final, _NoexceptSpec, \ _CallType, _Signature) \ typename ::testing::internal::Function<GMOCK_PP_REMOVE_PARENS( \ _Signature)>::Result \ GMOCK_INTERNAL_EXPAND(_CallType) \ _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \ - GMOCK_PP_IF(_Constness, const, ) GMOCK_PP_IF(_Noexcept, noexcept, ) \ - GMOCK_PP_IF(_Override, override, ) \ - GMOCK_PP_IF(_Final, final, ) { \ + GMOCK_PP_IF(_Constness, const, ) _NoexceptSpec \ + GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \ GMOCK_MOCKER_(_N, _Constness, _MethodName) \ .SetOwnerAndName(this, #_MethodName); \ return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ @@ -124,8 +131,7 @@ ::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \ const ::testing::internal::WithoutMatchers&, \ GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \ - GMOCK_PP_REMOVE_PARENS(_Signature)>*) \ - const GMOCK_PP_IF(_Noexcept, noexcept, ) { \ + GMOCK_PP_REMOVE_PARENS(_Signature)>*) const _NoexceptSpec { \ return GMOCK_PP_CAT(::testing::internal::AdjustConstness_, \ GMOCK_PP_IF(_Constness, const, ))(this) \ ->gmock_##_MethodName(GMOCK_PP_REPEAT( \ @@ -147,9 +153,13 @@ #define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \ GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple)) -#define GMOCK_INTERNAL_HAS_NOEXCEPT(_Tuple) \ - GMOCK_PP_HAS_COMMA( \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_NOEXCEPT, ~, _Tuple)) +#define GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Tuple) \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT, ~, _Tuple) + +#define GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT(_i, _, _elem) \ + GMOCK_PP_IF( \ + GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)), \ + _elem, ) #define GMOCK_INTERNAL_GET_CALLTYPE(_Tuple) \ GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_CALLTYPE_IMPL, ~, _Tuple) @@ -180,7 +190,6 @@ #define GMOCK_INTERNAL_DETECT_FINAL_I_final , -// TODO(iserna): Maybe noexcept should accept an argument here as well. #define GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem) \ GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_NOEXCEPT_I_, _elem) @@ -207,10 +216,24 @@ #define GMOCK_INTERNAL_IS_CALLTYPE_HELPER_Calltype -#define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \ - GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_Ret), GMOCK_PP_REMOVE_PARENS, \ - GMOCK_PP_IDENTITY) \ - (_Ret)(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args)) +// Note: The use of `identity_t` here allows _Ret to represent return types that +// would normally need to be specified in a different way. For example, a method +// returning a function pointer must be written as +// +// fn_ptr_return_t (*method(method_args_t...))(fn_ptr_args_t...) +// +// But we only support placing the return type at the beginning. To handle this, +// we wrap all calls in identity_t, so that a declaration will be expanded to +// +// identity_t<fn_ptr_return_t (*)(fn_ptr_args_t...)> method(method_args_t...) +// +// This allows us to work around the syntactic oddities of function/method +// types. +#define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \ + ::testing::internal::identity_t<GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_Ret), \ + GMOCK_PP_REMOVE_PARENS, \ + GMOCK_PP_IDENTITY)(_Ret)>( \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args)) #define GMOCK_INTERNAL_GET_TYPE(_i, _, _elem) \ GMOCK_PP_COMMA_IF(_i) \ diff --git a/googlemock/include/gmock/gmock-generated-actions.h b/googlemock/include/gmock/gmock-generated-actions.h index 981af78..cee96da 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h +++ b/googlemock/include/gmock/gmock-generated-actions.h @@ -663,7 +663,7 @@ class ActionHelper { typedef typename ::testing::internal::Function<F>::ArgumentTuple\ args_type;\ explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -726,7 +726,7 @@ class ActionHelper { typedef typename ::testing::internal::Function<F>::ArgumentTuple\ args_type;\ gmock_Impl() {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -776,7 +776,7 @@ class ActionHelper { args_type;\ explicit gmock_Impl(p0##_type gmock_p0) : \ p0(::std::forward<p0##_type>(gmock_p0)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -832,7 +832,7 @@ class ActionHelper { gmock_Impl(p0##_type gmock_p0, \ p1##_type gmock_p1) : p0(::std::forward<p0##_type>(gmock_p0)), \ p1(::std::forward<p1##_type>(gmock_p1)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -893,7 +893,7 @@ class ActionHelper { p2##_type gmock_p2) : p0(::std::forward<p0##_type>(gmock_p0)), \ p1(::std::forward<p1##_type>(gmock_p1)), \ p2(::std::forward<p2##_type>(gmock_p2)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -961,7 +961,7 @@ class ActionHelper { p1(::std::forward<p1##_type>(gmock_p1)), \ p2(::std::forward<p2##_type>(gmock_p2)), \ p3(::std::forward<p3##_type>(gmock_p3)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -1038,7 +1038,7 @@ class ActionHelper { p2(::std::forward<p2##_type>(gmock_p2)), \ p3(::std::forward<p3##_type>(gmock_p3)), \ p4(::std::forward<p4##_type>(gmock_p4)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -1119,7 +1119,7 @@ class ActionHelper { p3(::std::forward<p3##_type>(gmock_p3)), \ p4(::std::forward<p4##_type>(gmock_p4)), \ p5(::std::forward<p5##_type>(gmock_p5)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -1206,7 +1206,7 @@ class ActionHelper { p4(::std::forward<p4##_type>(gmock_p4)), \ p5(::std::forward<p5##_type>(gmock_p5)), \ p6(::std::forward<p6##_type>(gmock_p6)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -1302,7 +1302,7 @@ class ActionHelper { p5(::std::forward<p5##_type>(gmock_p5)), \ p6(::std::forward<p6##_type>(gmock_p6)), \ p7(::std::forward<p7##_type>(gmock_p7)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -1404,7 +1404,7 @@ class ActionHelper { p6(::std::forward<p6##_type>(gmock_p6)), \ p7(::std::forward<p7##_type>(gmock_p7)), \ p8(::std::forward<p8##_type>(gmock_p8)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -1513,7 +1513,7 @@ class ActionHelper { p7(::std::forward<p7##_type>(gmock_p7)), \ p8(::std::forward<p8##_type>(gmock_p8)), \ p9(::std::forward<p9##_type>(gmock_p9)) {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump index 209603c..283abcd 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h.pump +++ b/googlemock/include/gmock/gmock-generated-actions.h.pump @@ -395,7 +395,7 @@ $range k 0..n-1 typedef typename ::testing::internal::Function<F>::ArgumentTuple\ args_type;\ explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ @@ -482,7 +482,7 @@ $var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]] typedef typename ::testing::internal::Function<F>::ArgumentTuple\ args_type;\ [[$if i==1 [[explicit ]]]]gmock_Impl($ctor_param_list)$inits {}\ - virtual return_type Perform(const args_type& args) {\ + return_type Perform(const args_type& args) override {\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ diff --git a/googlemock/include/gmock/gmock-generated-matchers.h b/googlemock/include/gmock/gmock-generated-matchers.h index 690a57f..6189238 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h +++ b/googlemock/include/gmock/gmock-generated-matchers.h @@ -269,13 +269,13 @@ public:\ gmock_Impl()\ {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ private:\ @@ -318,13 +318,13 @@ public:\ explicit gmock_Impl(p0##_type gmock_p0)\ : p0(::std::move(gmock_p0)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -371,13 +371,13 @@ public:\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -431,13 +431,13 @@ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ p2(::std::move(gmock_p2)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -495,13 +495,13 @@ p3##_type gmock_p3)\ : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -568,13 +568,13 @@ : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ p4(::std::move(gmock_p4)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -644,13 +644,13 @@ : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -726,13 +726,13 @@ p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ p6(::std::move(gmock_p6)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -814,13 +814,13 @@ p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -909,13 +909,13 @@ p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \ p8(::std::move(gmock_p8)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ @@ -1009,13 +1009,13 @@ p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \ p8(::std::move(gmock_p8)), p9(::std::move(gmock_p9)) {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\ p0##_type const p0;\ diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index ae90917..69d2ae4 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -302,13 +302,13 @@ $var param_field_decls2 = [[$for j public:\ [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ $impl_inits {}\ - virtual bool MatchAndExplain(\ + bool MatchAndExplain(\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ + ::testing::MatchResultListener* result_listener) const override;\ + void DescribeTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(false);\ }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ + void DescribeNegationTo(::std::ostream* gmock_os) const override {\ *gmock_os << FormatDescription(true);\ }\$param_field_decls private:\ diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 7009215..b8ec24d 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -42,8 +42,8 @@ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ -#include <math.h> #include <algorithm> +#include <cmath> #include <initializer_list> #include <iterator> #include <limits> @@ -54,6 +54,7 @@ #include <type_traits> #include <utility> #include <vector> + #include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-port.h" #include "gtest/gtest.h" @@ -141,7 +142,7 @@ class MatcherCastImpl { template <bool Ignore> static Matcher<T> CastImpl(const M& polymorphic_matcher_or_value, std::true_type /* convertible_to_matcher */, - bool_constant<Ignore>) { + std::integral_constant<bool, Ignore>) { // M is implicitly convertible to Matcher<T>, which means that either // M is a polymorphic matcher or Matcher<T> has an implicit constructor // from M. In both cases using the implicit conversion will produce a @@ -358,8 +359,8 @@ template <size_t N> class TuplePrefix { public: // TuplePrefix<N>::Matches(matcher_tuple, value_tuple) returns true - // if the first N fields of matcher_tuple matches the first N - // fields of value_tuple, respectively. + // if and only if the first N fields of matcher_tuple matches + // the first N fields of value_tuple, respectively. template <typename MatcherTuple, typename ValueTuple> static bool Matches(const MatcherTuple& matcher_tuple, const ValueTuple& value_tuple) { @@ -417,8 +418,8 @@ class TuplePrefix<0> { ::std::ostream* /* os */) {} }; -// TupleMatches(matcher_tuple, value_tuple) returns true if all -// matchers in matcher_tuple match the corresponding fields in +// TupleMatches(matcher_tuple, value_tuple) returns true if and only if +// all matchers in matcher_tuple match the corresponding fields in // value_tuple. It is a compiler error if matcher_tuple and // value_tuple have different number of fields or incompatible field // types. @@ -757,8 +758,7 @@ class HasSubstrMatcher { template <typename MatcheeStringType> bool MatchAndExplain(const MatcheeStringType& s, MatchResultListener* /* listener */) const { - const StringType& s2(s); - return s2.find(substring_) != StringType::npos; + return StringType(s).find(substring_) != StringType::npos; } // Describes what this matcher matches. @@ -1349,6 +1349,22 @@ MakePredicateFormatterFromMatcher(M matcher) { return PredicateFormatterFromMatcher<M>(std::move(matcher)); } +// Implements the polymorphic IsNan() matcher, which matches any floating type +// value that is Nan. +class IsNanMatcher { + public: + template <typename FloatType> + bool MatchAndExplain(const FloatType& f, + MatchResultListener* /* listener */) const { + return (::std::isnan)(f); + } + + void DescribeTo(::std::ostream* os) const { *os << "is NaN"; } + void DescribeNegationTo(::std::ostream* os) const { + *os << "isn't NaN"; + } +}; + // Implements the polymorphic floating point equality matcher, which matches // two float values using ULP-based approximation or, optionally, a // user-specified epsilon. The template is meant to be instantiated with @@ -1409,7 +1425,7 @@ class FloatingEqMatcher { } const FloatType diff = value - expected_; - if (fabs(diff) <= max_abs_error_) { + if (::std::fabs(diff) <= max_abs_error_) { return true; } @@ -1607,8 +1623,8 @@ class PointeeMatcher { template <typename Pointer> class Impl : public MatcherInterface<Pointer> { public: - typedef typename PointeeOf<typename std::remove_const< - typename std::remove_reference<Pointer>::type>::type>::type Pointee; + typedef typename PointeeOf<GTEST_REMOVE_REFERENCE_AND_CONST_(Pointer)>::type + Pointee; explicit Impl(const InnerMatcher& matcher) : matcher_(MatcherCast<const Pointee&>(matcher)) {} @@ -1858,7 +1874,9 @@ struct CallableTraits { static void CheckIsValid(Functor /* functor */) {} template <typename T> - static auto Invoke(Functor f, T arg) -> decltype(f(arg)) { return f(arg); } + static auto Invoke(Functor f, const T& arg) -> decltype(f(arg)) { + return f(arg); + } }; // Specialization for function pointers. @@ -1889,7 +1907,7 @@ class ResultOfMatcher { template <typename T> operator Matcher<T>() const { - return Matcher<T>(new Impl<T>(callable_, matcher_)); + return Matcher<T>(new Impl<const T&>(callable_, matcher_)); } private: @@ -2068,15 +2086,15 @@ class ContainerEqMatcher { typedef typename View::type StlContainer; typedef typename View::const_reference StlContainerReference; + static_assert(!std::is_const<Container>::value, + "Container type must not be const"); + static_assert(!std::is_reference<Container>::value, + "Container type must not be a reference"); + // We make a copy of expected in case the elements in it are modified // after this matcher is created. explicit ContainerEqMatcher(const Container& expected) - : expected_(View::Copy(expected)) { - // Makes sure the user doesn't instantiate this class template - // with a const or reference type. - (void)testing::StaticAssertTypeEq<Container, - GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>(); - } + : expected_(View::Copy(expected)) {} void DescribeTo(::std::ostream* os) const { *os << "equals "; @@ -2243,15 +2261,15 @@ class PointwiseMatcher { typedef typename RhsView::type RhsStlContainer; typedef typename RhsStlContainer::value_type RhsValue; + static_assert(!std::is_const<RhsContainer>::value, + "RhsContainer type must not be const"); + static_assert(!std::is_reference<RhsContainer>::value, + "RhsContainer type must not be a reference"); + // Like ContainerEq, we make a copy of rhs in case the elements in // it are modified after this matcher is created. PointwiseMatcher(const TupleMatcher& tuple_matcher, const RhsContainer& rhs) - : tuple_matcher_(tuple_matcher), rhs_(RhsView::Copy(rhs)) { - // Makes sure the user doesn't instantiate this class template - // with a const or reference type. - (void)testing::StaticAssertTypeEq<RhsContainer, - GTEST_REMOVE_REFERENCE_AND_CONST_(RhsContainer)>(); - } + : tuple_matcher_(tuple_matcher), rhs_(RhsView::Copy(rhs)) {} template <typename LhsContainer> operator Matcher<LhsContainer>() const { @@ -2530,7 +2548,8 @@ class KeyMatcherImpl : public MatcherInterface<PairType> { testing::SafeMatcherCast<const KeyType&>(inner_matcher)) { } - // Returns true if 'key_value.first' (the key) matches the inner matcher. + // Returns true if and only if 'key_value.first' (the key) matches the inner + // matcher. bool MatchAndExplain(PairType key_value, MatchResultListener* listener) const override { StringMatchResultListener inner_listener; @@ -2612,8 +2631,8 @@ class PairMatcherImpl : public MatcherInterface<PairType> { second_matcher_.DescribeNegationTo(os); } - // Returns true if 'a_pair.first' matches first_matcher and 'a_pair.second' - // matches second_matcher. + // Returns true if and only if 'a_pair.first' matches first_matcher and + // 'a_pair.second' matches second_matcher. bool MatchAndExplain(PairType a_pair, MatchResultListener* listener) const override { if (!listener->IsInterested()) { @@ -3008,12 +3027,14 @@ class UnorderedElementsAreMatcherImpl element_printouts->clear(); ::std::vector<char> did_match; size_t num_elements = 0; + DummyMatchResultListener dummy; for (; elem_first != elem_last; ++num_elements, ++elem_first) { if (listener->IsInterested()) { element_printouts->push_back(PrintToString(*elem_first)); } for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) { - did_match.push_back(Matches(matchers_[irhs])(*elem_first)); + did_match.push_back( + matchers_[irhs].MatchAndExplain(*elem_first, &dummy)); } } @@ -3148,8 +3169,8 @@ class ElementsAreArrayMatcher { // Given a 2-tuple matcher tm of type Tuple2Matcher and a value second // of type Second, BoundSecondMatcher<Tuple2Matcher, Second>(tm, -// second) is a polymorphic matcher that matches a value x if tm -// matches tuple (x, second). Useful for implementing +// second) is a polymorphic matcher that matches a value x if and only if +// tm matches tuple (x, second). Useful for implementing // UnorderedPointwise() in terms of UnorderedElementsAreArray(). // // BoundSecondMatcher is copyable and assignable, as we need to put @@ -3213,8 +3234,8 @@ class BoundSecondMatcher { // Given a 2-tuple matcher tm and a value second, // MatcherBindSecond(tm, second) returns a matcher that matches a -// value x if tm matches tuple (x, second). Useful for implementing -// UnorderedPointwise() in terms of UnorderedElementsAreArray(). +// value x if and only if tm matches tuple (x, second). Useful for +// implementing UnorderedPointwise() in terms of UnorderedElementsAreArray(). template <typename Tuple2Matcher, typename Second> BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond( const Tuple2Matcher& tm, const Second& second) { @@ -3623,6 +3644,11 @@ inline internal::RefMatcher<T&> Ref(T& x) { // NOLINT return internal::RefMatcher<T&>(x); } +// Creates a polymorphic matcher that matches any NaN floating point. +inline PolymorphicMatcher<internal::IsNanMatcher> IsNan() { + return MakePolymorphicMatcher(internal::IsNanMatcher()); +} + // Creates a matcher that matches any double argument approximately // equal to rhs, where two NANs are considered unequal. inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) { @@ -3705,7 +3731,7 @@ WhenDynamicCastTo(const Matcher<To>& inner_matcher) { // Creates a matcher that matches an object whose given field matches // 'matcher'. For example, // Field(&Foo::number, Ge(5)) -// matches a Foo object x if x.number >= 5. +// matches a Foo object x if and only if x.number >= 5. template <typename Class, typename FieldType, typename FieldMatcher> inline PolymorphicMatcher< internal::FieldMatcher<Class, FieldType> > Field( @@ -3732,7 +3758,7 @@ inline PolymorphicMatcher<internal::FieldMatcher<Class, FieldType> > Field( // Creates a matcher that matches an object whose given property // matches 'matcher'. For example, // Property(&Foo::str, StartsWith("hi")) -// matches a Foo object x if x.str() starts with "hi". +// matches a Foo object x if and only if x.str() starts with "hi". template <typename Class, typename PropertyType, typename PropertyMatcher> inline PolymorphicMatcher<internal::PropertyMatcher< Class, PropertyType, PropertyType (Class::*)() const> > @@ -3787,11 +3813,10 @@ Property(const std::string& property_name, property_name, property, MatcherCast<const PropertyType&>(matcher))); } -// Creates a matcher that matches an object if the result of applying -// a callable to x matches 'matcher'. -// For example, +// Creates a matcher that matches an object if and only if the result of +// applying a callable to x matches 'matcher'. For example, // ResultOf(f, StartsWith("hi")) -// matches a Foo object x if f(x) starts with "hi". +// matches a Foo object x if and only if f(x) starts with "hi". // `callable` parameter can be a function, function pointer, or a functor. It is // required to keep no state affecting the results of the calls on it and make // no assumptions about how many calls will be made. Any state it keeps must be @@ -4341,7 +4366,7 @@ inline internal::MatcherAsPredicate<M> Matches(M matcher) { return internal::MatcherAsPredicate<M>(matcher); } -// Returns true if the value matches the matcher. +// Returns true if and only if the value matches the matcher. template <typename T, typename M> inline bool Value(const T& value, M matcher) { return testing::Matches(matcher)(value); @@ -4547,8 +4572,8 @@ PolymorphicMatcher<internal::variant_matcher::VariantMatcher<T> > VariantWith( // These macros allow using matchers to check values in Google Test // tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher) -// succeed if the value matches the matcher. If the assertion fails, -// the value and the description of the matcher will be printed. +// succeed if and only if the value matches the matcher. If the assertion +// fails, the value and the description of the matcher will be printed. #define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\ ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) #define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\ diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h index 66429df..80c13b5 100644 --- a/googlemock/include/gmock/gmock-spec-builders.h +++ b/googlemock/include/gmock/gmock-spec-builders.h @@ -332,7 +332,7 @@ class OnCallSpec : public UntypedOnCallSpecBase { return *this; } - // Returns true if the given arguments match the matchers. + // Returns true if and only if the given arguments match the matchers. bool Matches(const ArgumentTuple& args) const { return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); } @@ -390,7 +390,7 @@ class GTEST_API_ Mock { GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); // Verifies all expectations on the given mock object and clears its - // default actions and expectations. Returns true if the + // default actions and expectations. Returns true if and only if the // verification was successful. static bool VerifyAndClear(void* mock_obj) GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); @@ -516,7 +516,8 @@ class GTEST_API_ Expectation { // The compiler-generated copy ctor and operator= work exactly as // intended, so we don't need to define our own. - // Returns true if rhs references the same expectation as this object does. + // Returns true if and only if rhs references the same expectation as this + // object does. bool operator==(const Expectation& rhs) const { return expectation_base_ == rhs.expectation_base_; } @@ -598,8 +599,8 @@ class ExpectationSet { // The compiler-generator ctor and operator= works exactly as // intended, so we don't need to define our own. - // Returns true if rhs contains the same set of Expectation objects - // as this does. + // Returns true if and only if rhs contains the same set of Expectation + // objects as this does. bool operator==(const ExpectationSet& rhs) const { return expectations_ == rhs.expectations_; } @@ -760,8 +761,8 @@ class GTEST_API_ ExpectationBase { // by the subclasses to implement the .Times() clause. void SpecifyCardinality(const Cardinality& cardinality); - // Returns true if the user specified the cardinality explicitly - // using a .Times(). + // Returns true if and only if the user specified the cardinality + // explicitly using a .Times(). bool cardinality_specified() const { return cardinality_specified_; } // Sets the cardinality of this expectation spec. @@ -777,7 +778,7 @@ class GTEST_API_ ExpectationBase { void RetireAllPreRequisites() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); - // Returns true if this expectation is retired. + // Returns true if and only if this expectation is retired. bool is_retired() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); @@ -791,28 +792,29 @@ class GTEST_API_ ExpectationBase { retired_ = true; } - // Returns true if this expectation is satisfied. + // Returns true if and only if this expectation is satisfied. bool IsSatisfied() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return cardinality().IsSatisfiedByCallCount(call_count_); } - // Returns true if this expectation is saturated. + // Returns true if and only if this expectation is saturated. bool IsSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return cardinality().IsSaturatedByCallCount(call_count_); } - // Returns true if this expectation is over-saturated. + // Returns true if and only if this expectation is over-saturated. bool IsOverSaturated() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return cardinality().IsOverSaturatedByCallCount(call_count_); } - // Returns true if all pre-requisites of this expectation are satisfied. + // Returns true if and only if all pre-requisites of this expectation are + // satisfied. bool AllPrerequisitesAreSatisfied() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); @@ -855,7 +857,7 @@ class GTEST_API_ ExpectationBase { const char* file_; // The file that contains the expectation. int line_; // The line number of the expectation. const std::string source_text_; // The EXPECT_CALL(...) source text. - // True if the cardinality is specified explicitly. + // True if and only if the cardinality is specified explicitly. bool cardinality_specified_; Cardinality cardinality_; // The cardinality of the expectation. // The immediate pre-requisites (i.e. expectations that must be @@ -869,7 +871,7 @@ class GTEST_API_ ExpectationBase { // This group of fields are the current state of the expectation, // and can change as the mock function is called. int call_count_; // How many times this expectation has been invoked. - bool retired_; // True if this expectation has retired. + bool retired_; // True if and only if this expectation has retired. UntypedActions untyped_actions_; bool extra_matcher_specified_; bool repeated_action_specified_; // True if a WillRepeatedly() was specified. @@ -1087,14 +1089,15 @@ class TypedExpectation : public ExpectationBase { // statement finishes and when the current thread holds // g_gmock_mutex. - // Returns true if this expectation matches the given arguments. + // Returns true if and only if this expectation matches the given arguments. bool Matches(const ArgumentTuple& args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); } - // Returns true if this expectation should handle the given arguments. + // Returns true if and only if this expectation should handle the given + // arguments. bool ShouldHandleArguments(const ArgumentTuple& args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index 53b6d97..5fd169e 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -157,11 +157,8 @@ GMOCK_DECLARE_KIND_(long double, kFloatingPoint); static_cast< ::testing::internal::TypeKind>( \ ::testing::internal::KindOf<type>::value) -// Evaluates to true if integer type T is signed. -#define GMOCK_IS_SIGNED_(T) (static_cast<T>(-1) < 0) - // LosslessArithmeticConvertibleImpl<kFromKind, From, kToKind, To>::value -// is true if arithmetic type From can be losslessly converted to +// is true if and only if arithmetic type From can be losslessly converted to // arithmetic type To. // // It's the user's responsibility to ensure that both From and To are @@ -170,77 +167,42 @@ GMOCK_DECLARE_KIND_(long double, kFloatingPoint); // From, and kToKind is the kind of To; the value is // implementation-defined when the above pre-condition is violated. template <TypeKind kFromKind, typename From, TypeKind kToKind, typename To> -struct LosslessArithmeticConvertibleImpl : public std::false_type {}; - -// Converting bool to bool is lossless. -template <> -struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool> - : public std::true_type {}; - -// Converting bool to any integer type is lossless. -template <typename To> -struct LosslessArithmeticConvertibleImpl<kBool, bool, kInteger, To> - : public std::true_type {}; - -// Converting bool to any floating-point type is lossless. -template <typename To> -struct LosslessArithmeticConvertibleImpl<kBool, bool, kFloatingPoint, To> - : public std::true_type {}; - -// Converting an integer to bool is lossy. -template <typename From> -struct LosslessArithmeticConvertibleImpl<kInteger, From, kBool, bool> - : public std::false_type {}; - -// Converting an integer to another non-bool integer is lossless if -// the target type's range encloses the source type's range. -template <typename From, typename To> -struct LosslessArithmeticConvertibleImpl<kInteger, From, kInteger, To> - : public bool_constant< - // When converting from a smaller size to a larger size, we are - // fine as long as we are not converting from signed to unsigned. - ((sizeof(From) < sizeof(To)) && - (!GMOCK_IS_SIGNED_(From) || GMOCK_IS_SIGNED_(To))) || - // When converting between the same size, the signedness must match. - ((sizeof(From) == sizeof(To)) && - (GMOCK_IS_SIGNED_(From) == GMOCK_IS_SIGNED_(To)))> {}; // NOLINT - -#undef GMOCK_IS_SIGNED_ - -// Converting an integer to a floating-point type may be lossy, since -// the format of a floating-point number is implementation-defined. -template <typename From, typename To> -struct LosslessArithmeticConvertibleImpl<kInteger, From, kFloatingPoint, To> - : public std::false_type {}; - -// Converting a floating-point to bool is lossy. -template <typename From> -struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool> - : public std::false_type {}; - -// Converting a floating-point to an integer is lossy. -template <typename From, typename To> -struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kInteger, To> - : public std::false_type {}; - -// Converting a floating-point to another floating-point is lossless -// if the target type is at least as big as the source type. -template <typename From, typename To> -struct LosslessArithmeticConvertibleImpl< - kFloatingPoint, From, kFloatingPoint, To> - : public bool_constant<sizeof(From) <= sizeof(To)> {}; // NOLINT - -// LosslessArithmeticConvertible<From, To>::value is true if arithmetic -// type From can be losslessly converted to arithmetic type To. +using LosslessArithmeticConvertibleImpl = std::integral_constant< + bool, + // clang-format off + // Converting from bool is always lossless + (kFromKind == kBool) ? true + // Converting between any other type kinds will be lossy if the type + // kinds are not the same. + : (kFromKind != kToKind) ? false + : (kFromKind == kInteger && + // Converting between integers of different widths is allowed so long + // as the conversion does not go from signed to unsigned. + (((sizeof(From) < sizeof(To)) && + !(std::is_signed<From>::value && !std::is_signed<To>::value)) || + // Converting between integers of the same width only requires the + // two types to have the same signedness. + ((sizeof(From) == sizeof(To)) && + (std::is_signed<From>::value == std::is_signed<To>::value))) + ) ? true + // Floating point conversions are lossless if and only if `To` is at least + // as wide as `From`. + : (kFromKind == kFloatingPoint && (sizeof(From) <= sizeof(To))) ? true + : false + // clang-format on + >; + +// LosslessArithmeticConvertible<From, To>::value is true if and only if +// arithmetic type From can be losslessly converted to arithmetic type To. // // It's the user's responsibility to ensure that both From and To are // raw (i.e. has no CV modifier, is not a pointer, and is not a // reference) built-in arithmetic types; the value is // implementation-defined when the above pre-condition is violated. template <typename From, typename To> -struct LosslessArithmeticConvertible - : public LosslessArithmeticConvertibleImpl< - GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {}; // NOLINT +using LosslessArithmeticConvertible = + LosslessArithmeticConvertibleImpl<GMOCK_KIND_OF_(From), From, + GMOCK_KIND_OF_(To), To>; // This interface knows how to report a Google Mock failure (either // non-fatal or fatal). @@ -305,11 +267,11 @@ const char kWarningVerbosity[] = "warning"; // No logs are printed. const char kErrorVerbosity[] = "error"; -// Returns true if a log with the given severity is visible according -// to the --gmock_verbose flag. +// Returns true if and only if a log with the given severity is visible +// according to the --gmock_verbose flag. GTEST_API_ bool LogIsVisible(LogSeverity severity); -// Prints the given message to stdout if 'severity' >= the level +// Prints the given message to stdout if and only if 'severity' >= the level // specified by the --gmock_verbose flag. If stack_frames_to_skip >= // 0, also prints the stack trace excluding the top // stack_frames_to_skip frames. In opt mode, any positive @@ -334,8 +296,6 @@ class WithoutMatchers { // Internal use only: access the singleton instance of WithoutMatchers. GTEST_API_ WithoutMatchers GetWithoutMatchers(); -// Type traits. - // Disable MSVC warnings for infinite recursion, since in this case the // the recursion is unreachable. #ifdef _MSC_VER @@ -384,9 +344,8 @@ class StlContainerView { typedef const type& const_reference; static const_reference ConstReference(const RawContainer& container) { - // Ensures that RawContainer is not a const type. - testing::StaticAssertTypeEq< - RawContainer, typename std::remove_const<RawContainer>::type>(); + static_assert(!std::is_const<RawContainer>::value, + "RawContainer type must not be const"); return container; } static type Copy(const RawContainer& container) { return container; } @@ -406,8 +365,8 @@ class StlContainerView<Element[N]> { typedef const type const_reference; static const_reference ConstReference(const Element (&array)[N]) { - // Ensures that Element is not a const type. - testing::StaticAssertTypeEq<Element, RawElement>(); + static_assert(std::is_same<Element, RawElement>::value, + "Element type must not be const"); return type(array, N, RelationToSourceReference()); } static type Copy(const Element (&array)[N]) { @@ -493,8 +452,7 @@ struct Function<R(Args...)> { using Result = R; static constexpr size_t ArgumentCount = sizeof...(Args); template <size_t I> - using Arg = ElemFromList<I, typename MakeIndexSequence<sizeof...(Args)>::type, - Args...>; + using Arg = ElemFromList<I, Args...>; using ArgumentTuple = std::tuple<Args...>; using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>; using MakeResultVoid = void(Args...); diff --git a/googlemock/include/gmock/internal/gmock-pp.h b/googlemock/include/gmock/internal/gmock-pp.h index 1ab80e1..c3759f6 100644 --- a/googlemock/include/gmock/internal/gmock-pp.h +++ b/googlemock/include/gmock/internal/gmock-pp.h @@ -1,19 +1,6 @@ #ifndef THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_PP_H_ #define THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_PP_H_ -#undef GMOCK_PP_INTERNAL_USE_MSVC -#if defined(__clang__) -#define GMOCK_PP_INTERNAL_USE_MSVC 0 -#elif defined(_MSC_VER) -// TODO(iserna): Also verify tradional versus comformant preprocessor. -static_assert( - _MSC_VER >= 1900, - "MSVC version not supported. There is support for MSVC 14.0 and above."); -#define GMOCK_PP_INTERNAL_USE_MSVC 1 -#else -#define GMOCK_PP_INTERNAL_USE_MSVC 0 -#endif - // Expands and concatenates the arguments. Constructed macros reevaluate. #define GMOCK_PP_CAT(_1, _2) GMOCK_PP_INTERNAL_CAT(_1, _2) @@ -29,10 +16,6 @@ static_assert( // Returns the only argument. #define GMOCK_PP_IDENTITY(_1) _1 -// MSVC preprocessor collapses __VA_ARGS__ in a single argument, we use a -// CAT-like directive to force correct evaluation. Each macro has its own. -#if GMOCK_PP_INTERNAL_USE_MSVC - // Evaluates to the number of arguments after expansion. // // #define PAIR x, y @@ -43,45 +26,27 @@ static_assert( // GMOCK_PP_NARG(PAIR) => 2 // // Requires: the number of arguments after expansion is at most 15. -#define GMOCK_PP_NARG(...) \ - GMOCK_PP_INTERNAL_NARG_CAT( \ - GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, \ - 8, 7, 6, 5, 4, 3, 2, 1), ) +#define GMOCK_PP_NARG(...) \ + GMOCK_PP_INTERNAL_16TH( \ + (__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)) // Returns 1 if the expansion of arguments has an unprotected comma. Otherwise // returns 0. Requires no more than 15 unprotected commas. -#define GMOCK_PP_HAS_COMMA(...) \ - GMOCK_PP_INTERNAL_HAS_COMMA_CAT( \ - GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 0), ) +#define GMOCK_PP_HAS_COMMA(...) \ + GMOCK_PP_INTERNAL_16TH( \ + (__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)) + // Returns the first argument. -#define GMOCK_PP_HEAD(...) \ - GMOCK_PP_INTERNAL_HEAD_CAT(GMOCK_PP_INTERNAL_HEAD(__VA_ARGS__), ) +#define GMOCK_PP_HEAD(...) GMOCK_PP_INTERNAL_HEAD((__VA_ARGS__)) // Returns the tail. A variadic list of all arguments minus the first. Requires // at least one argument. -#define GMOCK_PP_TAIL(...) \ - GMOCK_PP_INTERNAL_TAIL_CAT(GMOCK_PP_INTERNAL_TAIL(__VA_ARGS__), ) +#define GMOCK_PP_TAIL(...) GMOCK_PP_INTERNAL_TAIL((__VA_ARGS__)) // Calls CAT(_Macro, NARG(__VA_ARGS__))(__VA_ARGS__) #define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ - GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT( \ - GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__), ) - -#else // GMOCK_PP_INTERNAL_USE_MSVC - -#define GMOCK_PP_NARG(...) \ - GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, \ - 7, 6, 5, 4, 3, 2, 1) -#define GMOCK_PP_HAS_COMMA(...) \ - GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 0) -#define GMOCK_PP_HEAD(...) GMOCK_PP_INTERNAL_HEAD(__VA_ARGS__) -#define GMOCK_PP_TAIL(...) GMOCK_PP_INTERNAL_TAIL(__VA_ARGS__) -#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ - GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__) - -#endif // GMOCK_PP_INTERNAL_USE_MSVC + GMOCK_PP_IDENTITY( \ + GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__)) // If the arguments after expansion have no tokens, evaluates to `1`. Otherwise // evaluates to `0`. @@ -139,10 +104,9 @@ static_assert( // Expands to 1 if the first argument starts with something in parentheses, // otherwise to 0. -#define GMOCK_PP_IS_BEGIN_PARENS(...) \ - GMOCK_PP_INTERNAL_ALTERNATE_HEAD( \ - GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_, \ - GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C __VA_ARGS__)) +#define GMOCK_PP_IS_BEGIN_PARENS(...) \ + GMOCK_PP_HEAD(GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_, \ + GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C __VA_ARGS__)) // Expands to 1 is there is only one argument and it is enclosed in parentheses. #define GMOCK_PP_IS_ENCLOSED_PARENS(...) \ @@ -179,10 +143,6 @@ static_assert( #define GMOCK_PP_INTENRAL_EMPTY_TUPLE (, , , , , , , , , , , , , , , ) #define GMOCK_PP_INTERNAL_CAT(_1, _2) _1##_2 #define GMOCK_PP_INTERNAL_STRINGIZE(...) #__VA_ARGS__ -#define GMOCK_PP_INTERNAL_INTERNAL_16TH(_1, _2, _3, _4, _5, _6, _7, _8, _9, \ - _10, _11, _12, _13, _14, _15, _16, \ - ...) \ - _16 #define GMOCK_PP_INTERNAL_CAT_5(_1, _2, _3, _4, _5) _1##_2##_3##_4##_5 #define GMOCK_PP_INTERNAL_IS_EMPTY(_1, _2, _3, _4) \ GMOCK_PP_HAS_COMMA(GMOCK_PP_INTERNAL_CAT_5(GMOCK_PP_INTERNAL_IS_EMPTY_CASE_, \ @@ -190,30 +150,24 @@ static_assert( #define GMOCK_PP_INTERNAL_IS_EMPTY_CASE_0001 , #define GMOCK_PP_INTERNAL_IF_1(_Then, _Else) _Then #define GMOCK_PP_INTERNAL_IF_0(_Then, _Else) _Else -#define GMOCK_PP_INTERNAL_HEAD(_1, ...) _1 -#define GMOCK_PP_INTERNAL_TAIL(_1, ...) __VA_ARGS__ -#if GMOCK_PP_INTERNAL_USE_MSVC -#define GMOCK_PP_INTERNAL_NARG_CAT(_1, _2) GMOCK_PP_INTERNAL_NARG_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_HEAD_CAT(_1, _2) GMOCK_PP_INTERNAL_HEAD_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_HAS_COMMA_CAT(_1, _2) \ - GMOCK_PP_INTERNAL_HAS_COMMA_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_TAIL_CAT(_1, _2) GMOCK_PP_INTERNAL_TAIL_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT(_1, _2) \ - GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_NARG_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_HEAD_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_HAS_COMMA_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_TAIL_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_ALTERNATE_HEAD(...) \ - GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT(GMOCK_PP_HEAD(__VA_ARGS__), ) -#define GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT(_1, _2) \ - GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT_I(_1, _2) _1##_2 -#else // GMOCK_PP_INTERNAL_USE_MSVC -#define GMOCK_PP_INTERNAL_ALTERNATE_HEAD(...) GMOCK_PP_HEAD(__VA_ARGS__) -#endif // GMOCK_PP_INTERNAL_USE_MSVC +// Because of MSVC treating a token with a comma in it as a single token when +// passed to another macro, we need to force it to evaluate it as multiple +// tokens. We do that by using a "IDENTITY(MACRO PARENTHESIZED_ARGS)" macro. We +// define one per possible macro that relies on this behavior. Note "_Args" must +// be parenthesized. +#define GMOCK_PP_INTERNAL_INTERNAL_16TH(_1, _2, _3, _4, _5, _6, _7, _8, _9, \ + _10, _11, _12, _13, _14, _15, _16, \ + ...) \ + _16 +#define GMOCK_PP_INTERNAL_16TH(_Args) \ + GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_16TH _Args) +#define GMOCK_PP_INTERNAL_INTERNAL_HEAD(_1, ...) _1 +#define GMOCK_PP_INTERNAL_HEAD(_Args) \ + GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_HEAD _Args) +#define GMOCK_PP_INTERNAL_INTERNAL_TAIL(_1, ...) __VA_ARGS__ +#define GMOCK_PP_INTERNAL_TAIL(_Args) \ + GMOCK_PP_IDENTITY(GMOCK_PP_INTERNAL_INTERNAL_TAIL _Args) #define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C(...) 1 _ #define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_1 1, diff --git a/googlemock/scripts/README.md b/googlemock/scripts/README.md new file mode 100644 index 0000000..fa359fe --- /dev/null +++ b/googlemock/scripts/README.md @@ -0,0 +1,5 @@ +# 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. diff --git a/googlemock/scripts/generator/cpp/ast.py b/googlemock/scripts/generator/cpp/ast.py index f14728b..f6331d8 100755 --- a/googlemock/scripts/generator/cpp/ast.py +++ b/googlemock/scripts/generator/cpp/ast.py @@ -17,10 +17,7 @@ """Generate an Abstract Syntax Tree (AST) for C++.""" -__author__ = 'nnorwitz@google.com (Neal Norwitz)' - - -# TODO: +# FIXME: # * Tokens should never be exported, need to convert to Nodes # (return types, parameters, etc.) # * Handle static class data for templatized classes @@ -338,7 +335,7 @@ class Class(_GenericDeclaration): # TODO(nnorwitz): handle namespaces, etc. if self.bases: for token_list in self.bases: - # TODO(nnorwitz): bases are tokens, do name comparison. + # TODO(nnorwitz): bases are tokens, do name comparision. for token in token_list: if token.name == node.name: return True @@ -381,7 +378,7 @@ class Function(_GenericDeclaration): def Requires(self, node): if self.parameters: - # TODO(nnorwitz): parameters are tokens, do name comparison. + # TODO(nnorwitz): parameters are tokens, do name comparision. for p in self.parameters: if p.name == node.name: return True @@ -521,7 +518,7 @@ class TypeConverter(object): elif token.name == '&': reference = True elif token.name == '[': - pointer = True + pointer = True elif token.name == ']': pass else: @@ -579,7 +576,7 @@ class TypeConverter(object): elif p.name not in ('*', '&', '>'): # Ensure that names have a space between them. if (type_name and type_name[-1].token_type == tokenize.NAME and - p.token_type == tokenize.NAME): + p.token_type == tokenize.NAME): type_name.append(tokenize.Token(tokenize.SYNTAX, ' ', 0, 0)) type_name.append(p) else: @@ -655,7 +652,7 @@ class TypeConverter(object): start = return_type_seq[0].start end = return_type_seq[-1].end _, name, templated_types, modifiers, default, other_tokens = \ - self.DeclarationToParts(return_type_seq, False) + self.DeclarationToParts(return_type_seq, False) names = [n.name for n in other_tokens] reference = '&' in names pointer = '*' in names @@ -739,6 +736,14 @@ class AstBuilder(object): if token.token_type == tokenize.NAME: if (keywords.IsKeyword(token.name) and not keywords.IsBuiltinType(token.name)): + if token.name == 'enum': + # Pop the next token and only put it back if it's not + # 'class'. This allows us to support the two-token + # 'enum class' keyword as if it were simply 'enum'. + next = self._GetNextToken() + if next.name != 'class': + self._AddBackToken(next) + method = getattr(self, 'handle_' + token.name) return method() elif token.name == self.in_class_name_only: @@ -754,7 +759,8 @@ class AstBuilder(object): # Handle data or function declaration/definition. syntax = tokenize.SYNTAX temp_tokens, last_token = \ - self._GetVarTokensUpTo(syntax, '(', ';', '{', '[') + self._GetVarTokensUpToIgnoringTemplates(syntax, + '(', ';', '{', '[') temp_tokens.insert(0, token) if last_token.name == '(': # If there is an assignment before the paren, @@ -810,7 +816,7 @@ class AstBuilder(object): # self.in_class can contain A::Name, but the dtor will only # be Name. Make sure to compare against the right value. if (token.token_type == tokenize.NAME and - token.name == self.in_class_name_only): + token.name == self.in_class_name_only): return self._GetMethod([token], FUNCTION_DTOR, None, True) # TODO(nnorwitz): handle a lot more syntax. elif token.token_type == tokenize.PREPROCESSOR: @@ -858,7 +864,25 @@ class AstBuilder(object): last_token = self._GetNextToken() return tokens, last_token - # TODO(nnorwitz): remove _IgnoreUpTo() it shouldn't be necessary. + # Same as _GetVarTokensUpTo, but skips over '<...>' which could contain an + # expected token. + def _GetVarTokensUpToIgnoringTemplates(self, expected_token_type, + *expected_tokens): + last_token = self._GetNextToken() + tokens = [] + nesting = 0 + while (nesting > 0 or + last_token.token_type != expected_token_type or + last_token.name not in expected_tokens): + tokens.append(last_token) + last_token = self._GetNextToken() + if last_token.name == '<': + nesting += 1 + elif last_token.name == '>': + nesting -= 1 + return tokens, last_token + + # TODO(nnorwitz): remove _IgnoreUpTo() it shouldn't be necesary. def _IgnoreUpTo(self, token_type, token): unused_tokens = self._GetTokensUpTo(token_type, token) @@ -905,7 +929,10 @@ class AstBuilder(object): def _GetNextToken(self): if self.token_queue: return self.token_queue.pop() - return next(self.tokens) + try: + return next(self.tokens) + except StopIteration: + return def _AddBackToken(self, token): if token.whence == tokenize.WHENCE_STREAM: @@ -1105,7 +1132,7 @@ class AstBuilder(object): # Looks like we got a method, not a function. if len(return_type) > 2 and return_type[-1].name == '::': return_type, in_class = \ - self._GetReturnTypeAndClassName(return_type) + self._GetReturnTypeAndClassName(return_type) return Method(indices.start, indices.end, name.name, in_class, return_type, parameters, modifiers, templated_types, body, self.namespace_stack) @@ -1264,9 +1291,6 @@ class AstBuilder(object): return self._GetNestedType(Union) def handle_enum(self): - token = self._GetNextToken() - if not (token.token_type == tokenize.NAME and token.name == 'class'): - self._AddBackToken(token) return self._GetNestedType(Enum) def handle_auto(self): @@ -1298,7 +1322,8 @@ class AstBuilder(object): if token2.token_type == tokenize.SYNTAX and token2.name == '~': return self.GetMethod(FUNCTION_VIRTUAL + FUNCTION_DTOR, None) assert token.token_type == tokenize.NAME or token.name == '::', token - return_type_and_name = self._GetTokensUpTo(tokenize.SYNTAX, '(') # ) + return_type_and_name, _ = self._GetVarTokensUpToIgnoringTemplates( + tokenize.SYNTAX, '(') # ) return_type_and_name.insert(0, token) if token2 is not token: return_type_and_name.insert(1, token2) @@ -1352,7 +1377,7 @@ class AstBuilder(object): def handle_typedef(self): token = self._GetNextToken() if (token.token_type == tokenize.NAME and - keywords.IsKeyword(token.name)): + keywords.IsKeyword(token.name)): # Token must be struct/enum/union/class. method = getattr(self, 'handle_' + token.name) self._handling_typedef = True @@ -1375,7 +1400,7 @@ class AstBuilder(object): if name.name == ')': # HACK(nnorwitz): Handle pointers to functions "properly". if (len(tokens) >= 4 and - tokens[1].name == '(' and tokens[2].name == '*'): + tokens[1].name == '(' and tokens[2].name == '*'): tokens.append(name) name = tokens[3] elif name.name == ']': diff --git a/googlemock/scripts/generator/cpp/gmock_class.py b/googlemock/scripts/generator/cpp/gmock_class.py index f9966cb..89862ae 100755 --- a/googlemock/scripts/generator/cpp/gmock_class.py +++ b/googlemock/scripts/generator/cpp/gmock_class.py @@ -26,9 +26,6 @@ Usage: Output is sent to stdout. """ -__author__ = 'nnorwitz@google.com (Neal Norwitz)' - - import os import re import sys @@ -38,190 +35,214 @@ from cpp import utils # Preserve compatibility with Python 2.3. try: - _dummy = set + _dummy = set except NameError: - import sets - set = sets.Set + import sets + + set = sets.Set _VERSION = (1, 0, 1) # The version of this script. # How many spaces to indent. Can set me with the INDENT environment variable. _INDENT = 2 -def _GenerateMethods(output_lines, source, class_node): - function_type = (ast.FUNCTION_VIRTUAL | ast.FUNCTION_PURE_VIRTUAL | - ast.FUNCTION_OVERRIDE) - ctor_or_dtor = ast.FUNCTION_CTOR | ast.FUNCTION_DTOR - indent = ' ' * _INDENT - - for node in class_node.body: - # We only care about virtual functions. - if (isinstance(node, ast.Function) and - node.modifiers & function_type and - not node.modifiers & ctor_or_dtor): - # Pick out all the elements we need from the original function. - const = '' - if node.modifiers & ast.FUNCTION_CONST: - const = 'CONST_' - return_type = 'void' - if node.return_type: - # Add modifiers like 'const'. - modifiers = '' - if node.return_type.modifiers: - modifiers = ' '.join(node.return_type.modifiers) + ' ' - return_type = modifiers + node.return_type.name - template_args = [arg.name for arg in node.return_type.templated_types] - if template_args: - return_type += '<' + ', '.join(template_args) + '>' - if len(template_args) > 1: - for line in [ - '// The following line won\'t really compile, as the return', - '// type has multiple template arguments. To fix it, use a', - '// typedef for the return type.']: - output_lines.append(indent + line) - if node.return_type.pointer: - return_type += '*' - if node.return_type.reference: - return_type += '&' - num_parameters = len(node.parameters) - if len(node.parameters) == 1: - first_param = node.parameters[0] - if source[first_param.start:first_param.end].strip() == 'void': +def _RenderType(ast_type): + """Renders the potentially recursively templated type into a string. + + Args: + ast_type: The AST of the type. + + Returns: + Rendered string and a boolean to indicate whether we have multiple args + (which is not handled correctly). + """ + has_multiarg_error = False + # Add modifiers like 'const'. + modifiers = '' + if ast_type.modifiers: + modifiers = ' '.join(ast_type.modifiers) + ' ' + return_type = modifiers + ast_type.name + if ast_type.templated_types: + # Collect template args. + template_args = [] + for arg in ast_type.templated_types: + rendered_arg, e = _RenderType(arg) + if e: has_multiarg_error = True + template_args.append(rendered_arg) + return_type += '<' + ', '.join(template_args) + '>' + # We are actually not handling multi-template-args correctly. So mark it. + if len(template_args) > 1: + has_multiarg_error = True + if ast_type.pointer: + return_type += '*' + if ast_type.reference: + return_type += '&' + return return_type, has_multiarg_error + + +def _GetNumParameters(parameters, source): + num_parameters = len(parameters) + if num_parameters == 1: + first_param = parameters[0] + if source[first_param.start:first_param.end].strip() == 'void': # We must treat T(void) as a function with no parameters. - num_parameters = 0 - tmpl = '' - if class_node.templated_types: - tmpl = '_T' - mock_method_macro = 'MOCK_%sMETHOD%d%s' % (const, num_parameters, tmpl) - - args = '' - if node.parameters: - # Due to the parser limitations, it is impossible to keep comments - # while stripping the default parameters. When defaults are - # present, we choose to strip them and comments (and produce - # compilable code). - # TODO(nnorwitz@google.com): Investigate whether it is possible to - # preserve parameter name when reconstructing parameter text from - # the AST. - if len([param for param in node.parameters if param.default]) > 0: - args = ', '.join(param.type.name for param in node.parameters) - else: - # Get the full text of the parameters from the start - # of the first parameter to the end of the last parameter. - start = node.parameters[0].start - end = node.parameters[-1].end - # Remove // comments. - args_strings = re.sub(r'//.*', '', source[start:end]) - # Condense multiple spaces and eliminate newlines putting the - # parameters together on a single line. Ensure there is a - # space in an argument which is split by a newline without - # intervening whitespace, e.g.: int\nBar - args = re.sub(' +', ' ', args_strings.replace('\n', ' ')) - - # Create the mock method definition. - output_lines.extend(['%s%s(%s,' % (indent, mock_method_macro, node.name), - '%s%s(%s));' % (indent*3, return_type, args)]) + return 0 + return num_parameters + + +def _GenerateMethods(output_lines, source, class_node): + function_type = (ast.FUNCTION_VIRTUAL | ast.FUNCTION_PURE_VIRTUAL | + ast.FUNCTION_OVERRIDE) + ctor_or_dtor = ast.FUNCTION_CTOR | ast.FUNCTION_DTOR + indent = ' ' * _INDENT + + for node in class_node.body: + # We only care about virtual functions. + if (isinstance(node, ast.Function) and + node.modifiers & function_type and + not node.modifiers & ctor_or_dtor): + # Pick out all the elements we need from the original function. + const = '' + if node.modifiers & ast.FUNCTION_CONST: + const = 'CONST_' + num_parameters = _GetNumParameters(node.parameters, source) + return_type = 'void' + if node.return_type: + return_type, has_multiarg_error = _RenderType(node.return_type) + if has_multiarg_error: + for line in [ + '// The following line won\'t really compile, as the return', + '// type has multiple template arguments. To fix it, use a', + '// typedef for the return type.']: + output_lines.append(indent + line) + tmpl = '' + if class_node.templated_types: + tmpl = '_T' + mock_method_macro = 'MOCK_%sMETHOD%d%s' % (const, num_parameters, tmpl) + + args = '' + if node.parameters: + # Get the full text of the parameters from the start + # of the first parameter to the end of the last parameter. + start = node.parameters[0].start + end = node.parameters[-1].end + # Remove // comments. + args_strings = re.sub(r'//.*', '', source[start:end]) + # Remove /* comments */. + args_strings = re.sub(r'/\*.*\*/', '', args_strings) + # Remove default arguments. + args_strings = re.sub(r'=.*,', ',', args_strings) + args_strings = re.sub(r'=.*', '', args_strings) + # Condense multiple spaces and eliminate newlines putting the + # parameters together on a single line. Ensure there is a + # space in an argument which is split by a newline without + # intervening whitespace, e.g.: int\nBar + args = re.sub(' +', ' ', args_strings.replace('\n', ' ')) + + # Create the mock method definition. + output_lines.extend(['%s%s(%s,' % (indent, mock_method_macro, node.name), + '%s%s(%s));' % (indent * 3, return_type, args)]) def _GenerateMocks(filename, source, ast_list, desired_class_names): - processed_class_names = set() - lines = [] - for node in ast_list: - if (isinstance(node, ast.Class) and node.body and - # desired_class_names being None means that all classes are selected. - (not desired_class_names or node.name in desired_class_names)): - class_name = node.name - parent_name = class_name - processed_class_names.add(class_name) - class_node = node - # Add namespace before the class. - if class_node.namespace: - lines.extend(['namespace %s {' % n for n in class_node.namespace]) # } - lines.append('') - - # Add template args for templated classes. - if class_node.templated_types: - # TODO(paulchang): The AST doesn't preserve template argument order, - # so we have to make up names here. - # TODO(paulchang): Handle non-type template arguments (e.g. - # template<typename T, int N>). - template_arg_count = len(class_node.templated_types.keys()) - template_args = ['T%d' % n for n in range(template_arg_count)] - template_decls = ['typename ' + arg for arg in template_args] - lines.append('template <' + ', '.join(template_decls) + '>') - parent_name += '<' + ', '.join(template_args) + '>' - - # Add the class prolog. - lines.append('class Mock%s : public %s {' # } - % (class_name, parent_name)) - lines.append('%spublic:' % (' ' * (_INDENT // 2))) - - # Add all the methods. - _GenerateMethods(lines, source, class_node) - - # Close the class. - if lines: - # If there are no virtual methods, no need for a public label. - if len(lines) == 2: - del lines[-1] - - # Only close the class if there really is a class. - lines.append('};') - lines.append('') # Add an extra newline. - - # Close the namespace. - if class_node.namespace: - for i in range(len(class_node.namespace)-1, -1, -1): - lines.append('} // namespace %s' % class_node.namespace[i]) - lines.append('') # Add an extra newline. - - if desired_class_names: - missing_class_name_list = list(desired_class_names - processed_class_names) - if missing_class_name_list: - missing_class_name_list.sort() - sys.stderr.write('Class(es) not found in %s: %s\n' % - (filename, ', '.join(missing_class_name_list))) - elif not processed_class_names: - sys.stderr.write('No class found in %s\n' % filename) - - return lines + processed_class_names = set() + lines = [] + for node in ast_list: + if (isinstance(node, ast.Class) and node.body and + # desired_class_names being None means that all classes are selected. + (not desired_class_names or node.name in desired_class_names)): + class_name = node.name + parent_name = class_name + processed_class_names.add(class_name) + class_node = node + # Add namespace before the class. + if class_node.namespace: + lines.extend(['namespace %s {' % n for n in class_node.namespace]) # } + lines.append('') + + # Add template args for templated classes. + if class_node.templated_types: + # TODO(paulchang): The AST doesn't preserve template argument order, + # so we have to make up names here. + # TODO(paulchang): Handle non-type template arguments (e.g. + # template<typename T, int N>). + template_arg_count = len(class_node.templated_types.keys()) + template_args = ['T%d' % n for n in range(template_arg_count)] + template_decls = ['typename ' + arg for arg in template_args] + lines.append('template <' + ', '.join(template_decls) + '>') + parent_name += '<' + ', '.join(template_args) + '>' + + # Add the class prolog. + lines.append('class Mock%s : public %s {' # } + % (class_name, parent_name)) + lines.append('%spublic:' % (' ' * (_INDENT // 2))) + + # Add all the methods. + _GenerateMethods(lines, source, class_node) + + # Close the class. + if lines: + # If there are no virtual methods, no need for a public label. + if len(lines) == 2: + del lines[-1] + + # Only close the class if there really is a class. + lines.append('};') + lines.append('') # Add an extra newline. + + # Close the namespace. + if class_node.namespace: + for i in range(len(class_node.namespace) - 1, -1, -1): + lines.append('} // namespace %s' % class_node.namespace[i]) + lines.append('') # Add an extra newline. + + if desired_class_names: + missing_class_name_list = list(desired_class_names - processed_class_names) + if missing_class_name_list: + missing_class_name_list.sort() + sys.stderr.write('Class(es) not found in %s: %s\n' % + (filename, ', '.join(missing_class_name_list))) + elif not processed_class_names: + sys.stderr.write('No class found in %s\n' % filename) + + return lines def main(argv=sys.argv): - if len(argv) < 2: - sys.stderr.write('Google Mock Class Generator v%s\n\n' % - '.'.join(map(str, _VERSION))) - sys.stderr.write(__doc__) - return 1 - - global _INDENT - try: - _INDENT = int(os.environ['INDENT']) - except KeyError: - pass - except: - sys.stderr.write('Unable to use indent of %s\n' % os.environ.get('INDENT')) - - filename = argv[1] - desired_class_names = None # None means all classes in the source file. - if len(argv) >= 3: - desired_class_names = set(argv[2:]) - source = utils.ReadFile(filename) - if source is None: - return 1 - - builder = ast.BuilderFromSource(source, filename) - try: - entire_ast = filter(None, builder.Generate()) - except KeyboardInterrupt: - return - except: - # An error message was already printed since we couldn't parse. - sys.exit(1) - else: - lines = _GenerateMocks(filename, source, entire_ast, desired_class_names) - sys.stdout.write('\n'.join(lines)) + if len(argv) < 2: + sys.stderr.write('Google Mock Class Generator v%s\n\n' % + '.'.join(map(str, _VERSION))) + sys.stderr.write(__doc__) + return 1 + + global _INDENT + try: + _INDENT = int(os.environ['INDENT']) + except KeyError: + pass + except: + sys.stderr.write('Unable to use indent of %s\n' % os.environ.get('INDENT')) + + filename = argv[1] + desired_class_names = None # None means all classes in the source file. + if len(argv) >= 3: + desired_class_names = set(argv[2:]) + source = utils.ReadFile(filename) + if source is None: + return 1 + + builder = ast.BuilderFromSource(source, filename) + try: + entire_ast = filter(None, builder.Generate()) + except KeyboardInterrupt: + return + except: + # An error message was already printed since we couldn't parse. + sys.exit(1) + else: + lines = _GenerateMocks(filename, source, entire_ast, desired_class_names) + sys.stdout.write('\n'.join(lines)) if __name__ == '__main__': - main(sys.argv) + main(sys.argv) diff --git a/googlemock/scripts/generator/cpp/gmock_class_test.py b/googlemock/scripts/generator/cpp/gmock_class_test.py index c53e600..211a92d 100755 --- a/googlemock/scripts/generator/cpp/gmock_class_test.py +++ b/googlemock/scripts/generator/cpp/gmock_class_test.py @@ -17,9 +17,6 @@ """Tests for gmock.scripts.generator.cpp.gmock_class.""" -__author__ = 'nnorwitz@google.com (Neal Norwitz)' - - import os import sys import unittest @@ -32,41 +29,43 @@ from cpp import gmock_class class TestCase(unittest.TestCase): - """Helper class that adds assert methods.""" + """Helper class that adds assert methods.""" - def StripLeadingWhitespace(self, lines): - """Strip leading whitespace in each line in 'lines'.""" - return '\n'.join([s.lstrip() for s in lines.split('\n')]) + @staticmethod + def StripLeadingWhitespace(lines): + """Strip leading whitespace in each line in 'lines'.""" + return '\n'.join([s.lstrip() for s in lines.split('\n')]) - def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines): - """Specialized assert that ignores the indent level.""" - self.assertEqual(expected_lines, self.StripLeadingWhitespace(lines)) + def assertEqualIgnoreLeadingWhitespace(self, expected_lines, lines): + """Specialized assert that ignores the indent level.""" + self.assertEqual(expected_lines, self.StripLeadingWhitespace(lines)) class GenerateMethodsTest(TestCase): - def GenerateMethodSource(self, cpp_source): - """Convert C++ source to Google Mock output source lines.""" - method_source_lines = [] - # <test> is a pseudo-filename, it is not read or written. - builder = ast.BuilderFromSource(cpp_source, '<test>') - ast_list = list(builder.Generate()) - gmock_class._GenerateMethods(method_source_lines, cpp_source, ast_list[0]) - return '\n'.join(method_source_lines) - - def testSimpleMethod(self): - source = """ + @staticmethod + def GenerateMethodSource(cpp_source): + """Convert C++ source to Google Mock output source lines.""" + method_source_lines = [] + # <test> is a pseudo-filename, it is not read or written. + builder = ast.BuilderFromSource(cpp_source, '<test>') + ast_list = list(builder.Generate()) + gmock_class._GenerateMethods(method_source_lines, cpp_source, ast_list[0]) + return '\n'.join(method_source_lines) + + def testSimpleMethod(self): + source = """ class Foo { public: virtual int Bar(); }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD0(Bar,\nint());', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD0(Bar,\nint());', + self.GenerateMethodSource(source)) - def testSimpleConstructorsAndDestructor(self): - source = """ + def testSimpleConstructorsAndDestructor(self): + source = """ class Foo { public: Foo(); @@ -77,26 +76,26 @@ class Foo { virtual int Bar() = 0; }; """ - # The constructors and destructor should be ignored. - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD0(Bar,\nint());', - self.GenerateMethodSource(source)) + # The constructors and destructor should be ignored. + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD0(Bar,\nint());', + self.GenerateMethodSource(source)) - def testVirtualDestructor(self): - source = """ + def testVirtualDestructor(self): + source = """ class Foo { public: virtual ~Foo(); virtual int Bar() = 0; }; """ - # The destructor should be ignored. - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD0(Bar,\nint());', - self.GenerateMethodSource(source)) + # The destructor should be ignored. + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD0(Bar,\nint());', + self.GenerateMethodSource(source)) - def testExplicitlyDefaultedConstructorsAndDestructor(self): - source = """ + def testExplicitlyDefaultedConstructorsAndDestructor(self): + source = """ class Foo { public: Foo() = default; @@ -106,13 +105,13 @@ class Foo { virtual int Bar() = 0; }; """ - # The constructors and destructor should be ignored. - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD0(Bar,\nint());', - self.GenerateMethodSource(source)) + # The constructors and destructor should be ignored. + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD0(Bar,\nint());', + self.GenerateMethodSource(source)) - def testExplicitlyDeletedConstructorsAndDestructor(self): - source = """ + def testExplicitlyDeletedConstructorsAndDestructor(self): + source = """ class Foo { public: Foo() = delete; @@ -122,92 +121,121 @@ class Foo { virtual int Bar() = 0; }; """ - # The constructors and destructor should be ignored. - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD0(Bar,\nint());', - self.GenerateMethodSource(source)) + # The constructors and destructor should be ignored. + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD0(Bar,\nint());', + self.GenerateMethodSource(source)) - def testSimpleOverrideMethod(self): - source = """ + def testSimpleOverrideMethod(self): + source = """ class Foo { public: int Bar() override; }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD0(Bar,\nint());', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD0(Bar,\nint());', + self.GenerateMethodSource(source)) - def testSimpleConstMethod(self): - source = """ + def testSimpleConstMethod(self): + source = """ class Foo { public: virtual void Bar(bool flag) const; }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_CONST_METHOD1(Bar,\nvoid(bool flag));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_CONST_METHOD1(Bar,\nvoid(bool flag));', + self.GenerateMethodSource(source)) - def testExplicitVoid(self): - source = """ + def testExplicitVoid(self): + source = """ class Foo { public: virtual int Bar(void); }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD0(Bar,\nint(void));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD0(Bar,\nint(void));', + self.GenerateMethodSource(source)) - def testStrangeNewlineInParameter(self): - source = """ + def testStrangeNewlineInParameter(self): + source = """ class Foo { public: virtual void Bar(int a) = 0; }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD1(Bar,\nvoid(int a));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD1(Bar,\nvoid(int a));', + self.GenerateMethodSource(source)) - def testDefaultParameters(self): - source = """ + def testDefaultParameters(self): + source = """ class Foo { public: virtual void Bar(int a, char c = 'x') = 0; }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD2(Bar,\nvoid(int, char));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD2(Bar,\nvoid(int a, char c ));', + self.GenerateMethodSource(source)) - def testMultipleDefaultParameters(self): - source = """ + def testMultipleDefaultParameters(self): + source = """ class Foo { public: - virtual void Bar(int a = 42, char c = 'x') = 0; + virtual void Bar( + int a = 42, + char c = 'x', + const int* const p = nullptr, + const std::string& s = "42", + char tab[] = {'4','2'}, + int const *& rp = aDefaultPointer) = 0; +}; +""" + self.assertEqualIgnoreLeadingWhitespace( + "MOCK_METHOD7(Bar,\n" + "void(int a , char c , const int* const p , const std::string& s , char tab[] , int const *& rp ));", + self.GenerateMethodSource(source)) + + def testConstDefaultParameter(self): + source = """ +class Test { + public: + virtual bool Bar(const int test_arg = 42) = 0; +}; +""" + expected = 'MOCK_METHOD1(Bar,\nbool(const int test_arg ));' + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMethodSource(source)) + + def testConstRefDefaultParameter(self): + source = """ +class Test { + public: + virtual bool Bar(const std::string& test_arg = "42" ) = 0; }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD2(Bar,\nvoid(int, char));', - self.GenerateMethodSource(source)) + expected = 'MOCK_METHOD1(Bar,\nbool(const std::string& test_arg ));' + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMethodSource(source)) - def testRemovesCommentsWhenDefaultsArePresent(self): - source = """ + def testRemovesCommentsWhenDefaultsArePresent(self): + source = """ class Foo { public: virtual void Bar(int a = 42 /* a comment */, char /* other comment */ c= 'x') = 0; }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD2(Bar,\nvoid(int, char));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD2(Bar,\nvoid(int a , char c));', + self.GenerateMethodSource(source)) - def testDoubleSlashCommentsInParameterListAreRemoved(self): - source = """ + def testDoubleSlashCommentsInParameterListAreRemoved(self): + source = """ class Foo { public: virtual void Bar(int a, // inline comments should be elided. @@ -215,116 +243,117 @@ class Foo { ) const = 0; }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_CONST_METHOD2(Bar,\nvoid(int a, int b));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_CONST_METHOD2(Bar,\nvoid(int a, int b));', + self.GenerateMethodSource(source)) - def testCStyleCommentsInParameterListAreNotRemoved(self): - # NOTE(nnorwitz): I'm not sure if it's the best behavior to keep these - # comments. Also note that C style comments after the last parameter - # are still elided. - source = """ + def testCStyleCommentsInParameterListAreNotRemoved(self): + # NOTE(nnorwitz): I'm not sure if it's the best behavior to keep these + # comments. Also note that C style comments after the last parameter + # are still elided. + source = """ class Foo { public: virtual const string& Bar(int /* keeper */, int b); }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD2(Bar,\nconst string&(int /* keeper */, int b));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD2(Bar,\nconst string&(int , int b));', + self.GenerateMethodSource(source)) - def testArgsOfTemplateTypes(self): - source = """ + def testArgsOfTemplateTypes(self): + source = """ class Foo { public: virtual int Bar(const vector<int>& v, map<int, string>* output); };""" - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD2(Bar,\n' - 'int(const vector<int>& v, map<int, string>* output));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD2(Bar,\n' + 'int(const vector<int>& v, map<int, string>* output));', + self.GenerateMethodSource(source)) - def testReturnTypeWithOneTemplateArg(self): - source = """ + def testReturnTypeWithOneTemplateArg(self): + source = """ class Foo { public: virtual vector<int>* Bar(int n); };""" - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD1(Bar,\nvector<int>*(int n));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD1(Bar,\nvector<int>*(int n));', + self.GenerateMethodSource(source)) - def testReturnTypeWithManyTemplateArgs(self): - source = """ + def testReturnTypeWithManyTemplateArgs(self): + source = """ class Foo { public: virtual map<int, string> Bar(); };""" - # Comparing the comment text is brittle - we'll think of something - # better in case this gets annoying, but for now let's keep it simple. - self.assertEqualIgnoreLeadingWhitespace( - '// The following line won\'t really compile, as the return\n' - '// type has multiple template arguments. To fix it, use a\n' - '// typedef for the return type.\n' - 'MOCK_METHOD0(Bar,\nmap<int, string>());', - self.GenerateMethodSource(source)) - - def testSimpleMethodInTemplatedClass(self): - source = """ + # Comparing the comment text is brittle - we'll think of something + # better in case this gets annoying, but for now let's keep it simple. + self.assertEqualIgnoreLeadingWhitespace( + '// The following line won\'t really compile, as the return\n' + '// type has multiple template arguments. To fix it, use a\n' + '// typedef for the return type.\n' + 'MOCK_METHOD0(Bar,\nmap<int, string>());', + self.GenerateMethodSource(source)) + + def testSimpleMethodInTemplatedClass(self): + source = """ template<class T> class Foo { public: virtual int Bar(); }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD0_T(Bar,\nint());', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD0_T(Bar,\nint());', + self.GenerateMethodSource(source)) - def testPointerArgWithoutNames(self): - source = """ + def testPointerArgWithoutNames(self): + source = """ class Foo { virtual int Bar(C*); }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD1(Bar,\nint(C*));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD1(Bar,\nint(C*));', + self.GenerateMethodSource(source)) - def testReferenceArgWithoutNames(self): - source = """ + def testReferenceArgWithoutNames(self): + source = """ class Foo { virtual int Bar(C&); }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD1(Bar,\nint(C&));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD1(Bar,\nint(C&));', + self.GenerateMethodSource(source)) - def testArrayArgWithoutNames(self): - source = """ + def testArrayArgWithoutNames(self): + source = """ class Foo { virtual int Bar(C[]); }; """ - self.assertEqualIgnoreLeadingWhitespace( - 'MOCK_METHOD1(Bar,\nint(C[]));', - self.GenerateMethodSource(source)) + self.assertEqualIgnoreLeadingWhitespace( + 'MOCK_METHOD1(Bar,\nint(C[]));', + self.GenerateMethodSource(source)) class GenerateMocksTest(TestCase): - def GenerateMocks(self, cpp_source): - """Convert C++ source to complete Google Mock output source.""" - # <test> is a pseudo-filename, it is not read or written. - filename = '<test>' - builder = ast.BuilderFromSource(cpp_source, filename) - ast_list = list(builder.Generate()) - lines = gmock_class._GenerateMocks(filename, cpp_source, ast_list, None) - return '\n'.join(lines) - - def testNamespaces(self): - source = """ + @staticmethod + def GenerateMocks(cpp_source): + """Convert C++ source to complete Google Mock output source.""" + # <test> is a pseudo-filename, it is not read or written. + filename = '<test>' + builder = ast.BuilderFromSource(cpp_source, filename) + ast_list = list(builder.Generate()) + lines = gmock_class._GenerateMocks(filename, cpp_source, ast_list, None) + return '\n'.join(lines) + + def testNamespaces(self): + source = """ namespace Foo { namespace Bar { class Forward; } namespace Baz { @@ -337,7 +366,7 @@ class Test { } // namespace Baz } // namespace Foo """ - expected = """\ + expected = """\ namespace Foo { namespace Baz { @@ -350,53 +379,53 @@ void()); } // namespace Baz } // namespace Foo """ - self.assertEqualIgnoreLeadingWhitespace( - expected, self.GenerateMocks(source)) + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) - def testClassWithStorageSpecifierMacro(self): - source = """ + def testClassWithStorageSpecifierMacro(self): + source = """ class STORAGE_SPECIFIER Test { public: virtual void Foo(); }; """ - expected = """\ + expected = """\ class MockTest : public Test { public: MOCK_METHOD0(Foo, void()); }; """ - self.assertEqualIgnoreLeadingWhitespace( - expected, self.GenerateMocks(source)) + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) - def testTemplatedForwardDeclaration(self): - source = """ + def testTemplatedForwardDeclaration(self): + source = """ template <class T> class Forward; // Forward declaration should be ignored. class Test { public: virtual void Foo(); }; """ - expected = """\ + expected = """\ class MockTest : public Test { public: MOCK_METHOD0(Foo, void()); }; """ - self.assertEqualIgnoreLeadingWhitespace( - expected, self.GenerateMocks(source)) + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) - def testTemplatedClass(self): - source = """ + def testTemplatedClass(self): + source = """ template <typename S, typename T> class Test { public: virtual void Foo(); }; """ - expected = """\ + expected = """\ template <typename T0, typename T1> class MockTest : public Test<T0, T1> { public: @@ -404,29 +433,29 @@ MOCK_METHOD0_T(Foo, void()); }; """ - self.assertEqualIgnoreLeadingWhitespace( - expected, self.GenerateMocks(source)) + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) - def testTemplateInATemplateTypedef(self): - source = """ + def testTemplateInATemplateTypedef(self): + source = """ class Test { public: typedef std::vector<std::list<int>> FooType; virtual void Bar(const FooType& test_arg); }; """ - expected = """\ + expected = """\ class MockTest : public Test { public: MOCK_METHOD1(Bar, void(const FooType& test_arg)); }; """ - self.assertEqualIgnoreLeadingWhitespace( - expected, self.GenerateMocks(source)) + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) - def testTemplateInATemplateTypedefWithComma(self): - source = """ + def testTemplateInATemplateTypedefWithComma(self): + source = """ class Test { public: typedef std::function<void( @@ -434,33 +463,78 @@ class Test { virtual void Bar(const FooType& test_arg); }; """ - expected = """\ + expected = """\ class MockTest : public Test { public: MOCK_METHOD1(Bar, void(const FooType& test_arg)); }; """ - self.assertEqualIgnoreLeadingWhitespace( - expected, self.GenerateMocks(source)) + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) - def testEnumClass(self): - source = """ + def testEnumType(self): + source = """ class Test { public: - enum class Baz { BAZINGA }; - virtual void Bar(const FooType& test_arg); + enum Bar { + BAZ, QUX, QUUX, QUUUX + }; + virtual void Foo(); }; """ - expected = """\ + expected = """\ class MockTest : public Test { public: -MOCK_METHOD1(Bar, -void(const FooType& test_arg)); +MOCK_METHOD0(Foo, +void()); }; """ - self.assertEqualIgnoreLeadingWhitespace( - expected, self.GenerateMocks(source)) + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) + + def testEnumClassType(self): + source = """ +class Test { + public: + enum class Bar { + BAZ, QUX, QUUX, QUUUX + }; + virtual void Foo(); +}; +""" + expected = """\ +class MockTest : public Test { +public: +MOCK_METHOD0(Foo, +void()); +}; +""" + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) + + def testStdFunction(self): + source = """ +class Test { + public: + Test(std::function<int(std::string)> foo) : foo_(foo) {} + + virtual std::function<int(std::string)> foo(); + + private: + std::function<int(std::string)> foo_; +}; +""" + expected = """\ +class MockTest : public Test { +public: +MOCK_METHOD0(foo, +std::function<int (std::string)>()); +}; +""" + self.assertEqualIgnoreLeadingWhitespace( + expected, self.GenerateMocks(source)) + if __name__ == '__main__': - unittest.main() + unittest.main() diff --git a/googlemock/scripts/generator/cpp/keywords.py b/googlemock/scripts/generator/cpp/keywords.py index f694450..e428271 100755 --- a/googlemock/scripts/generator/cpp/keywords.py +++ b/googlemock/scripts/generator/cpp/keywords.py @@ -17,9 +17,6 @@ """C++ keywords and helper utilities for determining keywords.""" -__author__ = 'nnorwitz@google.com (Neal Norwitz)' - - try: # Python 3.x import builtins diff --git a/googlemock/scripts/generator/cpp/tokenize.py b/googlemock/scripts/generator/cpp/tokenize.py index 359d556..a75edcb 100755 --- a/googlemock/scripts/generator/cpp/tokenize.py +++ b/googlemock/scripts/generator/cpp/tokenize.py @@ -17,9 +17,6 @@ """Tokenize C++ source code.""" -__author__ = 'nnorwitz@google.com (Neal Norwitz)' - - try: # Python 3.x import builtins diff --git a/googlemock/scripts/generator/cpp/utils.py b/googlemock/scripts/generator/cpp/utils.py index eab36ee..6f5fc09 100755 --- a/googlemock/scripts/generator/cpp/utils.py +++ b/googlemock/scripts/generator/cpp/utils.py @@ -17,12 +17,8 @@ """Generic utilities for C++ parsing.""" -__author__ = 'nnorwitz@google.com (Neal Norwitz)' - - import sys - # Set to True to see the start/end token indices. DEBUG = True diff --git a/googlemock/scripts/generator/gmock_gen.py b/googlemock/scripts/generator/gmock_gen.py index 8cc0d13..9d528a5 100755 --- a/googlemock/scripts/generator/gmock_gen.py +++ b/googlemock/scripts/generator/gmock_gen.py @@ -16,7 +16,6 @@ """Driver for starting up Google Mock class generator.""" -__author__ = 'nnorwitz@google.com (Neal Norwitz)' import os import sys diff --git a/googlemock/scripts/gmock-config.in b/googlemock/scripts/gmock-config.in deleted file mode 100755 index 2baefe9..0000000 --- a/googlemock/scripts/gmock-config.in +++ /dev/null @@ -1,303 +0,0 @@ -#!/bin/sh - -# These variables are automatically filled in by the configure script. -name="@PACKAGE_TARNAME@" -version="@PACKAGE_VERSION@" - -show_usage() -{ - echo "Usage: gmock-config [OPTIONS...]" -} - -show_help() -{ - show_usage - cat <<\EOF - -The `gmock-config' script provides access to the necessary compile and linking -flags to connect with Google C++ Mocking Framework, both in a build prior to -installation, and on the system proper after installation. The installation -overrides may be issued in combination with any other queries, but will only -affect installation queries if called on a built but not installed gmock. The -installation queries may not be issued with any other types of queries, and -only one installation query may be made at a time. The version queries and -compiler flag queries may be combined as desired but not mixed. Different -version queries are always combined with logical "and" semantics, and only the -last of any particular query is used while all previous ones ignored. All -versions must be specified as a sequence of numbers separated by periods. -Compiler flag queries output the union of the sets of flags when combined. - - Examples: - gmock-config --min-version=1.0 || echo "Insufficient Google Mock version." - - g++ $(gmock-config --cppflags --cxxflags) -o foo.o -c foo.cpp - g++ $(gmock-config --ldflags --libs) -o foo foo.o - - # When using a built but not installed Google Mock: - g++ $(../../my_gmock_build/scripts/gmock-config ...) ... - - # When using an installed Google Mock, but with installation overrides: - export GMOCK_PREFIX="/opt" - g++ $(gmock-config --libdir="/opt/lib64" ...) ... - - Help: - --usage brief usage information - --help display this help message - - Installation Overrides: - --prefix=<dir> overrides the installation prefix - --exec-prefix=<dir> overrides the executable installation prefix - --libdir=<dir> overrides the library installation prefix - --includedir=<dir> overrides the header file installation prefix - - Installation Queries: - --prefix installation prefix - --exec-prefix executable installation prefix - --libdir library installation directory - --includedir header file installation directory - --version the version of the Google Mock installation - - Version Queries: - --min-version=VERSION return 0 if the version is at least VERSION - --exact-version=VERSION return 0 if the version is exactly VERSION - --max-version=VERSION return 0 if the version is at most VERSION - - Compilation Flag Queries: - --cppflags compile flags specific to the C-like preprocessors - --cxxflags compile flags appropriate for C++ programs - --ldflags linker flags - --libs libraries for linking - -EOF -} - -# This function bounds our version with a min and a max. It uses some clever -# POSIX-compliant variable expansion to portably do all the work in the shell -# and avoid any dependency on a particular "sed" or "awk" implementation. -# Notable is that it will only ever compare the first 3 components of versions. -# Further components will be cleanly stripped off. All versions must be -# unadorned, so "v1.0" will *not* work. The minimum version must be in $1, and -# the max in $2. TODO(chandlerc@google.com): If this ever breaks, we should -# investigate expanding this via autom4te from AS_VERSION_COMPARE rather than -# continuing to maintain our own shell version. -check_versions() -{ - major_version=${version%%.*} - minor_version="0" - point_version="0" - if test "${version#*.}" != "${version}"; then - minor_version=${version#*.} - minor_version=${minor_version%%.*} - fi - if test "${version#*.*.}" != "${version}"; then - point_version=${version#*.*.} - point_version=${point_version%%.*} - fi - - min_version="$1" - min_major_version=${min_version%%.*} - min_minor_version="0" - min_point_version="0" - if test "${min_version#*.}" != "${min_version}"; then - min_minor_version=${min_version#*.} - min_minor_version=${min_minor_version%%.*} - fi - if test "${min_version#*.*.}" != "${min_version}"; then - min_point_version=${min_version#*.*.} - min_point_version=${min_point_version%%.*} - fi - - max_version="$2" - max_major_version=${max_version%%.*} - max_minor_version="0" - max_point_version="0" - if test "${max_version#*.}" != "${max_version}"; then - max_minor_version=${max_version#*.} - max_minor_version=${max_minor_version%%.*} - fi - if test "${max_version#*.*.}" != "${max_version}"; then - max_point_version=${max_version#*.*.} - max_point_version=${max_point_version%%.*} - fi - - test $(($major_version)) -lt $(($min_major_version)) && exit 1 - if test $(($major_version)) -eq $(($min_major_version)); then - test $(($minor_version)) -lt $(($min_minor_version)) && exit 1 - if test $(($minor_version)) -eq $(($min_minor_version)); then - test $(($point_version)) -lt $(($min_point_version)) && exit 1 - fi - fi - - test $(($major_version)) -gt $(($max_major_version)) && exit 1 - if test $(($major_version)) -eq $(($max_major_version)); then - test $(($minor_version)) -gt $(($max_minor_version)) && exit 1 - if test $(($minor_version)) -eq $(($max_minor_version)); then - test $(($point_version)) -gt $(($max_point_version)) && exit 1 - fi - fi - - exit 0 -} - -# Show the usage line when no arguments are specified. -if test $# -eq 0; then - show_usage - exit 1 -fi - -while test $# -gt 0; do - case $1 in - --usage) show_usage; exit 0;; - --help) show_help; exit 0;; - - # Installation overrides - --prefix=*) GMOCK_PREFIX=${1#--prefix=};; - --exec-prefix=*) GMOCK_EXEC_PREFIX=${1#--exec-prefix=};; - --libdir=*) GMOCK_LIBDIR=${1#--libdir=};; - --includedir=*) GMOCK_INCLUDEDIR=${1#--includedir=};; - - # Installation queries - --prefix|--exec-prefix|--libdir|--includedir|--version) - if test -n "${do_query}"; then - show_usage - exit 1 - fi - do_query=${1#--} - ;; - - # Version checking - --min-version=*) - do_check_versions=yes - min_version=${1#--min-version=} - ;; - --max-version=*) - do_check_versions=yes - max_version=${1#--max-version=} - ;; - --exact-version=*) - do_check_versions=yes - exact_version=${1#--exact-version=} - ;; - - # Compiler flag output - --cppflags) echo_cppflags=yes;; - --cxxflags) echo_cxxflags=yes;; - --ldflags) echo_ldflags=yes;; - --libs) echo_libs=yes;; - - # Everything else is an error - *) show_usage; exit 1;; - esac - shift -done - -# These have defaults filled in by the configure script but can also be -# overridden by environment variables or command line parameters. -prefix="${GMOCK_PREFIX:-@prefix@}" -exec_prefix="${GMOCK_EXEC_PREFIX:-@exec_prefix@}" -libdir="${GMOCK_LIBDIR:-@libdir@}" -includedir="${GMOCK_INCLUDEDIR:-@includedir@}" - -# We try and detect if our binary is not located at its installed location. If -# it's not, we provide variables pointing to the source and build tree rather -# than to the install tree. We also locate Google Test using the configured -# gtest-config script rather than searching the PATH and our bindir for one. -# This allows building against a just-built gmock rather than an installed -# gmock. -bindir="@bindir@" -this_relative_bindir=`dirname $0` -this_bindir=`cd ${this_relative_bindir}; pwd -P` -if test "${this_bindir}" = "${this_bindir%${bindir}}"; then - # The path to the script doesn't end in the bindir sequence from Autoconf, - # assume that we are in a build tree. - build_dir=`dirname ${this_bindir}` - src_dir=`cd ${this_bindir}/@top_srcdir@; pwd -P` - - # TODO(chandlerc@google.com): This is a dangerous dependency on libtool, we - # should work to remove it, and/or remove libtool altogether, replacing it - # with direct references to the library and a link path. - gmock_libs="${build_dir}/lib/libgmock.la" - gmock_ldflags="" - - # We provide hooks to include from either the source or build dir, where the - # build dir is always preferred. This will potentially allow us to write - # build rules for generated headers and have them automatically be preferred - # over provided versions. - gmock_cppflags="-I${build_dir}/include -I${src_dir}/include" - gmock_cxxflags="" - - # Directly invoke the gtest-config script used during the build process. - gtest_config="@GTEST_CONFIG@" -else - # We're using an installed gmock, although it may be staged under some - # prefix. Assume (as our own libraries do) that we can resolve the prefix, - # and are present in the dynamic link paths. - gmock_ldflags="-L${libdir}" - gmock_libs="-l${name}" - gmock_cppflags="-I${includedir}" - gmock_cxxflags="" - - # We also prefer any gtest-config script installed in our prefix. Lacking - # one, we look in the PATH for one. - gtest_config="${bindir}/gtest-config" - if test ! -x "${gtest_config}"; then - gtest_config=`which gtest-config` - fi -fi - -# Ensure that we have located a Google Test to link against. -if ! test -x "${gtest_config}"; then - echo "Unable to locate Google Test, check your Google Mock configuration" \ - "and installation" >&2 - exit 1 -elif ! "${gtest_config}" "--exact-version=@GTEST_VERSION@"; then - echo "The Google Test found is not the same version as Google Mock was " \ - "built against" >&2 - exit 1 -fi - -# Add the necessary Google Test bits into the various flag variables -gmock_cppflags="${gmock_cppflags} `${gtest_config} --cppflags`" -gmock_cxxflags="${gmock_cxxflags} `${gtest_config} --cxxflags`" -gmock_ldflags="${gmock_ldflags} `${gtest_config} --ldflags`" -gmock_libs="${gmock_libs} `${gtest_config} --libs`" - -# Do an installation query if requested. -if test -n "$do_query"; then - case $do_query in - prefix) echo $prefix; exit 0;; - exec-prefix) echo $exec_prefix; exit 0;; - libdir) echo $libdir; exit 0;; - includedir) echo $includedir; exit 0;; - version) echo $version; exit 0;; - *) show_usage; exit 1;; - esac -fi - -# Do a version check if requested. -if test "$do_check_versions" = "yes"; then - # Make sure we didn't receive a bad combination of parameters. - test "$echo_cppflags" = "yes" && show_usage && exit 1 - test "$echo_cxxflags" = "yes" && show_usage && exit 1 - test "$echo_ldflags" = "yes" && show_usage && exit 1 - test "$echo_libs" = "yes" && show_usage && exit 1 - - if test "$exact_version" != ""; then - check_versions $exact_version $exact_version - # unreachable - else - check_versions ${min_version:-0.0.0} ${max_version:-9999.9999.9999} - # unreachable - fi -fi - -# Do the output in the correct order so that these can be used in-line of -# a compiler invocation. -output="" -test "$echo_cppflags" = "yes" && output="$output $gmock_cppflags" -test "$echo_cxxflags" = "yes" && output="$output $gmock_cxxflags" -test "$echo_ldflags" = "yes" && output="$output $gmock_ldflags" -test "$echo_libs" = "yes" && output="$output $gmock_libs" -echo $output - -exit 0 diff --git a/googlemock/scripts/gmock_doctor.py b/googlemock/scripts/gmock_doctor.py deleted file mode 100755 index 74992bc..0000000 --- a/googlemock/scripts/gmock_doctor.py +++ /dev/null @@ -1,640 +0,0 @@ -#!/usr/bin/env python -# -# 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. - -"""Converts compiler's errors in code using Google Mock to plain English.""" - -__author__ = 'wan@google.com (Zhanyong Wan)' - -import re -import sys - -_VERSION = '1.0.3' - -_EMAIL = 'googlemock@googlegroups.com' - -_COMMON_GMOCK_SYMBOLS = [ - # Matchers - '_', - 'A', - 'AddressSatisfies', - 'AllOf', - 'An', - 'AnyOf', - 'ContainerEq', - 'Contains', - 'ContainsRegex', - 'DoubleEq', - 'ElementsAre', - 'ElementsAreArray', - 'EndsWith', - 'Eq', - 'Field', - 'FloatEq', - 'Ge', - 'Gt', - 'HasSubstr', - 'IsInitializedProto', - 'Le', - 'Lt', - 'MatcherCast', - 'Matches', - 'MatchesRegex', - 'NanSensitiveDoubleEq', - 'NanSensitiveFloatEq', - 'Ne', - 'Not', - 'NotNull', - 'Pointee', - 'Property', - 'Ref', - 'ResultOf', - 'SafeMatcherCast', - 'StartsWith', - 'StrCaseEq', - 'StrCaseNe', - 'StrEq', - 'StrNe', - 'Truly', - 'TypedEq', - 'Value', - - # Actions - 'Assign', - 'ByRef', - 'DeleteArg', - 'DoAll', - 'DoDefault', - 'IgnoreResult', - 'Invoke', - 'InvokeArgument', - 'InvokeWithoutArgs', - 'Return', - 'ReturnNew', - 'ReturnNull', - 'ReturnRef', - 'SaveArg', - 'SetArgReferee', - 'SetArgPointee', - 'SetArgumentPointee', - 'SetArrayArgument', - 'SetErrnoAndReturn', - 'Throw', - 'WithArg', - 'WithArgs', - 'WithoutArgs', - - # Cardinalities - 'AnyNumber', - 'AtLeast', - 'AtMost', - 'Between', - 'Exactly', - - # Sequences - 'InSequence', - 'Sequence', - - # Misc - 'DefaultValue', - 'Mock', - ] - -# Regex for matching source file path and line number in the compiler's errors. -_GCC_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):(\d+:)?\s+' -_CLANG_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):(?P<column>\d+):\s+' -_CLANG_NON_GMOCK_FILE_LINE_RE = ( - r'(?P<file>.*[/\\^](?!gmock-)[^/\\]+):(?P<line>\d+):(?P<column>\d+):\s+') - - -def _FindAllMatches(regex, s): - """Generates all matches of regex in string s.""" - - r = re.compile(regex) - return r.finditer(s) - - -def _GenericDiagnoser(short_name, long_name, diagnoses, msg): - """Diagnoses the given disease by pattern matching. - - Can provide different diagnoses for different patterns. - - Args: - short_name: Short name of the disease. - long_name: Long name of the disease. - diagnoses: A list of pairs (regex, pattern for formatting the diagnosis - for matching regex). - msg: Compiler's error messages. - Yields: - Tuples of the form - (short name of disease, long name of disease, diagnosis). - """ - for regex, diagnosis in diagnoses: - if re.search(regex, msg): - diagnosis = '%(file)s:%(line)s:' + diagnosis - for m in _FindAllMatches(regex, msg): - yield (short_name, long_name, diagnosis % m.groupdict()) - - -def _NeedToReturnReferenceDiagnoser(msg): - """Diagnoses the NRR disease, given the error messages by the compiler.""" - - gcc_regex = (r'In member function \'testing::internal::ReturnAction<R>.*\n' - + _GCC_FILE_LINE_RE + r'instantiated from here\n' - r'.*gmock-actions\.h.*error: creating array with negative size') - clang_regex = (r'error:.*array.*negative.*\r?\n' - r'(.*\n)*?' + - _CLANG_NON_GMOCK_FILE_LINE_RE + - r'note: in instantiation of function template specialization ' - r'\'testing::internal::ReturnAction<(?P<type>.*)>' - r'::operator Action<.*>\' requested here') - clang11_re = (r'use_ReturnRef_instead_of_Return_to_return_a_reference.*' - r'(.*\n)*?' + _CLANG_NON_GMOCK_FILE_LINE_RE) - - diagnosis = """ -You are using a Return() action in a function that returns a reference to -%(type)s. Please use ReturnRef() instead.""" - return _GenericDiagnoser('NRR', 'Need to Return Reference', - [(clang_regex, diagnosis), - (clang11_re, diagnosis % {'type': 'a type'}), - (gcc_regex, diagnosis % {'type': 'a type'})], - msg) - - -def _NeedToReturnSomethingDiagnoser(msg): - """Diagnoses the NRS disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + r'(instantiated from here\n.' - r'*gmock.*actions\.h.*error: void value not ignored)' - r'|(error: control reaches end of non-void function)') - clang_regex1 = (_CLANG_FILE_LINE_RE + - r'error: cannot initialize return object ' - r'of type \'Result\' \(aka \'(?P<return_type>.*)\'\) ' - r'with an rvalue of type \'void\'') - clang_regex2 = (_CLANG_FILE_LINE_RE + - r'error: cannot initialize return object ' - r'of type \'(?P<return_type>.*)\' ' - r'with an rvalue of type \'void\'') - diagnosis = """ -You are using an action that returns void, but it needs to return -%(return_type)s. Please tell it *what* to return. Perhaps you can use -the pattern DoAll(some_action, Return(some_value))?""" - return _GenericDiagnoser( - 'NRS', - 'Need to Return Something', - [(gcc_regex, diagnosis % {'return_type': '*something*'}), - (clang_regex1, diagnosis), - (clang_regex2, diagnosis)], - msg) - - -def _NeedToReturnNothingDiagnoser(msg): - """Diagnoses the NRN disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + r'instantiated from here\n' - r'.*gmock-actions\.h.*error: instantiation of ' - r'\'testing::internal::ReturnAction<R>::Impl<F>::value_\' ' - r'as type \'void\'') - clang_regex1 = (r'error: field has incomplete type ' - r'\'Result\' \(aka \'void\'\)(\r)?\n' - r'(.*\n)*?' + - _CLANG_NON_GMOCK_FILE_LINE_RE + r'note: in instantiation ' - r'of function template specialization ' - r'\'testing::internal::ReturnAction<(?P<return_type>.*)>' - r'::operator Action<void \(.*\)>\' requested here') - clang_regex2 = (r'error: field has incomplete type ' - r'\'Result\' \(aka \'void\'\)(\r)?\n' - r'(.*\n)*?' + - _CLANG_NON_GMOCK_FILE_LINE_RE + r'note: in instantiation ' - r'of function template specialization ' - r'\'testing::internal::DoBothAction<.*>' - r'::operator Action<(?P<return_type>.*) \(.*\)>\' ' - r'requested here') - diagnosis = """ -You are using an action that returns %(return_type)s, but it needs to return -void. Please use a void-returning action instead. - -All actions but the last in DoAll(...) must return void. Perhaps you need -to re-arrange the order of actions in a DoAll(), if you are using one?""" - return _GenericDiagnoser( - 'NRN', - 'Need to Return Nothing', - [(gcc_regex, diagnosis % {'return_type': '*something*'}), - (clang_regex1, diagnosis), - (clang_regex2, diagnosis)], - msg) - - -def _IncompleteByReferenceArgumentDiagnoser(msg): - """Diagnoses the IBRA disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + r'instantiated from here\n' - r'.*gtest-printers\.h.*error: invalid application of ' - r'\'sizeof\' to incomplete type \'(?P<type>.*)\'') - - clang_regex = (r'.*gtest-printers\.h.*error: invalid application of ' - r'\'sizeof\' to an incomplete type ' - r'\'(?P<type>.*)( const)?\'\r?\n' - r'(.*\n)*?' + - _CLANG_NON_GMOCK_FILE_LINE_RE + - r'note: in instantiation of member function ' - r'\'testing::internal2::TypeWithoutFormatter<.*>::' - r'PrintValue\' requested here') - diagnosis = """ -In order to mock this function, Google Mock needs to see the definition -of type "%(type)s" - declaration alone is not enough. Either #include -the header that defines it, or change the argument to be passed -by pointer.""" - - return _GenericDiagnoser('IBRA', 'Incomplete By-Reference Argument Type', - [(gcc_regex, diagnosis), - (clang_regex, diagnosis)], - msg) - - -def _OverloadedFunctionMatcherDiagnoser(msg): - """Diagnoses the OFM disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + r'error: no matching function for ' - r'call to \'Truly\(<unresolved overloaded function type>\)') - clang_regex = (_CLANG_FILE_LINE_RE + r'error: no matching function for ' - r'call to \'Truly') - diagnosis = """ -The argument you gave to Truly() is an overloaded function. Please tell -your compiler which overloaded version you want to use. - -For example, if you want to use the version whose signature is - bool Foo(int n); -you should write - Truly(static_cast<bool (*)(int n)>(Foo))""" - return _GenericDiagnoser('OFM', 'Overloaded Function Matcher', - [(gcc_regex, diagnosis), - (clang_regex, diagnosis)], - msg) - - -def _OverloadedFunctionActionDiagnoser(msg): - """Diagnoses the OFA disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + r'error: no matching function for call to ' - r'\'Invoke\(<unresolved overloaded function type>') - clang_regex = (_CLANG_FILE_LINE_RE + r'error: no matching ' - r'function for call to \'Invoke\'\r?\n' - r'(.*\n)*?' - r'.*\bgmock-generated-actions\.h:\d+:\d+:\s+' - r'note: candidate template ignored:\s+' - r'couldn\'t infer template argument \'FunctionImpl\'') - diagnosis = """ -Function you are passing to Invoke is overloaded. Please tell your compiler -which overloaded version you want to use. - -For example, if you want to use the version whose signature is - bool MyFunction(int n, double x); -you should write something like - Invoke(static_cast<bool (*)(int n, double x)>(MyFunction))""" - return _GenericDiagnoser('OFA', 'Overloaded Function Action', - [(gcc_regex, diagnosis), - (clang_regex, diagnosis)], - msg) - - -def _OverloadedMethodActionDiagnoser(msg): - """Diagnoses the OMA disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + r'error: no matching function for ' - r'call to \'Invoke\(.+, <unresolved overloaded function ' - r'type>\)') - clang_regex = (_CLANG_FILE_LINE_RE + r'error: no matching function ' - r'for call to \'Invoke\'\r?\n' - r'(.*\n)*?' - r'.*\bgmock-generated-actions\.h:\d+:\d+: ' - r'note: candidate function template not viable: ' - r'requires .*, but 2 (arguments )?were provided') - diagnosis = """ -The second argument you gave to Invoke() is an overloaded method. Please -tell your compiler which overloaded version you want to use. - -For example, if you want to use the version whose signature is - class Foo { - ... - bool Bar(int n, double x); - }; -you should write something like - Invoke(foo, static_cast<bool (Foo::*)(int n, double x)>(&Foo::Bar))""" - return _GenericDiagnoser('OMA', 'Overloaded Method Action', - [(gcc_regex, diagnosis), - (clang_regex, diagnosis)], - msg) - - -def _MockObjectPointerDiagnoser(msg): - """Diagnoses the MOP disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + r'error: request for member ' - r'\'gmock_(?P<method>.+)\' in \'(?P<mock_object>.+)\', ' - r'which is of non-class type \'(.*::)*(?P<class_name>.+)\*\'') - clang_regex = (_CLANG_FILE_LINE_RE + r'error: member reference type ' - r'\'(?P<class_name>.*?) *\' is a pointer; ' - r'(did you mean|maybe you meant) to use \'->\'\?') - diagnosis = """ -The first argument to ON_CALL() and EXPECT_CALL() must be a mock *object*, -not a *pointer* to it. Please write '*(%(mock_object)s)' instead of -'%(mock_object)s' as your first argument. - -For example, given the mock class: - - class %(class_name)s : public ... { - ... - MOCK_METHOD0(%(method)s, ...); - }; - -and the following mock instance: - - %(class_name)s* mock_ptr = ... - -you should use the EXPECT_CALL like this: - - EXPECT_CALL(*mock_ptr, %(method)s(...));""" - - return _GenericDiagnoser( - 'MOP', - 'Mock Object Pointer', - [(gcc_regex, diagnosis), - (clang_regex, diagnosis % {'mock_object': 'mock_object', - 'method': 'method', - 'class_name': '%(class_name)s'})], - msg) - - -def _NeedToUseSymbolDiagnoser(msg): - """Diagnoses the NUS disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + r'error: \'(?P<symbol>.+)\' ' - r'(was not declared in this scope|has not been declared)') - clang_regex = (_CLANG_FILE_LINE_RE + - r'error: (use of undeclared identifier|unknown type name|' - r'no template named) \'(?P<symbol>[^\']+)\'') - diagnosis = """ -'%(symbol)s' is defined by Google Mock in the testing namespace. -Did you forget to write - using testing::%(symbol)s; -?""" - for m in (list(_FindAllMatches(gcc_regex, msg)) + - list(_FindAllMatches(clang_regex, msg))): - symbol = m.groupdict()['symbol'] - if symbol in _COMMON_GMOCK_SYMBOLS: - yield ('NUS', 'Need to Use Symbol', diagnosis % m.groupdict()) - - -def _NeedToUseReturnNullDiagnoser(msg): - """Diagnoses the NRNULL disease, given the error messages by the compiler.""" - - gcc_regex = ('instantiated from \'testing::internal::ReturnAction<R>' - '::operator testing::Action<Func>\(\) const.*\n' + - _GCC_FILE_LINE_RE + r'instantiated from here\n' - r'.*error: no matching function for call to \'ImplicitCast_\(' - r'(:?long )?int&\)') - clang_regex = (r'\bgmock-actions.h:.* error: no matching function for ' - r'call to \'ImplicitCast_\'\r?\n' - r'(.*\n)*?' + - _CLANG_NON_GMOCK_FILE_LINE_RE + r'note: in instantiation ' - r'of function template specialization ' - r'\'testing::internal::ReturnAction<(int|long)>::operator ' - r'Action<(?P<type>.*)\(\)>\' requested here') - diagnosis = """ -You are probably calling Return(NULL) and the compiler isn't sure how to turn -NULL into %(type)s. Use ReturnNull() instead. -Note: the line number may be off; please fix all instances of Return(NULL).""" - return _GenericDiagnoser( - 'NRNULL', 'Need to use ReturnNull', - [(clang_regex, diagnosis), - (gcc_regex, diagnosis % {'type': 'the right type'})], - msg) - - -def _TypeInTemplatedBaseDiagnoser(msg): - """Diagnoses the TTB disease, given the error messages by the compiler.""" - - # This version works when the type is used as the mock function's return - # type. - gcc_4_3_1_regex_type_in_retval = ( - r'In member function \'int .*\n' + _GCC_FILE_LINE_RE + - r'error: a function call cannot appear in a constant-expression') - gcc_4_4_0_regex_type_in_retval = ( - r'error: a function call cannot appear in a constant-expression' - + _GCC_FILE_LINE_RE + r'error: template argument 1 is invalid\n') - # This version works when the type is used as the mock function's sole - # parameter type. - gcc_regex_type_of_sole_param = ( - _GCC_FILE_LINE_RE + - r'error: \'(?P<type>.+)\' was not declared in this scope\n' - r'.*error: template argument 1 is invalid\n') - # This version works when the type is used as a parameter of a mock - # function that has multiple parameters. - gcc_regex_type_of_a_param = ( - r'error: expected `;\' before \'::\' token\n' - + _GCC_FILE_LINE_RE + - r'error: \'(?P<type>.+)\' was not declared in this scope\n' - r'.*error: template argument 1 is invalid\n' - r'.*error: \'.+\' was not declared in this scope') - clang_regex_type_of_retval_or_sole_param = ( - _CLANG_FILE_LINE_RE + - r'error: use of undeclared identifier \'(?P<type>.*)\'\n' - r'(.*\n)*?' - r'(?P=file):(?P=line):\d+: error: ' - r'non-friend class member \'Result\' cannot have a qualified name' - ) - clang_regex_type_of_a_param = ( - _CLANG_FILE_LINE_RE + - r'error: C\+\+ requires a type specifier for all declarations\n' - r'(.*\n)*?' - r'(?P=file):(?P=line):(?P=column): error: ' - r'C\+\+ requires a type specifier for all declarations' - ) - clang_regex_unknown_type = ( - _CLANG_FILE_LINE_RE + - r'error: unknown type name \'(?P<type>[^\']+)\'' - ) - - diagnosis = """ -In a mock class template, types or typedefs defined in the base class -template are *not* automatically visible. This is how C++ works. Before -you can use a type or typedef named %(type)s defined in base class Base<T>, you -need to make it visible. One way to do it is: - - typedef typename Base<T>::%(type)s %(type)s;""" - - for diag in _GenericDiagnoser( - 'TTB', 'Type in Template Base', - [(gcc_4_3_1_regex_type_in_retval, diagnosis % {'type': 'Foo'}), - (gcc_4_4_0_regex_type_in_retval, diagnosis % {'type': 'Foo'}), - (gcc_regex_type_of_sole_param, diagnosis), - (gcc_regex_type_of_a_param, diagnosis), - (clang_regex_type_of_retval_or_sole_param, diagnosis), - (clang_regex_type_of_a_param, diagnosis % {'type': 'Foo'})], - msg): - yield diag - # Avoid overlap with the NUS pattern. - for m in _FindAllMatches(clang_regex_unknown_type, msg): - type_ = m.groupdict()['type'] - if type_ not in _COMMON_GMOCK_SYMBOLS: - yield ('TTB', 'Type in Template Base', diagnosis % m.groupdict()) - - -def _WrongMockMethodMacroDiagnoser(msg): - """Diagnoses the WMM disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + - r'.*this_method_does_not_take_(?P<wrong_args>\d+)_argument.*\n' - r'.*\n' - r'.*candidates are.*FunctionMocker<[^>]+A(?P<args>\d+)\)>') - clang_regex = (_CLANG_NON_GMOCK_FILE_LINE_RE + - r'error:.*array.*negative.*r?\n' - r'(.*\n)*?' - r'(?P=file):(?P=line):(?P=column): error: too few arguments ' - r'to function call, expected (?P<args>\d+), ' - r'have (?P<wrong_args>\d+)') - clang11_re = (_CLANG_NON_GMOCK_FILE_LINE_RE + - r'.*this_method_does_not_take_' - r'(?P<wrong_args>\d+)_argument.*') - diagnosis = """ -You are using MOCK_METHOD%(wrong_args)s to define a mock method that has -%(args)s arguments. Use MOCK_METHOD%(args)s (or MOCK_CONST_METHOD%(args)s, -MOCK_METHOD%(args)s_T, MOCK_CONST_METHOD%(args)s_T as appropriate) instead.""" - return _GenericDiagnoser('WMM', 'Wrong MOCK_METHODn Macro', - [(gcc_regex, diagnosis), - (clang11_re, diagnosis % {'wrong_args': 'm', - 'args': 'n'}), - (clang_regex, diagnosis)], - msg) - - -def _WrongParenPositionDiagnoser(msg): - """Diagnoses the WPP disease, given the error messages by the compiler.""" - - gcc_regex = (_GCC_FILE_LINE_RE + - r'error:.*testing::internal::MockSpec<.* has no member named \'' - r'(?P<method>\w+)\'') - clang_regex = (_CLANG_NON_GMOCK_FILE_LINE_RE + - r'error: no member named \'(?P<method>\w+)\' in ' - r'\'testing::internal::MockSpec<.*>\'') - diagnosis = """ -The closing parenthesis of ON_CALL or EXPECT_CALL should be *before* -".%(method)s". For example, you should write: - EXPECT_CALL(my_mock, Foo(_)).%(method)s(...); -instead of: - EXPECT_CALL(my_mock, Foo(_).%(method)s(...));""" - return _GenericDiagnoser('WPP', 'Wrong Parenthesis Position', - [(gcc_regex, diagnosis), - (clang_regex, diagnosis)], - msg) - - -_DIAGNOSERS = [ - _IncompleteByReferenceArgumentDiagnoser, - _MockObjectPointerDiagnoser, - _NeedToReturnNothingDiagnoser, - _NeedToReturnReferenceDiagnoser, - _NeedToReturnSomethingDiagnoser, - _NeedToUseReturnNullDiagnoser, - _NeedToUseSymbolDiagnoser, - _OverloadedFunctionActionDiagnoser, - _OverloadedFunctionMatcherDiagnoser, - _OverloadedMethodActionDiagnoser, - _TypeInTemplatedBaseDiagnoser, - _WrongMockMethodMacroDiagnoser, - _WrongParenPositionDiagnoser, - ] - - -def Diagnose(msg): - """Generates all possible diagnoses given the compiler error message.""" - - msg = re.sub(r'\x1b\[[^m]*m', '', msg) # Strips all color formatting. - # Assuming the string is using the UTF-8 encoding, replaces the left and - # the right single quote characters with apostrophes. - msg = re.sub(r'(\xe2\x80\x98|\xe2\x80\x99)', "'", msg) - - diagnoses = [] - for diagnoser in _DIAGNOSERS: - for diag in diagnoser(msg): - diagnosis = '[%s - %s]\n%s' % diag - if not diagnosis in diagnoses: - diagnoses.append(diagnosis) - return diagnoses - - -def main(): - print ('Google Mock Doctor v%s - ' - 'diagnoses problems in code using Google Mock.' % _VERSION) - - if sys.stdin.isatty(): - print ('Please copy and paste the compiler errors here. Press c-D when ' - 'you are done:') - else: - print ('Waiting for compiler errors on stdin . . .') - - msg = sys.stdin.read().strip() - diagnoses = Diagnose(msg) - count = len(diagnoses) - if not count: - print (""" -Your compiler complained: -8<------------------------------------------------------------ -%s ------------------------------------------------------------->8 - -Uh-oh, I'm not smart enough to figure out what the problem is. :-( -However... -If you send your source code and the compiler's error messages to -%s, you can be helped and I can get smarter -- -win-win for us!""" % (msg, _EMAIL)) - else: - print ('------------------------------------------------------------') - print ('Your code appears to have the following',) - if count > 1: - print ('%s diseases:' % (count,)) - else: - print ('disease:') - i = 0 - for d in diagnoses: - i += 1 - if count > 1: - print ('\n#%s:' % (i,)) - print (d) - print (""" -How did I do? If you think I'm wrong or unhelpful, please send your -source code and the compiler's error messages to %s. -Then you can be helped and I can get smarter -- I promise I won't be upset!""" % - _EMAIL) - - -if __name__ == '__main__': - main() diff --git a/googletest/scripts/pump.py b/googlemock/scripts/pump.py index 5efb653..66e3217 100755 --- a/googletest/scripts/pump.py +++ b/googlemock/scripts/pump.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2.7 # # Copyright 2008, Google Inc. # All rights reserved. @@ -62,7 +62,7 @@ GRAMMAR: EXPRESSION has Python syntax. """ -__author__ = 'wan@google.com (Zhanyong Wan)' +from __future__ import print_function import os import re @@ -246,7 +246,7 @@ def ParseToken(lines, pos, regex, token_type): if m and not m.start(): return MakeToken(lines, pos, pos + m.end(), token_type) else: - print 'ERROR: %s expected at %s.' % (token_type, pos) + print('ERROR: %s expected at %s.' % (token_type, pos)) sys.exit(1) @@ -453,8 +453,8 @@ def PushFront(a_list, elem): def PopToken(a_list, token_type=None): token = PopFront(a_list) if token_type is not None and token.token_type != token_type: - print 'ERROR: %s expected at %s' % (token_type, token.start) - print 'ERROR: %s found instead' % (token,) + print('ERROR: %s expected at %s' % (token_type, token.start)) + print('ERROR: %s found instead' % (token,)) sys.exit(1) return token @@ -616,16 +616,16 @@ class Env: if identifier == var: return value - print 'ERROR: meta variable %s is undefined.' % (identifier,) + print('ERROR: meta variable %s is undefined.' % (identifier,)) sys.exit(1) def EvalExp(self, exp): try: result = eval(exp.python_exp) - except Exception, e: - print 'ERROR: caught exception %s: %s' % (e.__class__.__name__, e) - print ('ERROR: failed to evaluate meta expression %s at %s' % - (exp.python_exp, exp.token.start)) + except Exception as e: # pylint: disable=broad-except + print('ERROR: caught exception %s: %s' % (e.__class__.__name__, e)) + print('ERROR: failed to evaluate meta expression %s at %s' % + (exp.python_exp, exp.token.start)) sys.exit(1) return result @@ -634,7 +634,7 @@ class Env: if identifier == var: return (lower, upper) - print 'ERROR: range %s is undefined.' % (identifier,) + print('ERROR: range %s is undefined.' % (identifier,)) sys.exit(1) @@ -694,8 +694,8 @@ def RunAtomicCode(env, node, output): elif isinstance(node, CodeNode): RunCode(env.Clone(), node, output) else: - print 'BAD' - print node + print('BAD') + print(node) sys.exit(1) @@ -830,7 +830,7 @@ def ConvertFromPumpSource(src_text): def main(argv): if len(argv) == 1: - print __doc__ + print(__doc__) sys.exit(1) file_path = argv[-1] @@ -840,7 +840,7 @@ def main(argv): else: output_file_path = '-' if output_file_path == '-': - print output_str, + print(output_str,) else: output_file = file(output_file_path, 'w') output_file.write('// This file was GENERATED by command:\n') diff --git a/googlemock/scripts/upload.py b/googlemock/scripts/upload.py deleted file mode 100755 index 95239dc..0000000 --- a/googlemock/scripts/upload.py +++ /dev/null @@ -1,1387 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Tool for uploading diffs from a version control system to the codereview app. - -Usage summary: upload.py [options] [-- diff_options] - -Diff options are passed to the diff command of the underlying system. - -Supported version control systems: - Git - Mercurial - Subversion - -It is important for Git/Mercurial users to specify a tree/node/branch to diff -against by using the '--rev' option. -""" -# This code is derived from appcfg.py in the App Engine SDK (open source), -# and from ASPN recipe #146306. - -import cookielib -import getpass -import logging -import md5 -import mimetypes -import optparse -import os -import re -import socket -import subprocess -import sys -import urllib -import urllib2 -import urlparse - -try: - import readline -except ImportError: - pass - -# The logging verbosity: -# 0: Errors only. -# 1: Status messages. -# 2: Info logs. -# 3: Debug logs. -verbosity = 1 - -# Max size of patch or base file. -MAX_UPLOAD_SIZE = 900 * 1024 - - -def GetEmail(prompt): - """Prompts the user for their email address and returns it. - - The last used email address is saved to a file and offered up as a suggestion - to the user. If the user presses enter without typing in anything the last - used email address is used. If the user enters a new address, it is saved - for next time we prompt. - - """ - last_email_file_name = os.path.expanduser("~/.last_codereview_email_address") - last_email = "" - if os.path.exists(last_email_file_name): - try: - last_email_file = open(last_email_file_name, "r") - last_email = last_email_file.readline().strip("\n") - last_email_file.close() - prompt += " [%s]" % last_email - except IOError, e: - pass - email = raw_input(prompt + ": ").strip() - if email: - try: - last_email_file = open(last_email_file_name, "w") - last_email_file.write(email) - last_email_file.close() - except IOError, e: - pass - else: - email = last_email - return email - - -def StatusUpdate(msg): - """Print a status message to stdout. - - If 'verbosity' is greater than 0, print the message. - - Args: - msg: The string to print. - """ - if verbosity > 0: - print msg - - -def ErrorExit(msg): - """Print an error message to stderr and exit.""" - print >>sys.stderr, msg - sys.exit(1) - - -class ClientLoginError(urllib2.HTTPError): - """Raised to indicate there was an error authenticating with ClientLogin.""" - - def __init__(self, url, code, msg, headers, args): - urllib2.HTTPError.__init__(self, url, code, msg, headers, None) - self.args = args - self.reason = args["Error"] - - -class AbstractRpcServer(object): - """Provides a common interface for a simple RPC server.""" - - def __init__(self, host, auth_function, host_override=None, extra_headers={}, - save_cookies=False): - """Creates a new HttpRpcServer. - - Args: - host: The host to send requests to. - auth_function: A function that takes no arguments and returns an - (email, password) tuple when called. Will be called if authentication - is required. - host_override: The host header to send to the server (defaults to host). - extra_headers: A dict of extra headers to append to every request. - save_cookies: If True, save the authentication cookies to local disk. - If False, use an in-memory cookiejar instead. Subclasses must - implement this functionality. Defaults to False. - """ - self.host = host - self.host_override = host_override - self.auth_function = auth_function - self.authenticated = False - self.extra_headers = extra_headers - self.save_cookies = save_cookies - self.opener = self._GetOpener() - if self.host_override: - logging.info("Server: %s; Host: %s", self.host, self.host_override) - else: - logging.info("Server: %s", self.host) - - def _GetOpener(self): - """Returns an OpenerDirector for making HTTP requests. - - Returns: - A urllib2.OpenerDirector object. - """ - raise NotImplementedError() - - def _CreateRequest(self, url, data=None): - """Creates a new urllib request.""" - logging.debug("Creating request for: '%s' with payload:\n%s", url, data) - req = urllib2.Request(url, data=data) - if self.host_override: - req.add_header("Host", self.host_override) - for key, value in self.extra_headers.iteritems(): - req.add_header(key, value) - return req - - def _GetAuthToken(self, email, password): - """Uses ClientLogin to authenticate the user, returning an auth token. - - Args: - email: The user's email address - password: The user's password - - Raises: - ClientLoginError: If there was an error authenticating with ClientLogin. - HTTPError: If there was some other form of HTTP error. - - Returns: - The authentication token returned by ClientLogin. - """ - account_type = "GOOGLE" - if self.host.endswith(".google.com"): - # Needed for use inside Google. - account_type = "HOSTED" - req = self._CreateRequest( - url="https://www.google.com/accounts/ClientLogin", - data=urllib.urlencode({ - "Email": email, - "Passwd": password, - "service": "ah", - "source": "rietveld-codereview-upload", - "accountType": account_type, - }), - ) - try: - response = self.opener.open(req) - response_body = response.read() - response_dict = dict(x.split("=") - for x in response_body.split("\n") if x) - return response_dict["Auth"] - except urllib2.HTTPError, e: - if e.code == 403: - body = e.read() - response_dict = dict(x.split("=", 1) for x in body.split("\n") if x) - raise ClientLoginError(req.get_full_url(), e.code, e.msg, - e.headers, response_dict) - else: - raise - - def _GetAuthCookie(self, auth_token): - """Fetches authentication cookies for an authentication token. - - Args: - auth_token: The authentication token returned by ClientLogin. - - Raises: - HTTPError: If there was an error fetching the authentication cookies. - """ - # This is a dummy value to allow us to identify when we're successful. - continue_location = "http://localhost/" - args = {"continue": continue_location, "auth": auth_token} - req = self._CreateRequest("http://%s/_ah/login?%s" % - (self.host, urllib.urlencode(args))) - try: - response = self.opener.open(req) - except urllib2.HTTPError, e: - response = e - if (response.code != 302 or - response.info()["location"] != continue_location): - raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg, - response.headers, response.fp) - self.authenticated = True - - def _Authenticate(self): - """Authenticates the user. - - The authentication process works as follows: - 1) We get a username and password from the user - 2) We use ClientLogin to obtain an AUTH token for the user - (see https://developers.google.com/identity/protocols/AuthForInstalledApps). - 3) We pass the auth token to /_ah/login on the server to obtain an - authentication cookie. If login was successful, it tries to redirect - us to the URL we provided. - - If we attempt to access the upload API without first obtaining an - authentication cookie, it returns a 401 response and directs us to - authenticate ourselves with ClientLogin. - """ - for i in range(3): - credentials = self.auth_function() - try: - auth_token = self._GetAuthToken(credentials[0], credentials[1]) - except ClientLoginError, e: - if e.reason == "BadAuthentication": - print >>sys.stderr, "Invalid username or password." - continue - if e.reason == "CaptchaRequired": - print >>sys.stderr, ( - "Please go to\n" - "https://www.google.com/accounts/DisplayUnlockCaptcha\n" - "and verify you are a human. Then try again.") - break - if e.reason == "NotVerified": - print >>sys.stderr, "Account not verified." - break - if e.reason == "TermsNotAgreed": - print >>sys.stderr, "User has not agreed to TOS." - break - if e.reason == "AccountDeleted": - print >>sys.stderr, "The user account has been deleted." - break - if e.reason == "AccountDisabled": - print >>sys.stderr, "The user account has been disabled." - break - if e.reason == "ServiceDisabled": - print >>sys.stderr, ("The user's access to the service has been " - "disabled.") - break - if e.reason == "ServiceUnavailable": - print >>sys.stderr, "The service is not available; try again later." - break - raise - self._GetAuthCookie(auth_token) - return - - def Send(self, request_path, payload=None, - content_type="application/octet-stream", - timeout=None, - **kwargs): - """Sends an RPC and returns the response. - - Args: - request_path: The path to send the request to, eg /api/appversion/create. - payload: The body of the request, or None to send an empty request. - content_type: The Content-Type header to use. - timeout: timeout in seconds; default None i.e. no timeout. - (Note: for large requests on OS X, the timeout doesn't work right.) - kwargs: Any keyword arguments are converted into query string parameters. - - Returns: - The response body, as a string. - """ - # TODO: Don't require authentication. Let the server say - # whether it is necessary. - if not self.authenticated: - self._Authenticate() - - old_timeout = socket.getdefaulttimeout() - socket.setdefaulttimeout(timeout) - try: - tries = 0 - while True: - tries += 1 - args = dict(kwargs) - url = "http://%s%s" % (self.host, request_path) - if args: - url += "?" + urllib.urlencode(args) - req = self._CreateRequest(url=url, data=payload) - req.add_header("Content-Type", content_type) - try: - f = self.opener.open(req) - response = f.read() - f.close() - return response - except urllib2.HTTPError, e: - if tries > 3: - raise - elif e.code == 401: - self._Authenticate() -## elif e.code >= 500 and e.code < 600: -## # Server Error - try again. -## continue - else: - raise - finally: - socket.setdefaulttimeout(old_timeout) - - -class HttpRpcServer(AbstractRpcServer): - """Provides a simplified RPC-style interface for HTTP requests.""" - - def _Authenticate(self): - """Save the cookie jar after authentication.""" - super(HttpRpcServer, self)._Authenticate() - if self.save_cookies: - StatusUpdate("Saving authentication cookies to %s" % self.cookie_file) - self.cookie_jar.save() - - def _GetOpener(self): - """Returns an OpenerDirector that supports cookies and ignores redirects. - - Returns: - A urllib2.OpenerDirector object. - """ - opener = urllib2.OpenerDirector() - opener.add_handler(urllib2.ProxyHandler()) - opener.add_handler(urllib2.UnknownHandler()) - opener.add_handler(urllib2.HTTPHandler()) - opener.add_handler(urllib2.HTTPDefaultErrorHandler()) - opener.add_handler(urllib2.HTTPSHandler()) - opener.add_handler(urllib2.HTTPErrorProcessor()) - if self.save_cookies: - self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies") - self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) - if os.path.exists(self.cookie_file): - try: - self.cookie_jar.load() - self.authenticated = True - StatusUpdate("Loaded authentication cookies from %s" % - self.cookie_file) - except (cookielib.LoadError, IOError): - # Failed to load cookies - just ignore them. - pass - else: - # Create an empty cookie file with mode 600 - fd = os.open(self.cookie_file, os.O_CREAT, 0600) - os.close(fd) - # Always chmod the cookie file - os.chmod(self.cookie_file, 0600) - else: - # Don't save cookies across runs of update.py. - self.cookie_jar = cookielib.CookieJar() - opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar)) - return opener - - -parser = optparse.OptionParser(usage="%prog [options] [-- diff_options]") -parser.add_option("-y", "--assume_yes", action="store_true", - dest="assume_yes", default=False, - help="Assume that the answer to yes/no questions is 'yes'.") -# Logging -group = parser.add_option_group("Logging options") -group.add_option("-q", "--quiet", action="store_const", const=0, - dest="verbose", help="Print errors only.") -group.add_option("-v", "--verbose", action="store_const", const=2, - dest="verbose", default=1, - help="Print info level logs (default).") -group.add_option("--noisy", action="store_const", const=3, - dest="verbose", help="Print all logs.") -# Review server -group = parser.add_option_group("Review server options") -group.add_option("-s", "--server", action="store", dest="server", - default="codereview.appspot.com", - metavar="SERVER", - help=("The server to upload to. The format is host[:port]. " - "Defaults to 'codereview.appspot.com'.")) -group.add_option("-e", "--email", action="store", dest="email", - metavar="EMAIL", default=None, - help="The username to use. Will prompt if omitted.") -group.add_option("-H", "--host", action="store", dest="host", - metavar="HOST", default=None, - help="Overrides the Host header sent with all RPCs.") -group.add_option("--no_cookies", action="store_false", - dest="save_cookies", default=True, - help="Do not save authentication cookies to local disk.") -# Issue -group = parser.add_option_group("Issue options") -group.add_option("-d", "--description", action="store", dest="description", - metavar="DESCRIPTION", default=None, - help="Optional description when creating an issue.") -group.add_option("-f", "--description_file", action="store", - dest="description_file", metavar="DESCRIPTION_FILE", - default=None, - help="Optional path of a file that contains " - "the description when creating an issue.") -group.add_option("-r", "--reviewers", action="store", dest="reviewers", - metavar="REVIEWERS", default=None, - help="Add reviewers (comma separated email addresses).") -group.add_option("--cc", action="store", dest="cc", - metavar="CC", default=None, - help="Add CC (comma separated email addresses).") -# Upload options -group = parser.add_option_group("Patch options") -group.add_option("-m", "--message", action="store", dest="message", - metavar="MESSAGE", default=None, - help="A message to identify the patch. " - "Will prompt if omitted.") -group.add_option("-i", "--issue", type="int", action="store", - metavar="ISSUE", default=None, - help="Issue number to which to add. Defaults to new issue.") -group.add_option("--download_base", action="store_true", - dest="download_base", default=False, - help="Base files will be downloaded by the server " - "(side-by-side diffs may not work on files with CRs).") -group.add_option("--rev", action="store", dest="revision", - metavar="REV", default=None, - help="Branch/tree/revision to diff against (used by DVCS).") -group.add_option("--send_mail", action="store_true", - dest="send_mail", default=False, - help="Send notification email to reviewers.") - - -def GetRpcServer(options): - """Returns an instance of an AbstractRpcServer. - - Returns: - A new AbstractRpcServer, on which RPC calls can be made. - """ - - rpc_server_class = HttpRpcServer - - def GetUserCredentials(): - """Prompts the user for a username and password.""" - email = options.email - if email is None: - email = GetEmail("Email (login for uploading to %s)" % options.server) - password = getpass.getpass("Password for %s: " % email) - return (email, password) - - # If this is the dev_appserver, use fake authentication. - host = (options.host or options.server).lower() - if host == "localhost" or host.startswith("localhost:"): - email = options.email - if email is None: - email = "test@example.com" - logging.info("Using debug user %s. Override with --email" % email) - server = rpc_server_class( - options.server, - lambda: (email, "password"), - host_override=options.host, - extra_headers={"Cookie": - 'dev_appserver_login="%s:False"' % email}, - save_cookies=options.save_cookies) - # Don't try to talk to ClientLogin. - server.authenticated = True - return server - - return rpc_server_class(options.server, GetUserCredentials, - host_override=options.host, - save_cookies=options.save_cookies) - - -def EncodeMultipartFormData(fields, files): - """Encode form fields for multipart/form-data. - - Args: - fields: A sequence of (name, value) elements for regular form fields. - files: A sequence of (name, filename, value) elements for data to be - uploaded as files. - Returns: - (content_type, body) ready for httplib.HTTP instance. - - Source: - https://web.archive.org/web/20160116052001/code.activestate.com/recipes/146306 - """ - BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-' - CRLF = '\r\n' - lines = [] - for (key, value) in fields: - lines.append('--' + BOUNDARY) - lines.append('Content-Disposition: form-data; name="%s"' % key) - lines.append('') - lines.append(value) - for (key, filename, value) in files: - lines.append('--' + BOUNDARY) - lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' % - (key, filename)) - lines.append('Content-Type: %s' % GetContentType(filename)) - lines.append('') - lines.append(value) - lines.append('--' + BOUNDARY + '--') - lines.append('') - body = CRLF.join(lines) - content_type = 'multipart/form-data; boundary=%s' % BOUNDARY - return content_type, body - - -def GetContentType(filename): - """Helper to guess the content-type from the filename.""" - return mimetypes.guess_type(filename)[0] or 'application/octet-stream' - - -# Use a shell for subcommands on Windows to get a PATH search. -use_shell = sys.platform.startswith("win") - -def RunShellWithReturnCode(command, print_output=False, - universal_newlines=True): - """Executes a command and returns the output from stdout and the return code. - - Args: - command: Command to execute. - print_output: If True, the output is printed to stdout. - If False, both stdout and stderr are ignored. - universal_newlines: Use universal_newlines flag (default: True). - - Returns: - Tuple (output, return code) - """ - logging.info("Running %s", command) - p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=use_shell, universal_newlines=universal_newlines) - if print_output: - output_array = [] - while True: - line = p.stdout.readline() - if not line: - break - print line.strip("\n") - output_array.append(line) - output = "".join(output_array) - else: - output = p.stdout.read() - p.wait() - errout = p.stderr.read() - if print_output and errout: - print >>sys.stderr, errout - p.stdout.close() - p.stderr.close() - return output, p.returncode - - -def RunShell(command, silent_ok=False, universal_newlines=True, - print_output=False): - data, retcode = RunShellWithReturnCode(command, print_output, - universal_newlines) - if retcode: - ErrorExit("Got error status from %s:\n%s" % (command, data)) - if not silent_ok and not data: - ErrorExit("No output from %s" % command) - return data - - -class VersionControlSystem(object): - """Abstract base class providing an interface to the VCS.""" - - def __init__(self, options): - """Constructor. - - Args: - options: Command line options. - """ - self.options = options - - def GenerateDiff(self, args): - """Return the current diff as a string. - - Args: - args: Extra arguments to pass to the diff command. - """ - raise NotImplementedError( - "abstract method -- subclass %s must override" % self.__class__) - - def GetUnknownFiles(self): - """Return a list of files unknown to the VCS.""" - raise NotImplementedError( - "abstract method -- subclass %s must override" % self.__class__) - - def CheckForUnknownFiles(self): - """Show an "are you sure?" prompt if there are unknown files.""" - unknown_files = self.GetUnknownFiles() - if unknown_files: - print "The following files are not added to version control:" - for line in unknown_files: - print line - prompt = "Are you sure to continue?(y/N) " - answer = raw_input(prompt).strip() - if answer != "y": - ErrorExit("User aborted") - - def GetBaseFile(self, filename): - """Get the content of the upstream version of a file. - - Returns: - A tuple (base_content, new_content, is_binary, status) - base_content: The contents of the base file. - new_content: For text files, this is empty. For binary files, this is - the contents of the new file, since the diff output won't contain - information to reconstruct the current file. - is_binary: True iff the file is binary. - status: The status of the file. - """ - - raise NotImplementedError( - "abstract method -- subclass %s must override" % self.__class__) - - - def GetBaseFiles(self, diff): - """Helper that calls GetBase file for each file in the patch. - - Returns: - A dictionary that maps from filename to GetBaseFile's tuple. Filenames - are retrieved based on lines that start with "Index:" or - "Property changes on:". - """ - files = {} - for line in diff.splitlines(True): - if line.startswith('Index:') or line.startswith('Property changes on:'): - unused, filename = line.split(':', 1) - # On Windows if a file has property changes its filename uses '\' - # instead of '/'. - filename = filename.strip().replace('\\', '/') - files[filename] = self.GetBaseFile(filename) - return files - - - def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options, - files): - """Uploads the base files (and if necessary, the current ones as well).""" - - def UploadFile(filename, file_id, content, is_binary, status, is_base): - """Uploads a file to the server.""" - file_too_large = False - if is_base: - type = "base" - else: - type = "current" - if len(content) > MAX_UPLOAD_SIZE: - print ("Not uploading the %s file for %s because it's too large." % - (type, filename)) - file_too_large = True - content = "" - checksum = md5.new(content).hexdigest() - if options.verbose > 0 and not file_too_large: - print "Uploading %s file for %s" % (type, filename) - url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id) - form_fields = [("filename", filename), - ("status", status), - ("checksum", checksum), - ("is_binary", str(is_binary)), - ("is_current", str(not is_base)), - ] - if file_too_large: - form_fields.append(("file_too_large", "1")) - if options.email: - form_fields.append(("user", options.email)) - ctype, body = EncodeMultipartFormData(form_fields, - [("data", filename, content)]) - response_body = rpc_server.Send(url, body, - content_type=ctype) - if not response_body.startswith("OK"): - StatusUpdate(" --> %s" % response_body) - sys.exit(1) - - patches = dict() - [patches.setdefault(v, k) for k, v in patch_list] - for filename in patches.keys(): - base_content, new_content, is_binary, status = files[filename] - file_id_str = patches.get(filename) - if file_id_str.find("nobase") != -1: - base_content = None - file_id_str = file_id_str[file_id_str.rfind("_") + 1:] - file_id = int(file_id_str) - if base_content != None: - UploadFile(filename, file_id, base_content, is_binary, status, True) - if new_content != None: - UploadFile(filename, file_id, new_content, is_binary, status, False) - - def IsImage(self, filename): - """Returns true if the filename has an image extension.""" - mimetype = mimetypes.guess_type(filename)[0] - if not mimetype: - return False - return mimetype.startswith("image/") - - -class SubversionVCS(VersionControlSystem): - """Implementation of the VersionControlSystem interface for Subversion.""" - - def __init__(self, options): - super(SubversionVCS, self).__init__(options) - if self.options.revision: - match = re.match(r"(\d+)(:(\d+))?", self.options.revision) - if not match: - ErrorExit("Invalid Subversion revision %s." % self.options.revision) - self.rev_start = match.group(1) - self.rev_end = match.group(3) - else: - self.rev_start = self.rev_end = None - # Cache output from "svn list -r REVNO dirname". - # Keys: dirname, Values: 2-tuple (ouput for start rev and end rev). - self.svnls_cache = {} - # SVN base URL is required to fetch files deleted in an older revision. - # Result is cached to not guess it over and over again in GetBaseFile(). - required = self.options.download_base or self.options.revision is not None - self.svn_base = self._GuessBase(required) - - def GuessBase(self, required): - """Wrapper for _GuessBase.""" - return self.svn_base - - def _GuessBase(self, required): - """Returns the SVN base URL. - - Args: - required: If true, exits if the url can't be guessed, otherwise None is - returned. - """ - info = RunShell(["svn", "info"]) - for line in info.splitlines(): - words = line.split() - if len(words) == 2 and words[0] == "URL:": - url = words[1] - scheme, netloc, path, params, query, fragment = urlparse.urlparse(url) - username, netloc = urllib.splituser(netloc) - if username: - logging.info("Removed username from base URL") - if netloc.endswith("svn.python.org"): - if netloc == "svn.python.org": - if path.startswith("/projects/"): - path = path[9:] - elif netloc != "pythondev@svn.python.org": - ErrorExit("Unrecognized Python URL: %s" % url) - base = "http://svn.python.org/view/*checkout*%s/" % path - logging.info("Guessed Python base = %s", base) - elif netloc.endswith("svn.collab.net"): - if path.startswith("/repos/"): - path = path[6:] - base = "http://svn.collab.net/viewvc/*checkout*%s/" % path - logging.info("Guessed CollabNet base = %s", base) - elif netloc.endswith(".googlecode.com"): - path = path + "/" - base = urlparse.urlunparse(("http", netloc, path, params, - query, fragment)) - logging.info("Guessed Google Code base = %s", base) - else: - path = path + "/" - base = urlparse.urlunparse((scheme, netloc, path, params, - query, fragment)) - logging.info("Guessed base = %s", base) - return base - if required: - ErrorExit("Can't find URL in output from svn info") - return None - - def GenerateDiff(self, args): - cmd = ["svn", "diff"] - if self.options.revision: - cmd += ["-r", self.options.revision] - cmd.extend(args) - data = RunShell(cmd) - count = 0 - for line in data.splitlines(): - if line.startswith("Index:") or line.startswith("Property changes on:"): - count += 1 - logging.info(line) - if not count: - ErrorExit("No valid patches found in output from svn diff") - return data - - def _CollapseKeywords(self, content, keyword_str): - """Collapses SVN keywords.""" - # svn cat translates keywords but svn diff doesn't. As a result of this - # behavior patching.PatchChunks() fails with a chunk mismatch error. - # This part was originally written by the Review Board development team - # who had the same problem (https://reviews.reviewboard.org/r/276/). - # Mapping of keywords to known aliases - svn_keywords = { - # Standard keywords - 'Date': ['Date', 'LastChangedDate'], - 'Revision': ['Revision', 'LastChangedRevision', 'Rev'], - 'Author': ['Author', 'LastChangedBy'], - 'HeadURL': ['HeadURL', 'URL'], - 'Id': ['Id'], - - # Aliases - 'LastChangedDate': ['LastChangedDate', 'Date'], - 'LastChangedRevision': ['LastChangedRevision', 'Rev', 'Revision'], - 'LastChangedBy': ['LastChangedBy', 'Author'], - 'URL': ['URL', 'HeadURL'], - } - - def repl(m): - if m.group(2): - return "$%s::%s$" % (m.group(1), " " * len(m.group(3))) - return "$%s$" % m.group(1) - keywords = [keyword - for name in keyword_str.split(" ") - for keyword in svn_keywords.get(name, [])] - return re.sub(r"\$(%s):(:?)([^\$]+)\$" % '|'.join(keywords), repl, content) - - def GetUnknownFiles(self): - status = RunShell(["svn", "status", "--ignore-externals"], silent_ok=True) - unknown_files = [] - for line in status.split("\n"): - if line and line[0] == "?": - unknown_files.append(line) - return unknown_files - - def ReadFile(self, filename): - """Returns the contents of a file.""" - file = open(filename, 'rb') - result = "" - try: - result = file.read() - finally: - file.close() - return result - - def GetStatus(self, filename): - """Returns the status of a file.""" - if not self.options.revision: - status = RunShell(["svn", "status", "--ignore-externals", filename]) - if not status: - ErrorExit("svn status returned no output for %s" % filename) - status_lines = status.splitlines() - # If file is in a cl, the output will begin with - # "\n--- Changelist 'cl_name':\n". See - # https://web.archive.org/web/20090918234815/svn.collab.net/repos/svn/trunk/notes/changelist-design.txt - if (len(status_lines) == 3 and - not status_lines[0] and - status_lines[1].startswith("--- Changelist")): - status = status_lines[2] - else: - status = status_lines[0] - # If we have a revision to diff against we need to run "svn list" - # for the old and the new revision and compare the results to get - # the correct status for a file. - else: - dirname, relfilename = os.path.split(filename) - if dirname not in self.svnls_cache: - cmd = ["svn", "list", "-r", self.rev_start, dirname or "."] - out, returncode = RunShellWithReturnCode(cmd) - if returncode: - ErrorExit("Failed to get status for %s." % filename) - old_files = out.splitlines() - args = ["svn", "list"] - if self.rev_end: - args += ["-r", self.rev_end] - cmd = args + [dirname or "."] - out, returncode = RunShellWithReturnCode(cmd) - if returncode: - ErrorExit("Failed to run command %s" % cmd) - self.svnls_cache[dirname] = (old_files, out.splitlines()) - old_files, new_files = self.svnls_cache[dirname] - if relfilename in old_files and relfilename not in new_files: - status = "D " - elif relfilename in old_files and relfilename in new_files: - status = "M " - else: - status = "A " - return status - - def GetBaseFile(self, filename): - status = self.GetStatus(filename) - base_content = None - new_content = None - - # If a file is copied its status will be "A +", which signifies - # "addition-with-history". See "svn st" for more information. We need to - # upload the original file or else diff parsing will fail if the file was - # edited. - if status[0] == "A" and status[3] != "+": - # We'll need to upload the new content if we're adding a binary file - # since diff's output won't contain it. - mimetype = RunShell(["svn", "propget", "svn:mime-type", filename], - silent_ok=True) - base_content = "" - is_binary = mimetype and not mimetype.startswith("text/") - if is_binary and self.IsImage(filename): - new_content = self.ReadFile(filename) - elif (status[0] in ("M", "D", "R") or - (status[0] == "A" and status[3] == "+") or # Copied file. - (status[0] == " " and status[1] == "M")): # Property change. - args = [] - if self.options.revision: - url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) - else: - # Don't change filename, it's needed later. - url = filename - args += ["-r", "BASE"] - cmd = ["svn"] + args + ["propget", "svn:mime-type", url] - mimetype, returncode = RunShellWithReturnCode(cmd) - if returncode: - # File does not exist in the requested revision. - # Reset mimetype, it contains an error message. - mimetype = "" - get_base = False - is_binary = mimetype and not mimetype.startswith("text/") - if status[0] == " ": - # Empty base content just to force an upload. - base_content = "" - elif is_binary: - if self.IsImage(filename): - get_base = True - if status[0] == "M": - if not self.rev_end: - new_content = self.ReadFile(filename) - else: - url = "%s/%s@%s" % (self.svn_base, filename, self.rev_end) - new_content = RunShell(["svn", "cat", url], - universal_newlines=True, silent_ok=True) - else: - base_content = "" - else: - get_base = True - - if get_base: - if is_binary: - universal_newlines = False - else: - universal_newlines = True - if self.rev_start: - # "svn cat -r REV delete_file.txt" doesn't work. cat requires - # the full URL with "@REV" appended instead of using "-r" option. - url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) - base_content = RunShell(["svn", "cat", url], - universal_newlines=universal_newlines, - silent_ok=True) - else: - base_content = RunShell(["svn", "cat", filename], - universal_newlines=universal_newlines, - silent_ok=True) - if not is_binary: - args = [] - if self.rev_start: - url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) - else: - url = filename - args += ["-r", "BASE"] - cmd = ["svn"] + args + ["propget", "svn:keywords", url] - keywords, returncode = RunShellWithReturnCode(cmd) - if keywords and not returncode: - base_content = self._CollapseKeywords(base_content, keywords) - else: - StatusUpdate("svn status returned unexpected output: %s" % status) - sys.exit(1) - return base_content, new_content, is_binary, status[0:5] - - -class GitVCS(VersionControlSystem): - """Implementation of the VersionControlSystem interface for Git.""" - - def __init__(self, options): - super(GitVCS, self).__init__(options) - # Map of filename -> hash of base file. - self.base_hashes = {} - - def GenerateDiff(self, extra_args): - # This is more complicated than svn's GenerateDiff because we must convert - # the diff output to include an svn-style "Index:" line as well as record - # the hashes of the base files, so we can upload them along with our diff. - if self.options.revision: - extra_args = [self.options.revision] + extra_args - gitdiff = RunShell(["git", "diff", "--full-index"] + extra_args) - svndiff = [] - filecount = 0 - filename = None - for line in gitdiff.splitlines(): - match = re.match(r"diff --git a/(.*) b/.*$", line) - if match: - filecount += 1 - filename = match.group(1) - svndiff.append("Index: %s\n" % filename) - else: - # The "index" line in a git diff looks like this (long hashes elided): - # index 82c0d44..b2cee3f 100755 - # We want to save the left hash, as that identifies the base file. - match = re.match(r"index (\w+)\.\.", line) - if match: - self.base_hashes[filename] = match.group(1) - svndiff.append(line + "\n") - if not filecount: - ErrorExit("No valid patches found in output from git diff") - return "".join(svndiff) - - def GetUnknownFiles(self): - status = RunShell(["git", "ls-files", "--exclude-standard", "--others"], - silent_ok=True) - return status.splitlines() - - def GetBaseFile(self, filename): - hash = self.base_hashes[filename] - base_content = None - new_content = None - is_binary = False - if hash == "0" * 40: # All-zero hash indicates no base file. - status = "A" - base_content = "" - else: - status = "M" - base_content, returncode = RunShellWithReturnCode(["git", "show", hash]) - if returncode: - ErrorExit("Got error status from 'git show %s'" % hash) - return (base_content, new_content, is_binary, status) - - -class MercurialVCS(VersionControlSystem): - """Implementation of the VersionControlSystem interface for Mercurial.""" - - def __init__(self, options, repo_dir): - super(MercurialVCS, self).__init__(options) - # Absolute path to repository (we can be in a subdir) - self.repo_dir = os.path.normpath(repo_dir) - # Compute the subdir - cwd = os.path.normpath(os.getcwd()) - assert cwd.startswith(self.repo_dir) - self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/") - if self.options.revision: - self.base_rev = self.options.revision - else: - self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip() - - def _GetRelPath(self, filename): - """Get relative path of a file according to the current directory, - given its logical path in the repo.""" - assert filename.startswith(self.subdir), filename - return filename[len(self.subdir):].lstrip(r"\/") - - def GenerateDiff(self, extra_args): - # If no file specified, restrict to the current subdir - extra_args = extra_args or ["."] - cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args - data = RunShell(cmd, silent_ok=True) - svndiff = [] - filecount = 0 - for line in data.splitlines(): - m = re.match("diff --git a/(\S+) b/(\S+)", line) - if m: - # Modify line to make it look like as it comes from svn diff. - # With this modification no changes on the server side are required - # to make upload.py work with Mercurial repos. - # NOTE: for proper handling of moved/copied files, we have to use - # the second filename. - filename = m.group(2) - svndiff.append("Index: %s" % filename) - svndiff.append("=" * 67) - filecount += 1 - logging.info(line) - else: - svndiff.append(line) - if not filecount: - ErrorExit("No valid patches found in output from hg diff") - return "\n".join(svndiff) + "\n" - - def GetUnknownFiles(self): - """Return a list of files unknown to the VCS.""" - args = [] - status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."], - silent_ok=True) - unknown_files = [] - for line in status.splitlines(): - st, fn = line.split(" ", 1) - if st == "?": - unknown_files.append(fn) - return unknown_files - - def GetBaseFile(self, filename): - # "hg status" and "hg cat" both take a path relative to the current subdir - # rather than to the repo root, but "hg diff" has given us the full path - # to the repo root. - base_content = "" - new_content = None - is_binary = False - oldrelpath = relpath = self._GetRelPath(filename) - # "hg status -C" returns two lines for moved/copied files, one otherwise - out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath]) - out = out.splitlines() - # HACK: strip error message about missing file/directory if it isn't in - # the working copy - if out[0].startswith('%s: ' % relpath): - out = out[1:] - if len(out) > 1: - # Moved/copied => considered as modified, use old filename to - # retrieve base contents - oldrelpath = out[1].strip() - status = "M" - else: - status, _ = out[0].split(' ', 1) - if status != "A": - base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath], - silent_ok=True) - is_binary = "\0" in base_content # Mercurial's heuristic - if status != "R": - new_content = open(relpath, "rb").read() - is_binary = is_binary or "\0" in new_content - if is_binary and base_content: - # Fetch again without converting newlines - base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath], - silent_ok=True, universal_newlines=False) - if not is_binary or not self.IsImage(relpath): - new_content = None - return base_content, new_content, is_binary, status - - -# NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync. -def SplitPatch(data): - """Splits a patch into separate pieces for each file. - - Args: - data: A string containing the output of svn diff. - - Returns: - A list of 2-tuple (filename, text) where text is the svn diff output - pertaining to filename. - """ - patches = [] - filename = None - diff = [] - for line in data.splitlines(True): - new_filename = None - if line.startswith('Index:'): - unused, new_filename = line.split(':', 1) - new_filename = new_filename.strip() - elif line.startswith('Property changes on:'): - unused, temp_filename = line.split(':', 1) - # When a file is modified, paths use '/' between directories, however - # when a property is modified '\' is used on Windows. Make them the same - # otherwise the file shows up twice. - temp_filename = temp_filename.strip().replace('\\', '/') - if temp_filename != filename: - # File has property changes but no modifications, create a new diff. - new_filename = temp_filename - if new_filename: - if filename and diff: - patches.append((filename, ''.join(diff))) - filename = new_filename - diff = [line] - continue - if diff is not None: - diff.append(line) - if filename and diff: - patches.append((filename, ''.join(diff))) - return patches - - -def UploadSeparatePatches(issue, rpc_server, patchset, data, options): - """Uploads a separate patch for each file in the diff output. - - Returns a list of [patch_key, filename] for each file. - """ - patches = SplitPatch(data) - rv = [] - for patch in patches: - if len(patch[1]) > MAX_UPLOAD_SIZE: - print ("Not uploading the patch for " + patch[0] + - " because the file is too large.") - continue - form_fields = [("filename", patch[0])] - if not options.download_base: - form_fields.append(("content_upload", "1")) - files = [("data", "data.diff", patch[1])] - ctype, body = EncodeMultipartFormData(form_fields, files) - url = "/%d/upload_patch/%d" % (int(issue), int(patchset)) - print "Uploading patch for " + patch[0] - response_body = rpc_server.Send(url, body, content_type=ctype) - lines = response_body.splitlines() - if not lines or lines[0] != "OK": - StatusUpdate(" --> %s" % response_body) - sys.exit(1) - rv.append([lines[1], patch[0]]) - return rv - - -def GuessVCS(options): - """Helper to guess the version control system. - - This examines the current directory, guesses which VersionControlSystem - we're using, and returns an instance of the appropriate class. Exit with an - error if we can't figure it out. - - Returns: - A VersionControlSystem instance. Exits if the VCS can't be guessed. - """ - # Mercurial has a command to get the base directory of a repository - # Try running it, but don't die if we don't have hg installed. - # NOTE: we try Mercurial first as it can sit on top of an SVN working copy. - try: - out, returncode = RunShellWithReturnCode(["hg", "root"]) - if returncode == 0: - return MercurialVCS(options, out.strip()) - except OSError, (errno, message): - if errno != 2: # ENOENT -- they don't have hg installed. - raise - - # Subversion has a .svn in all working directories. - if os.path.isdir('.svn'): - logging.info("Guessed VCS = Subversion") - return SubversionVCS(options) - - # Git has a command to test if you're in a git tree. - # Try running it, but don't die if we don't have git installed. - try: - out, returncode = RunShellWithReturnCode(["git", "rev-parse", - "--is-inside-work-tree"]) - if returncode == 0: - return GitVCS(options) - except OSError, (errno, message): - if errno != 2: # ENOENT -- they don't have git installed. - raise - - ErrorExit(("Could not guess version control system. " - "Are you in a working copy directory?")) - - -def RealMain(argv, data=None): - """The real main function. - - Args: - argv: Command line arguments. - data: Diff contents. If None (default) the diff is generated by - the VersionControlSystem implementation returned by GuessVCS(). - - Returns: - A 2-tuple (issue id, patchset id). - The patchset id is None if the base files are not uploaded by this - script (applies only to SVN checkouts). - """ - logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:" - "%(lineno)s %(message)s ")) - os.environ['LC_ALL'] = 'C' - options, args = parser.parse_args(argv[1:]) - global verbosity - verbosity = options.verbose - if verbosity >= 3: - logging.getLogger().setLevel(logging.DEBUG) - elif verbosity >= 2: - logging.getLogger().setLevel(logging.INFO) - vcs = GuessVCS(options) - if isinstance(vcs, SubversionVCS): - # base field is only allowed for Subversion. - # Note: Fetching base files may become deprecated in future releases. - base = vcs.GuessBase(options.download_base) - else: - base = None - if not base and options.download_base: - options.download_base = True - logging.info("Enabled upload of base file") - if not options.assume_yes: - vcs.CheckForUnknownFiles() - if data is None: - data = vcs.GenerateDiff(args) - files = vcs.GetBaseFiles(data) - if verbosity >= 1: - print "Upload server:", options.server, "(change with -s/--server)" - if options.issue: - prompt = "Message describing this patch set: " - else: - prompt = "New issue subject: " - message = options.message or raw_input(prompt).strip() - if not message: - ErrorExit("A non-empty message is required") - rpc_server = GetRpcServer(options) - form_fields = [("subject", message)] - if base: - form_fields.append(("base", base)) - if options.issue: - form_fields.append(("issue", str(options.issue))) - if options.email: - form_fields.append(("user", options.email)) - if options.reviewers: - for reviewer in options.reviewers.split(','): - if "@" in reviewer and not reviewer.split("@")[1].count(".") == 1: - ErrorExit("Invalid email address: %s" % reviewer) - form_fields.append(("reviewers", options.reviewers)) - if options.cc: - for cc in options.cc.split(','): - if "@" in cc and not cc.split("@")[1].count(".") == 1: - ErrorExit("Invalid email address: %s" % cc) - form_fields.append(("cc", options.cc)) - description = options.description - if options.description_file: - if options.description: - ErrorExit("Can't specify description and description_file") - file = open(options.description_file, 'r') - description = file.read() - file.close() - if description: - form_fields.append(("description", description)) - # Send a hash of all the base file so the server can determine if a copy - # already exists in an earlier patchset. - base_hashes = "" - for file, info in files.iteritems(): - if not info[0] is None: - checksum = md5.new(info[0]).hexdigest() - if base_hashes: - base_hashes += "|" - base_hashes += checksum + ":" + file - form_fields.append(("base_hashes", base_hashes)) - # If we're uploading base files, don't send the email before the uploads, so - # that it contains the file status. - if options.send_mail and options.download_base: - form_fields.append(("send_mail", "1")) - if not options.download_base: - form_fields.append(("content_upload", "1")) - if len(data) > MAX_UPLOAD_SIZE: - print "Patch is large, so uploading file patches separately." - uploaded_diff_file = [] - form_fields.append(("separate_patches", "1")) - else: - uploaded_diff_file = [("data", "data.diff", data)] - ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file) - response_body = rpc_server.Send("/upload", body, content_type=ctype) - patchset = None - if not options.download_base or not uploaded_diff_file: - lines = response_body.splitlines() - if len(lines) >= 2: - msg = lines[0] - patchset = lines[1].strip() - patches = [x.split(" ", 1) for x in lines[2:]] - else: - msg = response_body - else: - msg = response_body - StatusUpdate(msg) - if not response_body.startswith("Issue created.") and \ - not response_body.startswith("Issue updated."): - sys.exit(0) - issue = msg[msg.rfind("/")+1:] - - if not uploaded_diff_file: - result = UploadSeparatePatches(issue, rpc_server, patchset, data, options) - if not options.download_base: - patches = result - - if not options.download_base: - vcs.UploadBaseFiles(issue, rpc_server, patches, patchset, options, files) - if options.send_mail: - rpc_server.Send("/" + issue + "/mail", payload="") - return issue, patchset - - -def main(): - try: - RealMain(sys.argv) - except KeyboardInterrupt: - print - StatusUpdate("Interrupted.") - sys.exit(1) - - -if __name__ == "__main__": - main() diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc index 1292e1d..e5b5479 100644 --- a/googlemock/src/gmock-internal-utils.cc +++ b/googlemock/src/gmock-internal-utils.cc @@ -123,8 +123,8 @@ GTEST_API_ FailureReporterInterface* GetFailureReporter() { // Protects global resources (stdout in particular) used by Log(). static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex); -// Returns true if a log with the given severity is visible according -// to the --gmock_verbose flag. +// Returns true if and only if a log with the given severity is visible +// according to the --gmock_verbose flag. GTEST_API_ bool LogIsVisible(LogSeverity severity) { if (GMOCK_FLAG(verbose) == kInfoVerbosity) { // Always show the log if --gmock_verbose=info. @@ -139,7 +139,7 @@ GTEST_API_ bool LogIsVisible(LogSeverity severity) { } } -// Prints the given message to stdout if 'severity' >= the level +// Prints the given message to stdout if and only if 'severity' >= the level // specified by the --gmock_verbose flag. If stack_frames_to_skip >= // 0, also prints the stack trace excluding the top // stack_frames_to_skip frames. In opt mode, any positive diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index f6705a3..81ea989 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -36,14 +36,17 @@ #include "gmock/gmock-spec-builders.h" #include <stdlib.h> + #include <iostream> // NOLINT #include <map> #include <memory> #include <set> #include <string> #include <vector> + #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "gtest/internal/gtest-port.h" #if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC # include <unistd.h> // NOLINT @@ -70,7 +73,8 @@ GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, const char* file, int line, const std::string& message) { ::std::ostringstream s; - s << file << ":" << line << ": " << message << ::std::endl; + s << internal::FormatFileLocation(file, line) << " " << message + << ::std::endl; Log(severity, s.str(), 0); } @@ -126,8 +130,8 @@ void ExpectationBase::RetireAllPreRequisites() } } -// Returns true if all pre-requisites of this expectation have been -// satisfied. +// Returns true if and only if all pre-requisites of this expectation +// have been satisfied. bool ExpectationBase::AllPrerequisitesAreSatisfied() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { g_gmock_mutex.AssertHeld(); @@ -384,7 +388,7 @@ UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith( const CallReaction reaction = Mock::GetReactionOnUninterestingCalls(MockObject()); - // True if we need to print this call's arguments and return + // True if and only if we need to print this call's arguments and return // value. This definition must be kept in sync with // the behavior of ReportUninterestingCall(). const bool need_to_report_uninteresting_call = @@ -435,7 +439,8 @@ UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith( &ss, &why); const bool found = untyped_expectation != nullptr; - // True if we need to print the call's arguments and return value. + // True if and only if we need to print the call's arguments + // and return value. // This definition must be kept in sync with the uses of Expect() // and Log() in this function. const bool need_to_report_call = @@ -574,7 +579,7 @@ struct MockObjectState { int first_used_line; ::std::string first_used_test_suite; ::std::string first_used_test; - bool leakable; // true if it's OK to leak the object. + bool leakable; // true if and only if it's OK to leak the object. FunctionMockers function_mockers; // All registered methods of the object. }; @@ -718,7 +723,7 @@ bool Mock::VerifyAndClearExpectations(void* mock_obj) } // Verifies all expectations on the given mock object and clears its -// default actions and expectations. Returns true if the +// default actions and expectations. Returns true if and only if the // verification was successful. bool Mock::VerifyAndClear(void* mock_obj) GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { diff --git a/googlemock/src/gmock.cc b/googlemock/src/gmock.cc index ce926f2..32b2a73 100644 --- a/googlemock/src/gmock.cc +++ b/googlemock/src/gmock.cc @@ -34,8 +34,8 @@ namespace testing { GMOCK_DEFINE_bool_(catch_leaked_mocks, true, - "true if Google Mock should report leaked mock objects " - "as failures."); + "true if and only if Google Mock should report leaked " + "mock objects as failures."); GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity, "Controls how verbose Google Mock's output is." diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc index 98611b9..18c500f 100644 --- a/googlemock/src/gmock_main.cc +++ b/googlemock/src/gmock_main.cc @@ -32,7 +32,10 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#ifdef ARDUINO +#if GTEST_OS_ESP8266 || GTEST_OS_ESP32 +#if GTEST_OS_ESP8266 +extern "C" { +#endif void setup() { // Since Google Mock depends on Google Test, InitGoogleMock() is // also responsible for initializing Google Test. Therefore there's @@ -40,6 +43,10 @@ void setup() { testing::InitGoogleMock(); } void loop() { RUN_ALL_TESTS(); } +#if GTEST_OS_ESP8266 +} +#endif + #else // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index f63c8c5..ae4fa20 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -46,6 +46,7 @@ #include <iterator> #include <memory> #include <string> +#include <type_traits> #include "gmock/gmock.h" #include "gmock/internal/gmock-port.h" #include "gtest/gtest.h" @@ -73,6 +74,7 @@ using testing::Return; using testing::ReturnNull; using testing::ReturnRef; using testing::ReturnRefOfCopy; +using testing::ReturnRoundRobin; using testing::SetArgPointee; using testing::SetArgumentPointee; using testing::Unused; @@ -646,6 +648,41 @@ TEST(ReturnRefTest, IsCovariant) { EXPECT_EQ(&derived, &a.Perform(std::make_tuple())); } +template <typename T, typename = decltype(ReturnRef(std::declval<T&&>()))> +bool CanCallReturnRef(T&&) { return true; } +bool CanCallReturnRef(Unused) { return false; } + +// Tests that ReturnRef(v) is working with non-temporaries (T&) +TEST(ReturnRefTest, WorksForNonTemporary) { + int scalar_value = 123; + EXPECT_TRUE(CanCallReturnRef(scalar_value)); + + std::string non_scalar_value("ABC"); + EXPECT_TRUE(CanCallReturnRef(non_scalar_value)); + + const int const_scalar_value{321}; + EXPECT_TRUE(CanCallReturnRef(const_scalar_value)); + + const std::string const_non_scalar_value("CBA"); + EXPECT_TRUE(CanCallReturnRef(const_non_scalar_value)); +} + +// Tests that ReturnRef(v) is not working with temporaries (T&&) +TEST(ReturnRefTest, DoesNotWorkForTemporary) { + auto scalar_value = []() -> int { return 123; }; + EXPECT_FALSE(CanCallReturnRef(scalar_value())); + + auto non_scalar_value = []() -> std::string { return "ABC"; }; + EXPECT_FALSE(CanCallReturnRef(non_scalar_value())); + + // cannot use here callable returning "const scalar type", + // because such const for scalar return type is ignored + EXPECT_FALSE(CanCallReturnRef(static_cast<const int>(321))); + + auto const_non_scalar_value = []() -> const std::string { return "CBA"; }; + EXPECT_FALSE(CanCallReturnRef(const_non_scalar_value())); +} + // Tests that ReturnRefOfCopy(v) works for reference types. TEST(ReturnRefOfCopyTest, WorksForReference) { int n = 42; @@ -670,6 +707,31 @@ TEST(ReturnRefOfCopyTest, IsCovariant) { EXPECT_NE(&derived, &a.Perform(std::make_tuple())); } +// Tests that ReturnRoundRobin(v) works with initializer lists +TEST(ReturnRoundRobinTest, WorksForInitList) { + Action<int()> ret = ReturnRoundRobin({1, 2, 3}); + + EXPECT_EQ(1, ret.Perform(std::make_tuple())); + EXPECT_EQ(2, ret.Perform(std::make_tuple())); + EXPECT_EQ(3, ret.Perform(std::make_tuple())); + EXPECT_EQ(1, ret.Perform(std::make_tuple())); + EXPECT_EQ(2, ret.Perform(std::make_tuple())); + EXPECT_EQ(3, ret.Perform(std::make_tuple())); +} + +// Tests that ReturnRoundRobin(v) works with vectors +TEST(ReturnRoundRobinTest, WorksForVector) { + std::vector<double> v = {4.4, 5.5, 6.6}; + Action<double()> ret = ReturnRoundRobin(v); + + EXPECT_EQ(4.4, ret.Perform(std::make_tuple())); + EXPECT_EQ(5.5, ret.Perform(std::make_tuple())); + EXPECT_EQ(6.6, ret.Perform(std::make_tuple())); + EXPECT_EQ(4.4, ret.Perform(std::make_tuple())); + EXPECT_EQ(5.5, ret.Perform(std::make_tuple())); + EXPECT_EQ(6.6, ret.Perform(std::make_tuple())); +} + // Tests that DoDefault() does the default action for the mock method. class MockClass { diff --git a/googlemock/test/gmock-cardinalities_test.cc b/googlemock/test/gmock-cardinalities_test.cc index 66042d4..ca97cae 100644 --- a/googlemock/test/gmock-cardinalities_test.cc +++ b/googlemock/test/gmock-cardinalities_test.cc @@ -395,12 +395,14 @@ TEST(ExactlyTest, HasCorrectBounds) { class EvenCardinality : public CardinalityInterface { public: - // Returns true if call_count calls will satisfy this cardinality. + // Returns true if and only if call_count calls will satisfy this + // cardinality. bool IsSatisfiedByCallCount(int call_count) const override { return (call_count % 2 == 0); } - // Returns true if call_count calls will saturate this cardinality. + // Returns true if and only if call_count calls will saturate this + // cardinality. bool IsSaturatedByCallCount(int /* call_count */) const override { return false; } diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc index fbc5d5b..90d6b5f 100644 --- a/googlemock/test/gmock-function-mocker_test.cc +++ b/googlemock/test/gmock-function-mocker_test.cc @@ -42,6 +42,8 @@ #include <map> #include <string> +#include <type_traits> + #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -101,6 +103,10 @@ class FooInterface { virtual int TypeWithComma(const std::map<int, std::string>& a_map) = 0; virtual int TypeWithTemplatedCopyCtor(const TemplatedCopyable<int>&) = 0; + virtual int (*ReturnsFunctionPointer1(int))(bool) = 0; + using fn_ptr = int (*)(bool); + virtual fn_ptr ReturnsFunctionPointer2(int) = 0; + #if GTEST_OS_WINDOWS STDMETHOD_(int, CTNullary)() = 0; STDMETHOD_(bool, CTUnary)(int x) = 0; @@ -159,6 +165,9 @@ class MockFoo : public FooInterface { MOCK_METHOD(int, TypeWithTemplatedCopyCtor, (const TemplatedCopyable<int>&)); // NOLINT + MOCK_METHOD(int (*)(bool), ReturnsFunctionPointer1, (int), ()); + MOCK_METHOD(fn_ptr, ReturnsFunctionPointer2, (int), ()); + #if GTEST_OS_WINDOWS MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE))); MOCK_METHOD(bool, CTUnary, (int), (Calltype(STDMETHODCALLTYPE))); @@ -656,5 +665,32 @@ TEST(MockMethodMockFunctionTest, MockMethodSizeOverhead) { EXPECT_EQ(sizeof(MockMethodSizes0), sizeof(MockMethodSizes4)); } +void hasTwoParams(int, int); +void MaybeThrows(); +void DoesntThrow() noexcept; +struct MockMethodNoexceptSpecifier { + MOCK_METHOD(void, func1, (), (noexcept)); + MOCK_METHOD(void, func2, (), (noexcept(true))); + MOCK_METHOD(void, func3, (), (noexcept(false))); + MOCK_METHOD(void, func4, (), (noexcept(noexcept(MaybeThrows())))); + MOCK_METHOD(void, func5, (), (noexcept(noexcept(DoesntThrow())))); + MOCK_METHOD(void, func6, (), (noexcept(noexcept(DoesntThrow())), const)); + MOCK_METHOD(void, func7, (), (const, noexcept(noexcept(DoesntThrow())))); + // Put commas in the noexcept expression + MOCK_METHOD(void, func8, (), (noexcept(noexcept(hasTwoParams(1, 2))), const)); +}; + +TEST(MockMethodMockFunctionTest, NoexceptSpecifierPreserved) { + EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func1())); + EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func2())); + EXPECT_FALSE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func3())); + EXPECT_FALSE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func4())); + EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func5())); + EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func6())); + EXPECT_TRUE(noexcept(std::declval<MockMethodNoexceptSpecifier>().func7())); + EXPECT_EQ(noexcept(std::declval<MockMethodNoexceptSpecifier>().func8()), + noexcept(hasTwoParams(1, 2))); +} + } // namespace gmock_function_mocker_test } // namespace testing diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc index 6c4b300..f3f49a6 100644 --- a/googlemock/test/gmock-generated-matchers_test.cc +++ b/googlemock/test/gmock-generated-matchers_test.cc @@ -41,6 +41,8 @@ #include "gmock/gmock-generated-matchers.h" +#include <array> +#include <iterator> #include <list> #include <map> #include <memory> @@ -51,8 +53,8 @@ #include <vector> #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "gtest/gtest-spi.h" +#include "gtest/gtest.h" namespace { @@ -195,7 +197,7 @@ TEST(ElementsAreTest, ExplainsNonTrivialMatch) { ElementsAre(GreaterThan(1), 0, GreaterThan(2)); const int a[] = { 10, 0, 100 }; - vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); + vector<int> test_vector(std::begin(a), std::end(a)); EXPECT_EQ("whose element #0 matches, which is 9 more than 1,\n" "and whose element #2 matches, which is 98 more than 2", Explain(m, test_vector)); @@ -280,7 +282,7 @@ TEST(ElementsAreTest, MatchesThreeElementsMixedMatchers) { TEST(ElementsAreTest, MatchesTenElementVector) { const int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); + vector<int> test_vector(std::begin(a), std::end(a)); EXPECT_THAT(test_vector, // The element list can contain values and/or matchers @@ -317,13 +319,10 @@ TEST(ElementsAreTest, DoesNotMatchWrongOrder) { } TEST(ElementsAreTest, WorksForNestedContainer) { - const char* strings[] = { - "Hi", - "world" - }; + constexpr std::array<const char*, 2> strings = {{"Hi", "world"}}; vector<list<char> > nested; - for (size_t i = 0; i < GTEST_ARRAY_SIZE_(strings); i++) { + for (size_t i = 0; i < strings.size(); i++) { nested.push_back(list<char>(strings[i], strings[i] + strlen(strings[i]))); } @@ -335,7 +334,7 @@ TEST(ElementsAreTest, WorksForNestedContainer) { TEST(ElementsAreTest, WorksWithByRefElementMatchers) { int a[] = { 0, 1, 2 }; - vector<int> v(a, a + GTEST_ARRAY_SIZE_(a)); + vector<int> v(std::begin(a), std::end(a)); EXPECT_THAT(v, ElementsAre(Ref(v[0]), Ref(v[1]), Ref(v[2]))); EXPECT_THAT(v, Not(ElementsAre(Ref(v[0]), Ref(v[1]), Ref(a[2])))); @@ -343,7 +342,7 @@ TEST(ElementsAreTest, WorksWithByRefElementMatchers) { TEST(ElementsAreTest, WorksWithContainerPointerUsingPointee) { int a[] = { 0, 1, 2 }; - vector<int> v(a, a + GTEST_ARRAY_SIZE_(a)); + vector<int> v(std::begin(a), std::end(a)); EXPECT_THAT(&v, Pointee(ElementsAre(0, 1, _))); EXPECT_THAT(&v, Not(Pointee(ElementsAre(0, _, 3)))); @@ -440,7 +439,7 @@ TEST(ElementsAreTest, MakesCopyOfArguments) { TEST(ElementsAreArrayTest, CanBeCreatedWithValueArray) { const int a[] = { 1, 2, 3 }; - vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); + vector<int> test_vector(std::begin(a), std::end(a)); EXPECT_THAT(test_vector, ElementsAreArray(a)); test_vector[2] = 0; @@ -448,20 +447,20 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithValueArray) { } TEST(ElementsAreArrayTest, CanBeCreatedWithArraySize) { - const char* a[] = { "one", "two", "three" }; + std::array<const char*, 3> a = {{"one", "two", "three"}}; - vector<std::string> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); - EXPECT_THAT(test_vector, ElementsAreArray(a, GTEST_ARRAY_SIZE_(a))); + vector<std::string> test_vector(std::begin(a), std::end(a)); + EXPECT_THAT(test_vector, ElementsAreArray(a.data(), a.size())); - const char** p = a; + const char** p = a.data(); test_vector[0] = "1"; - EXPECT_THAT(test_vector, Not(ElementsAreArray(p, GTEST_ARRAY_SIZE_(a)))); + EXPECT_THAT(test_vector, Not(ElementsAreArray(p, a.size()))); } TEST(ElementsAreArrayTest, CanBeCreatedWithoutArraySize) { const char* a[] = { "one", "two", "three" }; - vector<std::string> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); + vector<std::string> test_vector(std::begin(a), std::end(a)); EXPECT_THAT(test_vector, ElementsAreArray(a)); test_vector[0] = "1"; @@ -484,8 +483,8 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithMatcherArray) { TEST(ElementsAreArrayTest, CanBeCreatedWithVector) { const int a[] = { 1, 2, 3 }; - vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); - const vector<int> expected(a, a + GTEST_ARRAY_SIZE_(a)); + vector<int> test_vector(std::begin(a), std::end(a)); + const vector<int> expected(std::begin(a), std::end(a)); EXPECT_THAT(test_vector, ElementsAreArray(expected)); test_vector.push_back(4); EXPECT_THAT(test_vector, Not(ElementsAreArray(expected))); @@ -530,9 +529,9 @@ TEST(ElementsAreArrayTest, TEST(ElementsAreArrayTest, CanBeCreatedWithMatcherVector) { const int a[] = { 1, 2, 3 }; const Matcher<int> kMatchers[] = { Eq(1), Eq(2), Eq(3) }; - vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); - const vector<Matcher<int> > expected( - kMatchers, kMatchers + GTEST_ARRAY_SIZE_(kMatchers)); + vector<int> test_vector(std::begin(a), std::end(a)); + const vector<Matcher<int>> expected(std::begin(kMatchers), + std::end(kMatchers)); EXPECT_THAT(test_vector, ElementsAreArray(expected)); test_vector.push_back(4); EXPECT_THAT(test_vector, Not(ElementsAreArray(expected))); @@ -540,11 +539,11 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithMatcherVector) { TEST(ElementsAreArrayTest, CanBeCreatedWithIteratorRange) { const int a[] = { 1, 2, 3 }; - const vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); - const vector<int> expected(a, a + GTEST_ARRAY_SIZE_(a)); + const vector<int> test_vector(std::begin(a), std::end(a)); + const vector<int> expected(std::begin(a), std::end(a)); EXPECT_THAT(test_vector, ElementsAreArray(expected.begin(), expected.end())); // Pointers are iterators, too. - EXPECT_THAT(test_vector, ElementsAreArray(a, a + GTEST_ARRAY_SIZE_(a))); + EXPECT_THAT(test_vector, ElementsAreArray(std::begin(a), std::end(a))); // The empty range of NULL pointers should also be okay. int* const null_int = nullptr; EXPECT_THAT(test_vector, Not(ElementsAreArray(null_int, null_int))); @@ -564,8 +563,8 @@ TEST(ElementsAreArrayTest, WorksWithNativeArray) { TEST(ElementsAreArrayTest, SourceLifeSpan) { const int a[] = { 1, 2, 3 }; - vector<int> test_vector(a, a + GTEST_ARRAY_SIZE_(a)); - vector<int> expect(a, a + GTEST_ARRAY_SIZE_(a)); + vector<int> test_vector(std::begin(a), std::end(a)); + vector<int> expect(std::begin(a), std::end(a)); ElementsAreArrayMatcher<int> matcher_maker = ElementsAreArray(expect.begin(), expect.end()); EXPECT_THAT(test_vector, matcher_maker); diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc index 7df4078..19ba6fe 100644 --- a/googlemock/test/gmock-internal-utils_test.cc +++ b/googlemock/test/gmock-internal-utils_test.cc @@ -40,7 +40,6 @@ #include <memory> #include <sstream> #include <string> -#include <type_traits> #include <vector> #include "gmock/gmock.h" @@ -125,15 +124,17 @@ TEST(ConvertIdentifierNameToWordsTest, WorksWhenNameIsMixture) { } TEST(PointeeOfTest, WorksForSmartPointers) { - CompileAssertTypesEqual<int, PointeeOf<std::unique_ptr<int> >::type>(); - CompileAssertTypesEqual<std::string, - PointeeOf<std::shared_ptr<std::string> >::type>(); + EXPECT_TRUE( + (std::is_same<int, PointeeOf<std::unique_ptr<int>>::type>::value)); + EXPECT_TRUE( + (std::is_same<std::string, + PointeeOf<std::shared_ptr<std::string>>::type>::value)); } TEST(PointeeOfTest, WorksForRawPointers) { - CompileAssertTypesEqual<int, PointeeOf<int*>::type>(); - CompileAssertTypesEqual<const char, PointeeOf<const char*>::type>(); - CompileAssertTypesEqual<void, PointeeOf<void*>::type>(); + EXPECT_TRUE((std::is_same<int, PointeeOf<int*>::type>::value)); + EXPECT_TRUE((std::is_same<const char, PointeeOf<const char*>::type>::value)); + EXPECT_TRUE((std::is_void<PointeeOf<void*>::type>::value)); } TEST(GetRawPointerTest, WorksForSmartPointers) { @@ -664,63 +665,66 @@ TEST(StlContainerViewTest, WorksForDynamicNativeArray) { TEST(FunctionTest, Nullary) { typedef Function<int()> F; // NOLINT EXPECT_EQ(0u, F::ArgumentCount); - CompileAssertTypesEqual<int, F::Result>(); - CompileAssertTypesEqual<std::tuple<>, F::ArgumentTuple>(); - CompileAssertTypesEqual<std::tuple<>, F::ArgumentMatcherTuple>(); - CompileAssertTypesEqual<void(), F::MakeResultVoid>(); - CompileAssertTypesEqual<IgnoredValue(), F::MakeResultIgnoredValue>(); + EXPECT_TRUE((std::is_same<int, F::Result>::value)); + EXPECT_TRUE((std::is_same<std::tuple<>, F::ArgumentTuple>::value)); + EXPECT_TRUE((std::is_same<std::tuple<>, F::ArgumentMatcherTuple>::value)); + EXPECT_TRUE((std::is_same<void(), F::MakeResultVoid>::value)); + EXPECT_TRUE((std::is_same<IgnoredValue(), F::MakeResultIgnoredValue>::value)); } TEST(FunctionTest, Unary) { typedef Function<int(bool)> F; // NOLINT EXPECT_EQ(1u, F::ArgumentCount); - CompileAssertTypesEqual<int, F::Result>(); - CompileAssertTypesEqual<bool, F::Arg<0>::type>(); - CompileAssertTypesEqual<std::tuple<bool>, F::ArgumentTuple>(); - CompileAssertTypesEqual<std::tuple<Matcher<bool> >, - F::ArgumentMatcherTuple>(); - CompileAssertTypesEqual<void(bool), F::MakeResultVoid>(); // NOLINT - CompileAssertTypesEqual<IgnoredValue(bool), // NOLINT - F::MakeResultIgnoredValue>(); + EXPECT_TRUE((std::is_same<int, F::Result>::value)); + EXPECT_TRUE((std::is_same<bool, F::Arg<0>::type>::value)); + EXPECT_TRUE((std::is_same<std::tuple<bool>, F::ArgumentTuple>::value)); + EXPECT_TRUE(( + std::is_same<std::tuple<Matcher<bool>>, F::ArgumentMatcherTuple>::value)); + EXPECT_TRUE((std::is_same<void(bool), F::MakeResultVoid>::value)); // NOLINT + EXPECT_TRUE((std::is_same<IgnoredValue(bool), // NOLINT + F::MakeResultIgnoredValue>::value)); } TEST(FunctionTest, Binary) { typedef Function<int(bool, const long&)> F; // NOLINT EXPECT_EQ(2u, F::ArgumentCount); - CompileAssertTypesEqual<int, F::Result>(); - CompileAssertTypesEqual<bool, F::Arg<0>::type>(); - CompileAssertTypesEqual<const long&, F::Arg<1>::type>(); // NOLINT - CompileAssertTypesEqual<std::tuple<bool, const long&>, // NOLINT - F::ArgumentTuple>(); - CompileAssertTypesEqual< - std::tuple<Matcher<bool>, Matcher<const long&> >, // NOLINT - F::ArgumentMatcherTuple>(); - CompileAssertTypesEqual<void(bool, const long&), F::MakeResultVoid>(); // NOLINT - CompileAssertTypesEqual<IgnoredValue(bool, const long&), // NOLINT - F::MakeResultIgnoredValue>(); + EXPECT_TRUE((std::is_same<int, F::Result>::value)); + EXPECT_TRUE((std::is_same<bool, F::Arg<0>::type>::value)); + EXPECT_TRUE((std::is_same<const long&, F::Arg<1>::type>::value)); // NOLINT + EXPECT_TRUE((std::is_same<std::tuple<bool, const long&>, // NOLINT + F::ArgumentTuple>::value)); + EXPECT_TRUE( + (std::is_same<std::tuple<Matcher<bool>, Matcher<const long&>>, // NOLINT + F::ArgumentMatcherTuple>::value)); + EXPECT_TRUE((std::is_same<void(bool, const long&), // NOLINT + F::MakeResultVoid>::value)); + EXPECT_TRUE((std::is_same<IgnoredValue(bool, const long&), // NOLINT + F::MakeResultIgnoredValue>::value)); } TEST(FunctionTest, LongArgumentList) { typedef Function<char(bool, int, char*, int&, const long&)> F; // NOLINT EXPECT_EQ(5u, F::ArgumentCount); - CompileAssertTypesEqual<char, F::Result>(); - CompileAssertTypesEqual<bool, F::Arg<0>::type>(); - CompileAssertTypesEqual<int, F::Arg<1>::type>(); - CompileAssertTypesEqual<char*, F::Arg<2>::type>(); - CompileAssertTypesEqual<int&, F::Arg<3>::type>(); - CompileAssertTypesEqual<const long&, F::Arg<4>::type>(); // NOLINT - CompileAssertTypesEqual< - std::tuple<bool, int, char*, int&, const long&>, // NOLINT - F::ArgumentTuple>(); - CompileAssertTypesEqual< - std::tuple<Matcher<bool>, Matcher<int>, Matcher<char*>, Matcher<int&>, - Matcher<const long&> >, // NOLINT - F::ArgumentMatcherTuple>(); - CompileAssertTypesEqual<void(bool, int, char*, int&, const long&), // NOLINT - F::MakeResultVoid>(); - CompileAssertTypesEqual< - IgnoredValue(bool, int, char*, int&, const long&), // NOLINT - F::MakeResultIgnoredValue>(); + EXPECT_TRUE((std::is_same<char, F::Result>::value)); + EXPECT_TRUE((std::is_same<bool, F::Arg<0>::type>::value)); + EXPECT_TRUE((std::is_same<int, F::Arg<1>::type>::value)); + EXPECT_TRUE((std::is_same<char*, F::Arg<2>::type>::value)); + EXPECT_TRUE((std::is_same<int&, F::Arg<3>::type>::value)); + EXPECT_TRUE((std::is_same<const long&, F::Arg<4>::type>::value)); // NOLINT + EXPECT_TRUE( + (std::is_same<std::tuple<bool, int, char*, int&, const long&>, // NOLINT + F::ArgumentTuple>::value)); + EXPECT_TRUE( + (std::is_same< + std::tuple<Matcher<bool>, Matcher<int>, Matcher<char*>, Matcher<int&>, + Matcher<const long&>>, // NOLINT + F::ArgumentMatcherTuple>::value)); + EXPECT_TRUE( + (std::is_same<void(bool, int, char*, int&, const long&), // NOLINT + F::MakeResultVoid>::value)); + EXPECT_TRUE(( + std::is_same<IgnoredValue(bool, int, char*, int&, const long&), // NOLINT + F::MakeResultIgnoredValue>::value)); } } // namespace diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index a61d040..bc49cb6 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -41,10 +41,11 @@ #endif #include "gmock/gmock-matchers.h" -#include "gmock/gmock-more-matchers.h" #include <string.h> #include <time.h> + +#include <array> #include <deque> #include <forward_list> #include <functional> @@ -60,9 +61,11 @@ #include <type_traits> #include <utility> #include <vector> + +#include "gmock/gmock-more-matchers.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "gtest/gtest-spi.h" +#include "gtest/gtest.h" namespace testing { namespace gmock_matchers_test { @@ -956,10 +959,9 @@ TEST(TypedEqTest, CanDescribeSelf) { // Tests that TypedEq<T>(v) has type Matcher<T>. -// Type<T>::IsTypeOf(v) compiles if the type of value v is T, where T -// is a "bare" type (i.e. not in the form of const U or U&). If v's -// type is not T, the compiler will generate a message about -// "undefined reference". +// Type<T>::IsTypeOf(v) compiles if and only if the type of value v is T, where +// T is a "bare" type (i.e. not in the form of const U or U&). If v's type is +// not T, the compiler will generate a message about "undefined reference". template <typename T> struct Type { static bool IsTypeOf(const T& /* v */) { return true; } @@ -2055,6 +2057,114 @@ TEST(PairMatchBaseTest, WorksWithMoveOnly) { EXPECT_TRUE(matcher.Matches(pointers)); } +// Tests that IsNan() matches a NaN, with float. +TEST(IsNan, FloatMatchesNan) { + float quiet_nan = std::numeric_limits<float>::quiet_NaN(); + float other_nan = std::nanf("1"); + float real_value = 1.0f; + + Matcher<float> m = IsNan(); + EXPECT_TRUE(m.Matches(quiet_nan)); + EXPECT_TRUE(m.Matches(other_nan)); + EXPECT_FALSE(m.Matches(real_value)); + + Matcher<float&> m_ref = IsNan(); + EXPECT_TRUE(m_ref.Matches(quiet_nan)); + EXPECT_TRUE(m_ref.Matches(other_nan)); + EXPECT_FALSE(m_ref.Matches(real_value)); + + Matcher<const float&> m_cref = IsNan(); + EXPECT_TRUE(m_cref.Matches(quiet_nan)); + EXPECT_TRUE(m_cref.Matches(other_nan)); + EXPECT_FALSE(m_cref.Matches(real_value)); +} + +// Tests that IsNan() matches a NaN, with double. +TEST(IsNan, DoubleMatchesNan) { + double quiet_nan = std::numeric_limits<double>::quiet_NaN(); + double other_nan = std::nan("1"); + double real_value = 1.0; + + Matcher<double> m = IsNan(); + EXPECT_TRUE(m.Matches(quiet_nan)); + EXPECT_TRUE(m.Matches(other_nan)); + EXPECT_FALSE(m.Matches(real_value)); + + Matcher<double&> m_ref = IsNan(); + EXPECT_TRUE(m_ref.Matches(quiet_nan)); + EXPECT_TRUE(m_ref.Matches(other_nan)); + EXPECT_FALSE(m_ref.Matches(real_value)); + + Matcher<const double&> m_cref = IsNan(); + EXPECT_TRUE(m_cref.Matches(quiet_nan)); + EXPECT_TRUE(m_cref.Matches(other_nan)); + EXPECT_FALSE(m_cref.Matches(real_value)); +} + +// Tests that IsNan() matches a NaN, with long double. +TEST(IsNan, LongDoubleMatchesNan) { + long double quiet_nan = std::numeric_limits<long double>::quiet_NaN(); + long double other_nan = std::nan("1"); + long double real_value = 1.0; + + Matcher<long double> m = IsNan(); + EXPECT_TRUE(m.Matches(quiet_nan)); + EXPECT_TRUE(m.Matches(other_nan)); + EXPECT_FALSE(m.Matches(real_value)); + + Matcher<long double&> m_ref = IsNan(); + EXPECT_TRUE(m_ref.Matches(quiet_nan)); + EXPECT_TRUE(m_ref.Matches(other_nan)); + EXPECT_FALSE(m_ref.Matches(real_value)); + + Matcher<const long double&> m_cref = IsNan(); + EXPECT_TRUE(m_cref.Matches(quiet_nan)); + EXPECT_TRUE(m_cref.Matches(other_nan)); + EXPECT_FALSE(m_cref.Matches(real_value)); +} + +// Tests that IsNan() works with Not. +TEST(IsNan, NotMatchesNan) { + Matcher<float> mf = Not(IsNan()); + EXPECT_FALSE(mf.Matches(std::numeric_limits<float>::quiet_NaN())); + EXPECT_FALSE(mf.Matches(std::nanf("1"))); + EXPECT_TRUE(mf.Matches(1.0)); + + Matcher<double> md = Not(IsNan()); + EXPECT_FALSE(md.Matches(std::numeric_limits<double>::quiet_NaN())); + EXPECT_FALSE(md.Matches(std::nan("1"))); + EXPECT_TRUE(md.Matches(1.0)); + + Matcher<long double> mld = Not(IsNan()); + EXPECT_FALSE(mld.Matches(std::numeric_limits<long double>::quiet_NaN())); + EXPECT_FALSE(mld.Matches(std::nanl("1"))); + EXPECT_TRUE(mld.Matches(1.0)); +} + +// Tests that IsNan() can describe itself. +TEST(IsNan, CanDescribeSelf) { + Matcher<float> mf = IsNan(); + EXPECT_EQ("is NaN", Describe(mf)); + + Matcher<double> md = IsNan(); + EXPECT_EQ("is NaN", Describe(md)); + + Matcher<long double> mld = IsNan(); + EXPECT_EQ("is NaN", Describe(mld)); +} + +// Tests that IsNan() can describe itself with Not. +TEST(IsNan, CanDescribeSelfWithNot) { + Matcher<float> mf = Not(IsNan()); + EXPECT_EQ("isn't NaN", Describe(mf)); + + Matcher<double> md = Not(IsNan()); + EXPECT_EQ("isn't NaN", Describe(md)); + + Matcher<long double> mld = Not(IsNan()); + EXPECT_EQ("isn't NaN", Describe(mld)); +} + // Tests that FloatEq() matches a 2-tuple where // FloatEq(first field) matches the second field. TEST(FloatEq2Test, MatchesEqualArguments) { @@ -2640,8 +2750,8 @@ class IsGreaterThan { // For testing Truly(). const int foo = 0; -// This predicate returns true if the argument references foo and has -// a zero value. +// This predicate returns true if and only if the argument references foo and +// has a zero value. bool ReferencesFooAndIsZero(const int& n) { return (&n == &foo) && (n == 0); } @@ -3594,7 +3704,7 @@ class Uncopyable { GTEST_DISALLOW_COPY_AND_ASSIGN_(Uncopyable); }; -// Returns true if x.value() is positive. +// Returns true if and only if x.value() is positive. bool ValueIsPositive(const Uncopyable& x) { return x.value() > 0; } MATCHER_P(UncopyableIs, inner_matcher, "") { @@ -4319,6 +4429,16 @@ TEST(ResultOfTest, WorksForLambdas) { EXPECT_FALSE(matcher.Matches(1)); } +TEST(ResultOfTest, WorksForNonCopyableArguments) { + Matcher<std::unique_ptr<int>> matcher = ResultOf( + [](const std::unique_ptr<int>& str_len) { + return std::string(static_cast<size_t>(*str_len), 'x'); + }, + "xxx"); + EXPECT_TRUE(matcher.Matches(std::unique_ptr<int>(new int(3)))); + EXPECT_FALSE(matcher.Matches(std::unique_ptr<int>(new int(1)))); +} + const int* ReferencingFunction(const int& n) { return &n; } struct ReferencingFunctor { @@ -5084,14 +5204,14 @@ TEST(WhenSortedTest, WorksForStreamlike) { // Streamlike 'container' provides only minimal iterator support. // Its iterators are tagged with input_iterator_tag. const int a[5] = {2, 1, 4, 5, 3}; - Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + Streamlike<int> s(std::begin(a), std::end(a)); EXPECT_THAT(s, WhenSorted(ElementsAre(1, 2, 3, 4, 5))); EXPECT_THAT(s, Not(WhenSorted(ElementsAre(2, 1, 4, 5, 3)))); } TEST(WhenSortedTest, WorksForVectorConstRefMatcherOnStreamlike) { const int a[] = {2, 1, 4, 5, 3}; - Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + Streamlike<int> s(std::begin(a), std::end(a)); Matcher<const std::vector<int>&> vector_match = ElementsAre(1, 2, 3, 4, 5); EXPECT_THAT(s, WhenSorted(vector_match)); EXPECT_THAT(s, Not(WhenSorted(ElementsAre(2, 1, 4, 5, 3)))); @@ -5136,7 +5256,7 @@ TEST(IsSupersetOfTest, WorksForEmpty) { TEST(IsSupersetOfTest, WorksForStreamlike) { const int a[5] = {1, 2, 3, 4, 5}; - Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + Streamlike<int> s(std::begin(a), std::end(a)); vector<int> expected; expected.push_back(1); @@ -5264,7 +5384,7 @@ TEST(IsSubsetOfTest, WorksForEmpty) { TEST(IsSubsetOfTest, WorksForStreamlike) { const int a[5] = {1, 2}; - Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + Streamlike<int> s(std::begin(a), std::end(a)); vector<int> expected; expected.push_back(1); @@ -5358,14 +5478,14 @@ TEST(IsSubsetOfTest, WorksWithMoveOnly) { TEST(ElemensAreStreamTest, WorksForStreamlike) { const int a[5] = {1, 2, 3, 4, 5}; - Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + Streamlike<int> s(std::begin(a), std::end(a)); EXPECT_THAT(s, ElementsAre(1, 2, 3, 4, 5)); EXPECT_THAT(s, Not(ElementsAre(2, 1, 4, 5, 3))); } TEST(ElemensAreArrayStreamTest, WorksForStreamlike) { const int a[5] = {1, 2, 3, 4, 5}; - Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + Streamlike<int> s(std::begin(a), std::end(a)); vector<int> expected; expected.push_back(1); @@ -5412,7 +5532,7 @@ TEST(ElementsAreTest, TakesStlContainer) { TEST(UnorderedElementsAreArrayTest, SucceedsWhenExpected) { const int a[] = {0, 1, 2, 3, 4}; - std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + std::vector<int> s(std::begin(a), std::end(a)); do { StringMatchResultListener listener; EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAreArray(a), @@ -5423,8 +5543,8 @@ TEST(UnorderedElementsAreArrayTest, SucceedsWhenExpected) { TEST(UnorderedElementsAreArrayTest, VectorBool) { const bool a[] = {0, 1, 0, 1, 1}; const bool b[] = {1, 0, 1, 1, 0}; - std::vector<bool> expected(a, a + GTEST_ARRAY_SIZE_(a)); - std::vector<bool> actual(b, b + GTEST_ARRAY_SIZE_(b)); + std::vector<bool> expected(std::begin(a), std::end(a)); + std::vector<bool> actual(std::begin(b), std::end(b)); StringMatchResultListener listener; EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAreArray(expected), actual, &listener)) << listener.str(); @@ -5435,7 +5555,7 @@ TEST(UnorderedElementsAreArrayTest, WorksForStreamlike) { // Its iterators are tagged with input_iterator_tag, and it has no // size() or empty() methods. const int a[5] = {2, 1, 4, 5, 3}; - Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + Streamlike<int> s(std::begin(a), std::end(a)); ::std::vector<int> expected; expected.push_back(1); @@ -5518,7 +5638,7 @@ TEST_F(UnorderedElementsAreTest, WorksWithUncopyable) { TEST_F(UnorderedElementsAreTest, SucceedsWhenExpected) { const int a[] = {1, 2, 3}; - std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + std::vector<int> s(std::begin(a), std::end(a)); do { StringMatchResultListener listener; EXPECT_TRUE(ExplainMatchResult(UnorderedElementsAre(1, 2, 3), @@ -5528,7 +5648,7 @@ TEST_F(UnorderedElementsAreTest, SucceedsWhenExpected) { TEST_F(UnorderedElementsAreTest, FailsWhenAnElementMatchesNoMatcher) { const int a[] = {1, 2, 3}; - std::vector<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + std::vector<int> s(std::begin(a), std::end(a)); std::vector<Matcher<int> > mv; mv.push_back(1); mv.push_back(2); @@ -5544,7 +5664,7 @@ TEST_F(UnorderedElementsAreTest, WorksForStreamlike) { // Its iterators are tagged with input_iterator_tag, and it has no // size() or empty() methods. const int a[5] = {2, 1, 4, 5, 3}; - Streamlike<int> s(a, a + GTEST_ARRAY_SIZE_(a)); + Streamlike<int> s(std::begin(a), std::end(a)); EXPECT_THAT(s, UnorderedElementsAre(1, 2, 3, 4, 5)); EXPECT_THAT(s, Not(UnorderedElementsAre(2, 2, 3, 4, 5))); @@ -5860,8 +5980,9 @@ TEST_F(BipartiteNonSquareTest, SimpleBacktracking) { // :.......: // 0 1 2 MatchMatrix g(4, 3); - static const size_t kEdges[][2] = {{0, 2}, {1, 1}, {2, 1}, {3, 0}}; - for (size_t i = 0; i < GTEST_ARRAY_SIZE_(kEdges); ++i) { + constexpr std::array<std::array<size_t, 2>, 4> kEdges = { + {{{0, 2}}, {{1, 1}}, {{2, 1}}, {{3, 0}}}}; + for (size_t i = 0; i < kEdges.size(); ++i) { g.SetEdge(kEdges[i][0], kEdges[i][1], true); } EXPECT_THAT(FindBacktrackingMaxBPM(g), diff --git a/googlemock/test/gmock-more-actions_test.cc b/googlemock/test/gmock-more-actions_test.cc index b4e0fc3..97ec5cf 100644 --- a/googlemock/test/gmock-more-actions_test.cc +++ b/googlemock/test/gmock-more-actions_test.cc @@ -57,7 +57,6 @@ using testing::ReturnPointee; using testing::SaveArg; using testing::SaveArgPointee; using testing::SetArgReferee; -using testing::StaticAssertTypeEq; using testing::Unused; using testing::WithArg; using testing::WithoutArgs; diff --git a/googlemock/test/gmock-pp_test.cc b/googlemock/test/gmock-pp_test.cc index 7387d39..5d1566e 100644 --- a/googlemock/test/gmock-pp_test.cc +++ b/googlemock/test/gmock-pp_test.cc @@ -1,5 +1,10 @@ #include "gmock/internal/gmock-pp.h" +// Used to test MSVC treating __VA_ARGS__ with a comma in it as one value +#define GMOCK_TEST_REPLACE_comma_WITH_COMMA_I_comma , +#define GMOCK_TEST_REPLACE_comma_WITH_COMMA(x) \ + GMOCK_PP_CAT(GMOCK_TEST_REPLACE_comma_WITH_COMMA_I_, x) + // Static assertions. namespace testing { namespace internal { @@ -17,6 +22,11 @@ static_assert(GMOCK_PP_NARG(x, y, z, w) == 4, ""); static_assert(!GMOCK_PP_HAS_COMMA(), ""); static_assert(GMOCK_PP_HAS_COMMA(b, ), ""); static_assert(!GMOCK_PP_HAS_COMMA((, )), ""); +static_assert(GMOCK_PP_HAS_COMMA(GMOCK_TEST_REPLACE_comma_WITH_COMMA(comma)), + ""); +static_assert( + GMOCK_PP_HAS_COMMA(GMOCK_TEST_REPLACE_comma_WITH_COMMA(comma(unrelated))), + ""); static_assert(!GMOCK_PP_IS_EMPTY(, ), ""); static_assert(!GMOCK_PP_IS_EMPTY(a), ""); static_assert(!GMOCK_PP_IS_EMPTY(()), ""); diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index 95b4b8b..791a247 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -69,8 +69,8 @@ using testing::AtMost; using testing::Between; using testing::Cardinality; using testing::CardinalityInterface; -using testing::ContainsRegex; using testing::Const; +using testing::ContainsRegex; using testing::DoAll; using testing::DoDefault; using testing::Eq; @@ -1952,12 +1952,14 @@ TEST(DeletingMockEarlyTest, Failure2) { class EvenNumberCardinality : public CardinalityInterface { public: - // Returns true if call_count calls will satisfy this cardinality. + // Returns true if and only if call_count calls will satisfy this + // cardinality. bool IsSatisfiedByCallCount(int call_count) const override { return call_count % 2 == 0; } - // Returns true if call_count calls will saturate this cardinality. + // Returns true if and only if call_count calls will saturate this + // cardinality. bool IsSaturatedByCallCount(int /* call_count */) const override { return false; } diff --git a/googlemock/test/pump_test.py b/googlemock/test/pump_test.py new file mode 100755 index 0000000..eb5a131 --- /dev/null +++ b/googlemock/test/pump_test.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python +# +# Copyright 2010, 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. + +"""Tests for the Pump meta-programming tool.""" + +from google3.testing.pybase import googletest +import google3.third_party.googletest.googlemock.scripts.pump + +pump = google3.third_party.googletest.googlemock.scripts.pump +Convert = pump.ConvertFromPumpSource +StripMetaComments = pump.StripMetaComments + + +class PumpTest(googletest.TestCase): + + def testConvertsEmptyToEmpty(self): + self.assertEquals('', Convert('').strip()) + + def testConvertsPlainCodeToSame(self): + self.assertEquals('#include <stdio.h>\n', + Convert('#include <stdio.h>\n')) + + def testConvertsLongIWYUPragmaToSame(self): + long_line = '// IWYU pragma: private, include "' + (80*'a') + '.h"\n' + self.assertEquals(long_line, Convert(long_line)) + + def testConvertsIWYUPragmaWithLeadingSpaceToSame(self): + long_line = ' // IWYU pragma: private, include "' + (80*'a') + '.h"\n' + self.assertEquals(long_line, Convert(long_line)) + + def testConvertsIWYUPragmaWithSlashStarLeaderToSame(self): + long_line = '/* IWYU pragma: private, include "' + (80*'a') + '.h"\n' + self.assertEquals(long_line, Convert(long_line)) + + def testConvertsIWYUPragmaWithSlashStarAndSpacesToSame(self): + long_line = ' /* IWYU pragma: private, include "' + (80*'a') + '.h"\n' + self.assertEquals(long_line, Convert(long_line)) + + def testIgnoresMetaComment(self): + self.assertEquals('', + Convert('$$ This is a Pump meta comment.\n').strip()) + + def testSimpleVarDeclarationWorks(self): + self.assertEquals('3\n', + Convert('$var m = 3\n' + '$m\n')) + + def testVarDeclarationCanReferenceEarlierVar(self): + self.assertEquals('43 != 3;\n', + Convert('$var a = 42\n' + '$var b = a + 1\n' + '$var c = (b - a)*3\n' + '$b != $c;\n')) + + def testSimpleLoopWorks(self): + self.assertEquals('1, 2, 3, 4, 5\n', + Convert('$var n = 5\n' + '$range i 1..n\n' + '$for i, [[$i]]\n')) + + def testSimpleLoopWithCommentWorks(self): + self.assertEquals('1, 2, 3, 4, 5\n', + Convert('$var n = 5 $$ This is comment 1.\n' + '$range i 1..n $$ This is comment 2.\n' + '$for i, [[$i]]\n')) + + def testNonTrivialRangeExpressionsWork(self): + self.assertEquals('1, 2, 3, 4\n', + Convert('$var n = 5\n' + '$range i (n/n)..(n - 1)\n' + '$for i, [[$i]]\n')) + + def testLoopWithoutSeparatorWorks(self): + self.assertEquals('a + 1 + 2 + 3;\n', + Convert('$range i 1..3\n' + 'a$for i [[ + $i]];\n')) + + def testCanGenerateDollarSign(self): + self.assertEquals('$\n', Convert('$($)\n')) + + def testCanIterpolateExpressions(self): + self.assertEquals('a[2] = 3;\n', + Convert('$var i = 1\n' + 'a[$(i + 1)] = $(i*4 - 1);\n')) + + def testConditionalWithoutElseBranchWorks(self): + self.assertEquals('true\n', + Convert('$var n = 5\n' + '$if n > 0 [[true]]\n')) + + def testConditionalWithElseBranchWorks(self): + self.assertEquals('true -- really false\n', + Convert('$var n = 5\n' + '$if n > 0 [[true]]\n' + '$else [[false]] -- \n' + '$if n > 10 [[really true]]\n' + '$else [[really false]]\n')) + + def testConditionalWithCascadingElseBranchWorks(self): + self.assertEquals('a\n', + Convert('$var n = 5\n' + '$if n > 0 [[a]]\n' + '$elif n > 10 [[b]]\n' + '$else [[c]]\n')) + self.assertEquals('b\n', + Convert('$var n = 5\n' + '$if n > 10 [[a]]\n' + '$elif n > 0 [[b]]\n' + '$else [[c]]\n')) + self.assertEquals('c\n', + Convert('$var n = 5\n' + '$if n > 10 [[a]]\n' + '$elif n > 8 [[b]]\n' + '$else [[c]]\n')) + + def testNestedLexicalBlocksWork(self): + self.assertEquals('a = 5;\n', + Convert('$var n = 5\n' + 'a = [[$if n > 0 [[$n]]]];\n')) + + +class StripMetaCommentsTest(googletest.TestCase): + + def testReturnsSameStringIfItContainsNoComment(self): + self.assertEquals('', StripMetaComments('')) + self.assertEquals(' blah ', StripMetaComments(' blah ')) + self.assertEquals('A single $ is fine.', + StripMetaComments('A single $ is fine.')) + self.assertEquals('multiple\nlines', + StripMetaComments('multiple\nlines')) + + def testStripsSimpleComment(self): + self.assertEquals('yes\n', StripMetaComments('yes $$ or no?\n')) + + def testStripsSimpleCommentWithMissingNewline(self): + self.assertEquals('yes', StripMetaComments('yes $$ or no?')) + + def testStripsPureCommentLinesEntirely(self): + self.assertEquals('yes\n', + StripMetaComments('$$ a pure comment line.\n' + 'yes $$ or no?\n' + ' $$ another comment line.\n')) + + def testStripsCommentsFromMultiLineText(self): + self.assertEquals('multi-\n' + 'line\n' + 'text is fine.', + StripMetaComments('multi- $$ comment 1\n' + 'line\n' + 'text is fine. $$ comment 2')) + + +if __name__ == '__main__': + googletest.main() diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index db29294..4fd7b52 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -266,6 +266,7 @@ $env:Path = \"$project_bin;$env:Path\" cxx_executable(googletest-break-on-failure-unittest_ test gtest) py_test(googletest-break-on-failure-unittest) + py_test(gtest_skip_check_output_test) py_test(gtest_skip_environment_check_output_test) # Visual Studio .NET 2003 does not support STL with exceptions disabled. diff --git a/googletest/CONTRIBUTORS b/googletest/CONTRIBUTORS index feae2fc..1e4afe2 100644 --- a/googletest/CONTRIBUTORS +++ b/googletest/CONTRIBUTORS @@ -17,6 +17,7 @@ Jói Sigurðsson <joi@google.com> Keir Mierle <mierle@gmail.com> Keith Ray <keith.ray@gmail.com> Kenton Varda <kenton@google.com> +Krystian Kuzniarek <krystian.kuzniarek@gmail.com> Manuel Klimek <klimek@google.com> Markus Heule <markus.heule@gmail.com> Mika Raento <mikie@iki.fi> diff --git a/googletest/README.md b/googletest/README.md index 766ddc1..904048f 100644 --- a/googletest/README.md +++ b/googletest/README.md @@ -8,8 +8,8 @@ depends on which build system you use, and is usually straightforward. ### Build with CMake -Google Test comes with a CMake build script ( -[CMakeLists.txt](https://github.com/google/googletest/blob/master/CMakeLists.txt)) +Google Test comes with a CMake build script +([CMakeLists.txt](https://github.com/google/googletest/blob/master/CMakeLists.txt)) that can be used on a wide range of platforms ("C" stands for cross-platform.). If you don't have CMake installed already, you can download it for free from <http://www.cmake.org/>. diff --git a/googletest/cmake/gtest.pc.in b/googletest/cmake/gtest.pc.in index 9aae29e..e7967ad 100644 --- a/googletest/cmake/gtest.pc.in +++ b/googletest/cmake/gtest.pc.in @@ -1,6 +1,5 @@ -prefix=${pcfiledir}/../.. -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: gtest Description: GoogleTest (without main() function) diff --git a/googletest/cmake/gtest_main.pc.in b/googletest/cmake/gtest_main.pc.in index 915f297..fe25d9c 100644 --- a/googletest/cmake/gtest_main.pc.in +++ b/googletest/cmake/gtest_main.pc.in @@ -1,6 +1,5 @@ -prefix=${pcfiledir}/../.. -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: gtest_main Description: GoogleTest (with main() function) diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md index 51005e9..ce8644e 100644 --- a/googletest/docs/advanced.md +++ b/googletest/docs/advanced.md @@ -464,9 +464,10 @@ You can call the function to assert that types `T1` and `T2` are the same. The function does nothing if the assertion is satisfied. If the types are different, the function call will -fail to compile, and the compiler error message will likely (depending on the -compiler) show you the actual values of `T1` and `T2`. This is mainly useful -inside template code. +fail to compile, the compiler error message will say that +`T1 and T2 are not the same type` and most likely (depending on the compiler) +show you the actual values of `T1` and `T2`. This is mainly useful inside +template code. **Caveat**: When used inside a member function of a class template or a function template, `StaticAssertTypeEq<T1, T2>()` is effective only if the function is @@ -641,7 +642,7 @@ Fatal assertion | Nonfatal assertion where `statement` is a statement that is expected to cause the process to die, `predicate` is a function or function object that evaluates an integer exit -status, and `matcher` is either a GMock matcher matching a `const std::string&` +status, and `matcher` is either a gMock matcher matching a `const std::string&` or a (Perl) regular expression - either of which is matched against the stderr output of `statement`. For legacy reasons, a bare string (i.e. with no matcher) is interpreted as `ContainsRegex(str)`, **not** `Eq(str)`. Note that `statement` @@ -656,7 +657,7 @@ As usual, the `ASSERT` variants abort the current test function, while the > has called `exit()` or `_exit()` with a non-zero value, or it may be killed by > a signal. > -> This means that if `*statement*` terminates the process with a 0 exit code, it +> This means that if *`statement`* terminates the process with a 0 exit code, it > is *not* considered a crash by `EXPECT_DEATH`. Use `EXPECT_EXIT` instead if > this is the case, or if you want to restrict the exit code more precisely. @@ -686,7 +687,7 @@ Note that a death test only cares about three things: 2. (in the case of `ASSERT_EXIT` and `EXPECT_EXIT`) does the exit status satisfy `predicate`? Or (in the case of `ASSERT_DEATH` and `EXPECT_DEATH`) is the exit status non-zero? And -3. does the stderr output match `regex`? +3. does the stderr output match `matcher`? In particular, if `statement` generates an `ASSERT_*` or `EXPECT_*` failure, it will **not** cause the death test to fail, as googletest assertions don't abort @@ -917,6 +918,8 @@ the `SCOPED_TRACE` macro or the `ScopedTrace` utility: ```c++ SCOPED_TRACE(message); +``` +```c++ ScopedTrace trace("file_path", line_number, message); ``` @@ -1131,7 +1134,7 @@ will output XML like this: > * `RecordProperty()` is a static member of the `Test` class. Therefore it > needs to be prefixed with `::testing::Test::` if used outside of the > `TEST` body and the test fixture class. -> * `*key*` must be a valid XML attribute name, and cannot conflict with the +> * *`key`* must be a valid XML attribute name, and cannot conflict with the > ones already used by googletest (`name`, `status`, `time`, `classname`, > `type_param`, and `value_param`). > * Calling `RecordProperty()` outside of the lifespan of a test is allowed. @@ -1802,7 +1805,7 @@ For technical reasons, there are some caveats: ## Registering tests programmatically The `TEST` macros handle the vast majority of all use cases, but there are few -were runtime registration logic is required. For those cases, the framework +where runtime registration logic is required. For those cases, the framework provides the `::testing::RegisterTest` that allows callers to register arbitrary tests dynamically. @@ -1903,8 +1906,6 @@ To obtain a `TestInfo` object for the currently running test, call const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info(); - - printf("We are in test %s of test suite %s.\n", test_info->name(), test_info->test_suite_name()); diff --git a/googletest/docs/faq.md b/googletest/docs/faq.md index 960a827..05ecdd7 100644 --- a/googletest/docs/faq.md +++ b/googletest/docs/faq.md @@ -531,8 +531,8 @@ There are several good reasons: ## What can the statement argument in ASSERT_DEATH() be? -`ASSERT_DEATH(*statement*, *regex*)` (or any death assertion macro) can be used -wherever `*statement*` is valid. So basically `*statement*` can be any C++ +`ASSERT_DEATH(statement, matcher)` (or any death assertion macro) can be used +wherever *`statement`* is valid. So basically *`statement`* can be any C++ statement that makes sense in the current context. In particular, it can reference global and/or local variables, and can be: diff --git a/googletest/docs/pkgconfig.md b/googletest/docs/pkgconfig.md index 6dc0673..117166c 100644 --- a/googletest/docs/pkgconfig.md +++ b/googletest/docs/pkgconfig.md @@ -139,3 +139,81 @@ export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig ``` pkg-config will also try to look in `PKG_CONFIG_PATH` to find `gtest_main.pc`. + +### Using pkg-config in a cross-compilation setting + +Pkg-config can be used in a cross-compilation setting too. To do this, let's +assume the final prefix of the cross-compiled installation will be `/usr`, and +your sysroot is `/home/MYUSER/sysroot`. Configure and install GTest using + +``` +mkdir build && cmake -DCMAKE_INSTALL_PREFIX=/usr .. +``` + +Install into the sysroot using `DESTDIR`: + +``` +make -j install DESTDIR=/home/MYUSER/sysroot +``` + +Before we continue, it is recommended to **always** define the following two +variables for pkg-config in a cross-compilation setting: + +``` +export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=yes +export PKG_CONFIG_ALLOW_SYSTEM_LIBS=yes +``` + +otherwise `pkg-config` will filter `-I` and `-L` flags against standard prefixes +such as `/usr` (see https://bugs.freedesktop.org/show_bug.cgi?id=28264#c3 for +reasons why this stripping needs to occur usually). + +If you look at the generated pkg-config file, it will look something like + +``` +libdir=/usr/lib64 +includedir=/usr/include + +Name: gtest +Description: GoogleTest (without main() function) +Version: 1.10.0 +URL: https://github.com/google/googletest +Libs: -L${libdir} -lgtest -lpthread +Cflags: -I${includedir} -DGTEST_HAS_PTHREAD=1 -lpthread +``` + +Notice that the sysroot is not included in `libdir` and `includedir`! If you try +to run `pkg-config` with the correct +`PKG_CONFIG_LIBDIR=/home/MYUSER/sysroot/usr/lib64/pkgconfig` against this `.pc` +file, you will get + +``` +$ pkg-config --cflags gtest +-DGTEST_HAS_PTHREAD=1 -lpthread -I/usr/include +$ pkg-config --libs gtest +-L/usr/lib64 -lgtest -lpthread +``` + +which is obviously wrong and points to the `CBUILD` and not `CHOST` root. In +order to use this in a cross-compilation setting, we need to tell pkg-config to +inject the actual sysroot into `-I` and `-L` variables. Let us now tell +pkg-config about the actual sysroot + +``` +export PKG_CONFIG_DIR= +export PKG_CONFIG_SYSROOT_DIR=/home/MYUSER/sysroot +export PKG_CONFIG_LIBDIR=${PKG_CONFIG_SYSROOT_DIR}/usr/lib64/pkgconfig +``` + +and running `pkg-config` again we get + +``` +$ pkg-config --cflags gtest +-DGTEST_HAS_PTHREAD=1 -lpthread -I/home/MYUSER/sysroot/usr/include +$ pkg-config --libs gtest +-L/home/MYUSER/sysroot/usr/lib64 -lgtest -lpthread +``` + +which contains the correct sysroot now. For a more comprehensive guide to also +including `${CHOST}` in build system calls, see the excellent tutorial by Diego +Elio Pettenò: https://autotools.io/pkgconfig/cross-compiling.html diff --git a/googletest/docs/primer.md b/googletest/docs/primer.md index ae03105..63f0516 100644 --- a/googletest/docs/primer.md +++ b/googletest/docs/primer.md @@ -5,9 +5,9 @@ *googletest* helps you write better C++ tests. googletest is a testing framework developed by the Testing Technology team with -Google's specific requirements and constraints in mind. No matter whether you -work on Linux, Windows, or a Mac, if you write C++ code, googletest can help -you. And it supports *any* kind of tests, not just unit tests. +Google's specific requirements and constraints in mind. Whether you work on +Linux, Windows, or a Mac, if you write C++ code, googletest can help you. And it +supports *any* kind of tests, not just unit tests. So what makes a good test, and how does googletest fit in? We believe: @@ -21,7 +21,7 @@ So what makes a good test, and how does googletest fit in? We believe: easy to maintain. Such consistency is especially helpful when people switch projects and start to work on a new code base. 3. Tests should be *portable* and *reusable*. Google has a lot of code that is - platform-neutral, its tests should also be platform-neutral. googletest + platform-neutral; its tests should also be platform-neutral. googletest works on different OSes, with different compilers, with or without exceptions, so googletest tests can work with a variety of configurations. 4. When tests fail, they should provide as much *information* about the problem @@ -44,18 +44,17 @@ minutes to learn the basics and get started. So let's go! ## Beware of the nomenclature -_Note:_ There might be some confusion of idea due to different -definitions of the terms _Test_, _Test Case_ and _Test Suite_, so beware -of misunderstanding these. +_Note:_ There might be some confusion arising from different definitions of the +terms _Test_, _Test Case_ and _Test Suite_, so beware of misunderstanding these. Historically, googletest started to use the term _Test Case_ for grouping -related tests, whereas current publications including the International Software -Testing Qualifications Board ([ISTQB](http://www.istqb.org/)) and various -textbooks on Software Quality use the term _[Test Suite][istqb test suite]_ for -this. +related tests, whereas current publications, including International Software +Testing Qualifications Board ([ISTQB](http://www.istqb.org/)) materials and +various textbooks on software quality, use the term +_[Test Suite][istqb test suite]_ for this. -The related term _Test_, as it is used in the googletest, is corresponding to -the term _[Test Case][istqb test case]_ of ISTQB and others. +The related term _Test_, as it is used in googletest, corresponds to the term +_[Test Case][istqb test case]_ of ISTQB and others. The term _Test_ is commonly of broad enough sense, including ISTQB's definition of _Test Case_, so it's not much of a problem here. But the term _Test Case_ as @@ -120,7 +119,7 @@ Depending on the nature of the leak, it may or may not be worth fixing - so keep this in mind if you get a heap checker error in addition to assertion errors. To provide a custom failure message, simply stream it into the macro using the -`<<` operator, or a sequence of such operators. An example: +`<<` operator or a sequence of such operators. An example: ```c++ ASSERT_EQ(x.size(), y.size()) << "Vectors x and y are of unequal length"; @@ -166,16 +165,16 @@ Fatal assertion | Nonfatal assertion | Verifies Value arguments must be comparable by the assertion's comparison operator or you'll get a compiler error. We used to require the arguments to support the -`<<` operator for streaming to an `ostream`, but it's no longer necessary. If +`<<` operator for streaming to an `ostream`, but this is no longer necessary. If `<<` is supported, it will be called to print the arguments when the assertion fails; otherwise googletest will attempt to print them in the best way it can. -For more details and how to customize the printing of the arguments, see -[documentation](../../googlemock/docs/cook_book.md#teaching-gmock-how-to-print-your-values) +For more details and how to customize the printing of the arguments, see the +[documentation](../../googlemock/docs/cook_book.md#teaching-gmock-how-to-print-your-values). These assertions can work with a user-defined type, but only if you define the -corresponding comparison operator (e.g. `==`, `<`, etc). Since this is -discouraged by the Google [C++ Style -Guide](https://google.github.io/styleguide/cppguide.html#Operator_Overloading), +corresponding comparison operator (e.g., `==` or `<`). Since this is discouraged +by the Google +[C++ Style Guide](https://google.github.io/styleguide/cppguide.html#Operator_Overloading), you may need to use `ASSERT_TRUE()` or `EXPECT_TRUE()` to assert the equality of two objects of a user-defined type. @@ -185,8 +184,8 @@ values on failure. Arguments are always evaluated exactly once. Therefore, it's OK for the arguments to have side effects. However, as with any ordinary C/C++ function, -the arguments' evaluation order is undefined (i.e. the compiler is free to -choose any order) and your code should not depend on any particular argument +the arguments' evaluation order is undefined (i.e., the compiler is free to +choose any order), and your code should not depend on any particular argument evaluation order. `ASSERT_EQ()` does pointer equality on pointers. If used on two C strings, it @@ -199,7 +198,7 @@ objects, you should use `ASSERT_EQ`. When doing pointer comparisons use `*_EQ(ptr, nullptr)` and `*_NE(ptr, nullptr)` instead of `*_EQ(ptr, NULL)` and `*_NE(ptr, NULL)`. This is because `nullptr` is -typed while `NULL` is not. See [FAQ](faq.md) for more details. +typed, while `NULL` is not. See the [FAQ](faq.md) for more details. If you're working with floating point numbers, you may want to use the floating point variations of some of these macros in order to avoid problems caused by @@ -246,7 +245,7 @@ Advanced googletest Guide. To create a test: -1. Use the `TEST()` macro to define and name a test function, These are +1. Use the `TEST()` macro to define and name a test function. These are ordinary C++ functions that don't return a value. 2. In this function, along with any valid C++ statements you want to include, use the various googletest assertions to check values. @@ -263,7 +262,7 @@ TEST(TestSuiteName, TestName) { `TEST()` arguments go from general to specific. The *first* argument is the name of the test suite, and the *second* argument is the test's name within the test case. Both names must be valid C++ identifiers, and they should not contain -underscore (`_`). A test's *full name* consists of its containing test suite and +any underscores (`_`). A test's *full name* consists of its containing test suite and its individual name. Tests from different test suites can have the same individual name. @@ -290,7 +289,7 @@ TEST(FactorialTest, HandlesPositiveInput) { } ``` -googletest groups the test results by test suites, so logically-related tests +googletest groups the test results by test suites, so logically related tests should be in the same test suite; in other words, the first argument to their `TEST()` should be the same. In the above example, we have two tests, `HandlesZeroInput` and `HandlesPositiveInput`, that belong to the same test @@ -305,22 +304,22 @@ for ## Test Fixtures: Using the Same Data Configuration for Multiple Tests {#same-data-multiple-tests} If you find yourself writing two or more tests that operate on similar data, you -can use a *test fixture*. It allows you to reuse the same configuration of +can use a *test fixture*. This allows you to reuse the same configuration of objects for several different tests. To create a fixture: -1. Derive a class from `::testing::Test` . Start its body with `protected:` as +1. Derive a class from `::testing::Test` . Start its body with `protected:`, as we'll want to access fixture members from sub-classes. 2. Inside the class, declare any objects you plan to use. 3. If necessary, write a default constructor or `SetUp()` function to prepare the objects for each test. A common mistake is to spell `SetUp()` as **`Setup()`** with a small `u` - Use `override` in C++11 to make sure you - spelled it correctly + spelled it correctly. 4. If necessary, write a destructor or `TearDown()` function to release any resources you allocated in `SetUp()` . To learn when you should use the constructor/destructor and when you should use `SetUp()/TearDown()`, read - the [FAQ](faq.md). + the [FAQ](faq.md#CtorVsSetUp). 5. If needed, define subroutines for your tests to share. When using a fixture, use `TEST_F()` instead of `TEST()` as it allows you to @@ -344,9 +343,9 @@ Also, you must first define a test fixture class before using it in a `TEST_F()`, or you'll get the compiler error "`virtual outside class declaration`". -For each test defined with `TEST_F()` , googletest will create a *fresh* test -fixture at runtime, immediately initialize it via `SetUp()` , run the test, -clean up by calling `TearDown()` , and then delete the test fixture. Note that +For each test defined with `TEST_F()`, googletest will create a *fresh* test +fixture at runtime, immediately initialize it via `SetUp()`, run the test, +clean up by calling `TearDown()`, and then delete the test fixture. Note that different tests in the same test suite have different test fixture objects, and googletest always deletes a test fixture before it creates the next one. googletest does **not** reuse the same test fixture for multiple tests. Any @@ -424,9 +423,9 @@ would lead to a segfault when `n` is `NULL`. When these tests run, the following happens: -1. googletest constructs a `QueueTest` object (let's call it `t1` ). -2. `t1.SetUp()` initializes `t1` . -3. The first test ( `IsEmptyInitially` ) runs on `t1` . +1. googletest constructs a `QueueTest` object (let's call it `t1`). +2. `t1.SetUp()` initializes `t1`. +3. The first test (`IsEmptyInitially`) runs on `t1`. 4. `t1.TearDown()` cleans up after the test finishes. 5. `t1` is destructed. 6. The above steps are repeated on another `QueueTest` object, this time @@ -440,14 +439,14 @@ When these tests run, the following happens: unlike with many other C++ testing frameworks, you don't have to re-list all your defined tests in order to run them. -After defining your tests, you can run them with `RUN_ALL_TESTS()` , which +After defining your tests, you can run them with `RUN_ALL_TESTS()`, which returns `0` if all the tests are successful, or `1` otherwise. Note that -`RUN_ALL_TESTS()` runs *all tests* in your link unit -- they can be from +`RUN_ALL_TESTS()` runs *all tests* in your link unit--they can be from different test suites, or even different source files. When invoked, the `RUN_ALL_TESTS()` macro: -* Saves the state of all googletest flags +* Saves the state of all googletest flags. * Creates a test fixture object for the first test. @@ -459,7 +458,7 @@ When invoked, the `RUN_ALL_TESTS()` macro: * Deletes the fixture. -* Restores the state of all googletest flags +* Restores the state of all googletest flags. * Repeats the above steps for the next test, until all tests have run. @@ -472,29 +471,38 @@ If a fatal failure happens the subsequent steps will be skipped. > return the value of `RUN_ALL_TESTS()`. > > Also, you should call `RUN_ALL_TESTS()` only **once**. Calling it more than -> once conflicts with some advanced googletest features (e.g. thread-safe +> once conflicts with some advanced googletest features (e.g., thread-safe > [death tests](advanced.md#death-tests)) and thus is not supported. **Availability**: Linux, Windows, Mac. ## Writing the main() Function -Write your own main() function, which should return the value of -`RUN_ALL_TESTS()` +Most users should _not_ need to write their own `main` function and instead link +with `gtest_main` (as opposed to with `gtest`), which defines a suitable entry +point. See the end of this section for details. The remainder of this section +should only apply when you need to do something custom before the tests run that +cannot be expressed within the framework of fixtures and test suites. + +If you write your own `main` function, it should return the value of +`RUN_ALL_TESTS()`. You can start from this boilerplate: ```c++ #include "this/package/foo.h" + #include "gtest/gtest.h" +namespace my { +namespace project { namespace { // The fixture for testing class Foo. class FooTest : public ::testing::Test { protected: - // You can remove any or all of the following functions if its body - // is empty. + // You can remove any or all of the following functions if their bodies would + // be empty. FooTest() { // You can do set-up work for each test here. @@ -517,7 +525,8 @@ class FooTest : public ::testing::Test { // before the destructor). } - // Objects declared here can be used by all tests in the test suite for Foo. + // Class members declared here can be used by all tests in the test suite + // for Foo. }; // Tests that the Foo::Bar() method does Abc. @@ -534,6 +543,8 @@ TEST_F(FooTest, DoesXyz) { } } // namespace +} // namespace project +} // namespace my int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); @@ -544,16 +555,16 @@ int main(int argc, char **argv) { The `::testing::InitGoogleTest()` function parses the command line for googletest flags, and removes all recognized flags. This allows the user to control a test program's behavior via various flags, which we'll cover in -[AdvancedGuide](advanced.md). You **must** call this function before calling +the [AdvancedGuide](advanced.md). You **must** call this function before calling `RUN_ALL_TESTS()`, or the flags won't be properly initialized. On Windows, `InitGoogleTest()` also works with wide strings, so it can be used in programs compiled in `UNICODE` mode as well. -But maybe you think that writing all those main() functions is too much work? We -agree with you completely and that's why Google Test provides a basic +But maybe you think that writing all those `main` functions is too much work? We +agree with you completely, and that's why Google Test provides a basic implementation of main(). If it fits your needs, then just link your test with -gtest\_main library and you are good to go. +the `gtest_main` library and you are good to go. NOTE: `ParseGUnitFlags()` is deprecated in favor of `InitGoogleTest()`. diff --git a/googletest/include/gtest/gtest-death-test.h b/googletest/include/gtest/gtest-death-test.h index cec9629..dc878ff 100644 --- a/googletest/include/gtest/gtest-death-test.h +++ b/googletest/include/gtest/gtest-death-test.h @@ -276,20 +276,20 @@ class GTEST_API_ KilledBySignal { // This macro is used for implementing macros such as // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where // death tests are not supported. Those macros must compile on such systems -// if EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on -// systems that support death tests. This allows one to write such a macro -// on a system that does not support death tests and be sure that it will -// compile on a death-test supporting system. It is exposed publicly so that -// systems that have death-tests with stricter requirements than -// GTEST_HAS_DEATH_TEST can write their own equivalent of -// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED. +// if and only if EXPECT_DEATH and ASSERT_DEATH compile with the same parameters +// on systems that support death tests. This allows one to write such a macro on +// a system that does not support death tests and be sure that it will compile +// on a death-test supporting system. It is exposed publicly so that systems +// that have death-tests with stricter requirements than GTEST_HAS_DEATH_TEST +// can write their own equivalent of EXPECT_DEATH_IF_SUPPORTED and +// ASSERT_DEATH_IF_SUPPORTED. // // Parameters: // statement - A statement that a macro such as EXPECT_DEATH would test // for program termination. This macro has to make sure this // statement is compiled but not executed, to ensure that // EXPECT_DEATH_IF_SUPPORTED compiles with a certain -// parameter if EXPECT_DEATH compiles with it. +// parameter if and only if EXPECT_DEATH compiles with it. // regex - A regex that a macro such as EXPECT_DEATH would use to test // the output of statement. This parameter has to be // compiled but not evaluated by this macro, to ensure that diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index c10d650..d9b28e0 100644 --- a/googletest/include/gtest/gtest-matchers.h +++ b/googletest/include/gtest/gtest-matchers.h @@ -96,8 +96,8 @@ class MatchResultListener { // Returns the underlying ostream. ::std::ostream* stream() { return stream_; } - // Returns true if the listener is interested in an explanation of - // the match result. A matcher's MatchAndExplain() method can use + // Returns true if and only if the listener is interested in an explanation + // of the match result. A matcher's MatchAndExplain() method can use // this information to avoid generating the explanation when no one // intends to hear it. bool IsInterested() const { return stream_ != nullptr; } @@ -141,8 +141,8 @@ class MatcherDescriberInterface { template <typename T> class MatcherInterface : public MatcherDescriberInterface { public: - // Returns true if the matcher matches x; also explains the match - // result to 'listener' if necessary (see the next paragraph), in + // Returns true if and only if the matcher matches x; also explains the + // match result to 'listener' if necessary (see the next paragraph), in // the form of a non-restrictive relative clause ("which ...", // "whose ...", etc) that describes x. For example, the // MatchAndExplain() method of the Pointee(...) matcher should @@ -258,13 +258,13 @@ class StreamMatchResultListener : public MatchResultListener { template <typename T> class MatcherBase { public: - // Returns true if the matcher matches x; also explains the match - // result to 'listener'. + // Returns true if and only if the matcher matches x; also explains the + // match result to 'listener'. bool MatchAndExplain(const T& x, MatchResultListener* listener) const { return impl_->MatchAndExplain(x, listener); } - // Returns true if this matcher matches x. + // Returns true if and only if this matcher matches x. bool Matches(const T& x) const { DummyMatchResultListener dummy; return MatchAndExplain(x, &dummy); @@ -474,13 +474,13 @@ class PolymorphicMatcher { public: explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} - virtual void DescribeTo(::std::ostream* os) const { impl_.DescribeTo(os); } + void DescribeTo(::std::ostream* os) const override { impl_.DescribeTo(os); } - virtual void DescribeNegationTo(::std::ostream* os) const { + void DescribeNegationTo(::std::ostream* os) const override { impl_.DescribeNegationTo(os); } - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { + bool MatchAndExplain(T x, MatchResultListener* listener) const override { return impl_.MatchAndExplain(x, listener); } diff --git a/googletest/include/gtest/gtest-message.h b/googletest/include/gtest/gtest-message.h index 4a80e11..2189923 100644 --- a/googletest/include/gtest/gtest-message.h +++ b/googletest/include/gtest/gtest-message.h @@ -49,6 +49,7 @@ #include <limits> #include <memory> +#include <sstream> #include "gtest/internal/gtest-port.h" diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index c2e6eae..f61e3c5 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -58,7 +58,9 @@ class FooTest : public ::testing::TestWithParam<const char*> { // Then, use the TEST_P macro to define as many parameterized tests // for this fixture as you want. The _P suffix is for "parameterized" -// or "pattern", whichever you prefer to think. +// or "pattern", whichever you prefer to think. The arguments to the +// TEST_P macro are the test_suite_name and test_case (both which must be +// non-empty) that will form the test name. TEST_P(FooTest, DoesBlah) { // Inside a test, access the test parameter with the GetParam() method @@ -101,10 +103,10 @@ INSTANTIATE_TEST_SUITE_P(InstantiationName, // To distinguish different instances of the pattern, (yes, you // can instantiate it more than once) the first argument to the -// INSTANTIATE_TEST_SUITE_P macro is a prefix that will be added to the -// actual test suite name. Remember to pick unique prefixes for different -// instantiations. The tests from the instantiation above will have -// these names: +// INSTANTIATE_TEST_SUITE_P macro is a prefix (which must be non-empty) that +// will be added to the actual test suite name. Remember to pick unique prefixes +// for different instantiations. The tests from the instantiation above will +// have these names: // // * InstantiationName/FooTest.DoesBlah/0 for "meeny" // * InstantiationName/FooTest.DoesBlah/1 for "miny" @@ -412,18 +414,22 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) { } #define TEST_P(test_suite_name, test_name) \ + static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \ + "test_suite_name must not be empty"); \ + static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \ + "test_name must not be empty"); \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ : public test_suite_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ - virtual void TestBody(); \ + void TestBody() override; \ \ private: \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance() \ ->parameterized_test_registry() \ .GetTestSuitePatternHolder<test_suite_name>( \ - #test_suite_name, \ + GTEST_STRINGIFY_(test_suite_name), \ ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ ->AddTestPattern( \ GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \ @@ -458,6 +464,10 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) { #define GTEST_GET_SECOND_(first, second, ...) second #define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ + static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \ + "test_suite_name must not be empty"); \ + static_assert(sizeof(GTEST_STRINGIFY_(prefix)) > 1, \ + "prefix must not be empty"); \ static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \ gtest_##prefix##test_suite_name##_EvalGenerator_() { \ return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \ @@ -483,10 +493,11 @@ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) { ::testing::UnitTest::GetInstance() \ ->parameterized_test_registry() \ .GetTestSuitePatternHolder<test_suite_name>( \ - #test_suite_name, \ + GTEST_STRINGIFY_(test_suite_name), \ ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ ->AddTestSuiteInstantiation( \ - #prefix, >est_##prefix##test_suite_name##_EvalGenerator_, \ + GTEST_STRINGIFY_(prefix), \ + >est_##prefix##test_suite_name##_EvalGenerator_, \ >est_##prefix##test_suite_name##_EvalGenerateName_, \ __FILE__, __LINE__) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 74fc54b..808d319 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -231,19 +231,18 @@ class TypeWithoutFormatter<T, kConvertibleToStringView> { template <typename Char, typename CharTraits, typename T> ::std::basic_ostream<Char, CharTraits>& operator<<( ::std::basic_ostream<Char, CharTraits>& os, const T& x) { - TypeWithoutFormatter<T, (internal::IsAProtocolMessage<T>::value - ? kProtobuf - : std::is_convertible< - const T&, std::intmax_t>::value - ? kConvertibleToInteger - : + TypeWithoutFormatter< + T, (internal::IsAProtocolMessage<T>::value + ? kProtobuf + : std::is_convertible<const T&, std::intmax_t>::value + ? kConvertibleToInteger + : #if GTEST_HAS_ABSL - std::is_convertible< - const T&, absl::string_view>::value - ? kConvertibleToStringView - : + std::is_convertible<const T&, absl::string_view>::value + ? kConvertibleToStringView + : #endif - kOtherType)>::PrintValue(x, &os); + kOtherType)>::PrintValue(x, &os); return os; } diff --git a/googletest/include/gtest/gtest-test-part.h b/googletest/include/gtest/gtest-test-part.h index 4f189b6..05a7985 100644 --- a/googletest/include/gtest/gtest-test-part.h +++ b/googletest/include/gtest/gtest-test-part.h @@ -87,19 +87,19 @@ class GTEST_API_ TestPartResult { // Gets the message associated with the test part. const char* message() const { return message_.c_str(); } - // Returns true if the test part was skipped. + // Returns true if and only if the test part was skipped. bool skipped() const { return type_ == kSkip; } - // Returns true if the test part passed. + // Returns true if and only if the test part passed. bool passed() const { return type_ == kSuccess; } - // Returns true if the test part non-fatally failed. + // Returns true if and only if the test part non-fatally failed. bool nonfatally_failed() const { return type_ == kNonFatalFailure; } - // Returns true if the test part fatally failed. + // Returns true if and only if the test part fatally failed. bool fatally_failed() const { return type_ == kFatalFailure; } - // Returns true if the test part failed. + // Returns true if and only if the test part failed. bool failed() const { return fatally_failed() || nonfatally_failed(); } private: diff --git a/googletest/include/gtest/gtest-typed-test.h b/googletest/include/gtest/gtest-typed-test.h index 095ce05..151fc8f 100644 --- a/googletest/include/gtest/gtest-typed-test.h +++ b/googletest/include/gtest/gtest-typed-test.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // GOOGLETEST_CM0001 DO NOT DELETE #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ @@ -188,24 +187,23 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); #define GTEST_NAME_GENERATOR_(TestSuiteName) \ gtest_type_params_##TestSuiteName##_NameGenerator -#define TYPED_TEST_SUITE(CaseName, Types, ...) \ - typedef ::testing::internal::TypeList<Types>::type GTEST_TYPE_PARAMS_( \ - CaseName); \ - typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \ +#define TYPED_TEST_SUITE(CaseName, Types, ...) \ + typedef ::testing::internal::GenerateTypeList<Types>::type \ + GTEST_TYPE_PARAMS_(CaseName); \ + typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \ GTEST_NAME_GENERATOR_(CaseName) -# define TYPED_TEST(CaseName, TestName) \ +#define TYPED_TEST(CaseName, TestName) \ template <typename gtest_TypeParam_> \ class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \ : public CaseName<gtest_TypeParam_> { \ private: \ typedef CaseName<gtest_TypeParam_> TestFixture; \ typedef gtest_TypeParam_ TypeParam; \ - virtual void TestBody(); \ + void TestBody() override; \ }; \ static bool gtest_##CaseName##_##TestName##_registered_ \ - GTEST_ATTRIBUTE_UNUSED_ = \ - ::testing::internal::TypeParameterizedTest< \ + GTEST_ATTRIBUTE_UNUSED_ = ::testing::internal::TypeParameterizedTest< \ CaseName, \ ::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \ TestName)>, \ @@ -276,7 +274,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); private: \ typedef SuiteName<gtest_TypeParam_> TestFixture; \ typedef gtest_TypeParam_ TypeParam; \ - virtual void TestBody(); \ + void TestBody() override; \ }; \ static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \ GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \ @@ -286,13 +284,13 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); void GTEST_SUITE_NAMESPACE_( \ SuiteName)::TestName<gtest_TypeParam_>::TestBody() -#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \ - namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ - typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \ - } \ - static const char* const GTEST_REGISTERED_TEST_NAMES_( \ - SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \ - GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \ +#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \ + namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ + typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \ + } \ + static const char* const GTEST_REGISTERED_TEST_NAMES_( \ + SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \ + GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \ __FILE__, __LINE__, #__VA_ARGS__) // Legacy API is deprecated but still available @@ -307,7 +305,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::internal::TypeParameterizedTestSuite< \ SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \ - ::testing::internal::TypeList<Types>::type>:: \ + ::testing::internal::GenerateTypeList<Types>::type>:: \ Register(#Prefix, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), \ >EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), #SuiteName, \ @@ -315,7 +313,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); ::testing::internal::GenerateNames< \ ::testing::internal::NameGeneratorSelector< \ __VA_ARGS__>::type, \ - ::testing::internal::TypeList<Types>::type>()) + ::testing::internal::GenerateTypeList<Types>::type>()) // Legacy API is deprecated but still available #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index 6c38043..0e1c4f7 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -308,7 +308,7 @@ class GTEST_API_ AssertionResult { return *this; } - // Returns true if the assertion succeeded. + // Returns true if and only if the assertion succeeded. operator bool() const { return success_; } // NOLINT // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE. @@ -432,16 +432,16 @@ class GTEST_API_ Test { static void SetUpTestCase() {} #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - // Returns true if the current test has a fatal failure. + // Returns true if and only if the current test has a fatal failure. static bool HasFatalFailure(); - // Returns true if the current test has a non-fatal failure. + // Returns true if and only if the current test has a non-fatal failure. static bool HasNonfatalFailure(); - // Returns true if the current test was skipped. + // Returns true if and only if the current test was skipped. static bool IsSkipped(); - // Returns true if the current test has a (either fatal or + // Returns true if and only if the current test has a (either fatal or // non-fatal) failure. static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); } @@ -472,8 +472,8 @@ class GTEST_API_ Test { virtual void TearDown(); private: - // Returns true if the current test has the same fixture class as - // the first test in the current test suite. + // Returns true if and only if the current test has the same fixture class + // as the first test in the current test suite. static bool HasSameFixtureClass(); // Runs the test after the test fixture has been set up. @@ -574,19 +574,19 @@ class GTEST_API_ TestResult { // Returns the number of the test properties. int test_property_count() const; - // Returns true if the test passed (i.e. no test part failed). + // Returns true if and only if the test passed (i.e. no test part failed). bool Passed() const { return !Skipped() && !Failed(); } - // Returns true if the test was skipped. + // Returns true if and only if the test was skipped. bool Skipped() const; - // Returns true if the test failed. + // Returns true if and only if the test failed. bool Failed() const; - // Returns true if the test fatally failed. + // Returns true if and only if the test fatally failed. bool HasFatalFailure() const; - // Returns true if the test has a non-fatal failure. + // Returns true if and only if the test has a non-fatal failure. bool HasNonfatalFailure() const; // Returns the elapsed time, in milliseconds. @@ -750,7 +750,7 @@ class GTEST_API_ TestInfo { // contains the character 'A' or starts with "Foo.". bool should_run() const { return should_run_; } - // Returns true if this test will appear in the XML report. + // Returns true if and only if this test will appear in the XML report. bool is_reportable() const { // The XML report includes tests matching the filter, excluding those // run in other shards. @@ -808,12 +808,12 @@ class GTEST_API_ TestInfo { // value-parameterized test. const std::unique_ptr<const ::std::string> value_param_; internal::CodeLocation location_; - const internal::TypeId fixture_class_id_; // ID of the test fixture class - bool should_run_; // True if this test should run - bool is_disabled_; // True if this test is disabled - bool matches_filter_; // True if this test matches the - // user-specified filter. - bool is_in_another_shard_; // Will be run in another shard. + const internal::TypeId fixture_class_id_; // ID of the test fixture class + bool should_run_; // True if and only if this test should run + bool is_disabled_; // True if and only if this test is disabled + bool matches_filter_; // True if this test matches the + // user-specified filter. + bool is_in_another_shard_; // Will be run in another shard. internal::TestFactoryBase* const factory_; // The factory that creates // the test object @@ -885,10 +885,10 @@ class GTEST_API_ TestSuite { // Gets the number of all tests in this test suite. int total_test_count() const; - // Returns true if the test suite passed. + // Returns true if and only if the test suite passed. bool Passed() const { return !Failed(); } - // Returns true if the test suite failed. + // Returns true if and only if the test suite failed. bool Failed() const { return failed_test_count() > 0; } // Returns the elapsed time, in milliseconds. @@ -956,33 +956,33 @@ class GTEST_API_ TestSuite { } } - // Returns true if test passed. + // Returns true if and only if test passed. static bool TestPassed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Passed(); } - // Returns true if test skipped. + // Returns true if and only if test skipped. static bool TestSkipped(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Skipped(); } - // Returns true if test failed. + // Returns true if and only if test failed. static bool TestFailed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Failed(); } - // Returns true if the test is disabled and will be reported in the XML - // report. + // Returns true if and only if the test is disabled and will be reported in + // the XML report. static bool TestReportableDisabled(const TestInfo* test_info) { return test_info->is_reportable() && test_info->is_disabled_; } - // Returns true if test is disabled. + // Returns true if and only if test is disabled. static bool TestDisabled(const TestInfo* test_info) { return test_info->is_disabled_; } - // Returns true if this test will appear in the XML report. + // Returns true if and only if this test will appear in the XML report. static bool TestReportable(const TestInfo* test_info) { return test_info->is_reportable(); } @@ -1014,7 +1014,7 @@ class GTEST_API_ TestSuite { internal::SetUpTestSuiteFunc set_up_tc_; // Pointer to the function that tears down the test suite. internal::TearDownTestSuiteFunc tear_down_tc_; - // True if any test in this test suite should run. + // True if and only if any test in this test suite should run. bool should_run_; // The start time, in milliseconds since UNIX Epoch. TimeInMillis start_timestamp_; @@ -1349,11 +1349,12 @@ class GTEST_API_ UnitTest { // Gets the elapsed time, in milliseconds. TimeInMillis elapsed_time() const; - // Returns true if the unit test passed (i.e. all test suites passed). + // Returns true if and only if the unit test passed (i.e. all test suites + // passed). bool Passed() const; - // Returns true if the unit test failed (i.e. some test suite failed - // or something outside of all tests failed). + // Returns true if and only if the unit test failed (i.e. some test suite + // failed or something outside of all tests failed). bool Failed() const; // Gets the i-th test suite among all the test suites. i can range from 0 to @@ -1534,8 +1535,7 @@ AssertionResult CmpHelperEQ(const char* lhs_expression, // {ASSERT|EXPECT}_EQ as anonymous enums can be implicitly cast to integers. GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression, const char* rhs_expression, - std::intmax_t lhs, - std::intmax_t rhs); + std::intmax_t lhs, std::intmax_t rhs); class EqHelper { public: @@ -1558,8 +1558,7 @@ class EqHelper { // Even though its body looks the same as the above version, we // cannot merge the two, as it will make anonymous enums unhappy. static AssertionResult Compare(const char* lhs_expression, - const char* rhs_expression, - std::intmax_t lhs, + const char* rhs_expression, std::intmax_t lhs, std::intmax_t rhs) { return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); } @@ -1598,18 +1597,19 @@ AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2, // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -#define GTEST_IMPL_CMP_HELPER_(op_name, op)\ -template <typename T1, typename T2>\ -AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ - const T1& val1, const T2& val2) {\ - if (val1 op val2) {\ - return AssertionSuccess();\ - } else {\ - return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\ - }\ -}\ -GTEST_API_ AssertionResult CmpHelper##op_name(\ - const char* expr1, const char* expr2, std::intmax_t val1, std::intmax_t val2) +#define GTEST_IMPL_CMP_HELPER_(op_name, op) \ + template <typename T1, typename T2> \ + AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ + const T1& val1, const T2& val2) { \ + if (val1 op val2) { \ + return AssertionSuccess(); \ + } else { \ + return CmpHelperOpFailure(expr1, expr2, val1, val2, #op); \ + } \ + } \ + GTEST_API_ AssertionResult CmpHelper##op_name( \ + const char* expr1, const char* expr2, std::intmax_t val1, \ + std::intmax_t val2) // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. @@ -1885,7 +1885,7 @@ class TestWithParam : public Test, public WithParamInterface<T> { // Skips test in runtime. // Skipping test aborts current function. // Skipped tests are neither successful nor failed. -#define GTEST_SKIP() GTEST_SKIP_("Skipped") +#define GTEST_SKIP() GTEST_SKIP_("") // ADD_FAILURE unconditionally adds a failure to the current test. // SUCCEED generates a success - it doesn't automatically make the @@ -2262,10 +2262,9 @@ class GTEST_API_ ScopedTrace { ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\ __FILE__, __LINE__, (message)) - // Compile-time assertion for type equality. -// StaticAssertTypeEq<type1, type2>() compiles if type1 and type2 are -// the same type. The value it returns is not interesting. +// StaticAssertTypeEq<type1, type2>() compiles if and only if type1 and type2 +// are the same type. The value it returns is not interesting. // // Instead of making StaticAssertTypeEq a class template, we make it a // function template that invokes a helper class template. This @@ -2294,8 +2293,8 @@ class GTEST_API_ ScopedTrace { // // to cause a compiler error. template <typename T1, typename T2> -bool StaticAssertTypeEq() { - (void)internal::StaticAssertTypeEqHelper<T1, T2>(); +constexpr bool StaticAssertTypeEq() noexcept { + static_assert(std::is_same<T1, T2>::value, "T1 and T2 are not the same type"); return true; } diff --git a/googletest/include/gtest/internal/gtest-filepath.h b/googletest/include/gtest/internal/gtest-filepath.h index 5d21bbc..c11b101 100644 --- a/googletest/include/gtest/internal/gtest-filepath.h +++ b/googletest/include/gtest/internal/gtest-filepath.h @@ -110,7 +110,7 @@ class GTEST_API_ FilePath { const FilePath& base_name, const char* extension); - // Returns true if the path is "". + // Returns true if and only if the path is "". bool IsEmpty() const { return pathname_.empty(); } // If input name has a trailing separator character, removes it and returns diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 3a98ce4..edf0afa 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -189,7 +189,7 @@ GTEST_API_ std::string DiffStrings(const std::string& left, // expected_value: "5" // actual_value: "6" // -// The ignoring_case parameter is true if the assertion is a +// The ignoring_case parameter is true if and only if the assertion is a // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will // be inserted into the message. GTEST_API_ AssertionResult EqFailure(const char* expected_expression, @@ -318,15 +318,15 @@ class FloatingPoint { // Returns the sign bit of this number. Bits sign_bit() const { return kSignBitMask & u_.bits_; } - // Returns true if this is NAN (not a number). + // Returns true if and only if this is NAN (not a number). bool is_nan() const { // It's a NAN if the exponent bits are all ones and the fraction // bits are not entirely zeros. return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0); } - // Returns true if this number is at most kMaxUlps ULP's away from - // rhs. In particular, this function: + // Returns true if and only if this number is at most kMaxUlps ULP's away + // from rhs. In particular, this function: // // - returns false if either number is (or both are) NAN. // - treats really large numbers as almost equal to infinity. @@ -662,7 +662,7 @@ struct NameGeneratorSelector { }; template <typename NameGenerator> -void GenerateNamesRecursively(Types0, std::vector<std::string>*, int) {} +void GenerateNamesRecursively(internal::None, std::vector<std::string>*, int) {} template <typename NameGenerator, typename Types> void GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) { @@ -729,7 +729,7 @@ class TypeParameterizedTest { // The base case for the compile time recursion. template <GTEST_TEMPLATE_ Fixture, class TestSel> -class TypeParameterizedTest<Fixture, TestSel, Types0> { +class TypeParameterizedTest<Fixture, TestSel, internal::None> { public: static bool Register(const char* /*prefix*/, const CodeLocation&, const char* /*case_name*/, const char* /*test_names*/, @@ -781,7 +781,7 @@ class TypeParameterizedTestSuite { // The base case for the compile time recursion. template <GTEST_TEMPLATE_ Fixture, typename Types> -class TypeParameterizedTestSuite<Fixture, Templates0, Types> { +class TypeParameterizedTestSuite<Fixture, internal::None, Types> { public: static bool Register(const char* /*prefix*/, const CodeLocation&, const TypedTestSuitePState* /*state*/, @@ -847,25 +847,15 @@ class GTEST_API_ Random { GTEST_DISALLOW_COPY_AND_ASSIGN_(Random); }; -// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a -// compiler error if T1 and T2 are different types. -template <typename T1, typename T2> -struct CompileAssertTypesEqual; - -template <typename T> -struct CompileAssertTypesEqual<T, T> { -}; - // Turns const U&, U&, const U, and U all into U. #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \ typename std::remove_const<typename std::remove_reference<T>::type>::type // IsAProtocolMessage<T>::value is a compile-time bool constant that's -// true if T is type proto2::Message or a subclass of it. +// true if and only if T is type proto2::Message or a subclass of it. template <typename T> struct IsAProtocolMessage - : public bool_constant< - std::is_convertible<const T*, const ::proto2::Message*>::value> {}; + : public std::is_convertible<const T*, const ::proto2::Message*> {}; // When the compiler sees expression IsContainerTest<C>(0), if C is an // STL-style container class, the first overload of IsContainerTest @@ -1078,10 +1068,9 @@ class NativeArray { } private: - enum { - kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper< - Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value - }; + static_assert(!std::is_const<Element>::value, "Type must not be const"); + static_assert(!std::is_reference<Element>::value, + "Type must not be a reference"); // Initializes this object with a copy of the input. void InitCopy(const Element* array, size_t a_size) { @@ -1134,25 +1123,29 @@ struct MakeIndexSequence template <> struct MakeIndexSequence<0> : IndexSequence<> {}; -// FIXME: This implementation of ElemFromList is O(1) in instantiation depth, -// but it is O(N^2) in total instantiations. Not sure if this is the best -// tradeoff, as it will make it somewhat slow to compile. -template <typename T, size_t, size_t> -struct ElemFromListImpl {}; - -template <typename T, size_t I> -struct ElemFromListImpl<T, I, I> { - using type = T; +template <size_t> +struct Ignore { + Ignore(...); // NOLINT }; -// Get the Nth element from T... -// It uses O(1) instantiation depth. -template <size_t N, typename I, typename... T> -struct ElemFromList; +template <typename> +struct ElemFromListImpl; +template <size_t... I> +struct ElemFromListImpl<IndexSequence<I...>> { + // We make Ignore a template to solve a problem with MSVC. + // A non-template Ignore would work fine with `decltype(Ignore(I))...`, but + // MSVC doesn't understand how to deal with that pack expansion. + // Use `0 * I` to have a single instantiation of Ignore. + template <typename R> + static R Apply(Ignore<0 * I>..., R (*)(), ...); +}; -template <size_t N, size_t... I, typename... T> -struct ElemFromList<N, IndexSequence<I...>, T...> - : ElemFromListImpl<T, N, I>... {}; +template <size_t N, typename... T> +struct ElemFromList { + using type = + decltype(ElemFromListImpl<typename MakeIndexSequence<N>::type>::Apply( + static_cast<T (*)()>(nullptr)...)); +}; template <typename... T> class FlatTuple; @@ -1162,9 +1155,7 @@ struct FlatTupleElemBase; template <typename... T, size_t I> struct FlatTupleElemBase<FlatTuple<T...>, I> { - using value_type = - typename ElemFromList<I, typename MakeIndexSequence<sizeof...(T)>::type, - T...>::type; + using value_type = typename ElemFromList<I, T...>::type; FlatTupleElemBase() = default; explicit FlatTupleElemBase(value_type t) : value(std::move(t)) {} value_type value; @@ -1202,12 +1193,12 @@ class FlatTuple explicit FlatTuple(T... t) : FlatTuple::FlatTupleBase(std::move(t)...) {} template <size_t I> - const typename ElemFromList<I, Indices, T...>::type& Get() const { + const typename ElemFromList<I, T...>::type& Get() const { return static_cast<const FlatTupleElemBase<FlatTuple, I>*>(this)->value; } template <size_t I> - typename ElemFromList<I, Indices, T...>::type& Get() { + typename ElemFromList<I, T...>::type& Get() { return static_cast<FlatTupleElemBase<FlatTuple, I>*>(this)->value; } }; @@ -1358,13 +1349,17 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; } // Helper macro for defining tests. #define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \ + static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \ + "test_suite_name must not be empty"); \ + static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \ + "test_name must not be empty"); \ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ : public parent_class { \ public: \ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ \ private: \ - virtual void TestBody(); \ + void TestBody() override; \ static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ test_name)); \ diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h index 9753399..e900b3f 100644 --- a/googletest/include/gtest/internal/gtest-param-util.h +++ b/googletest/include/gtest/internal/gtest-param-util.h @@ -565,10 +565,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { test_param_names.insert(param_name); - if (!test_info->test_base_name.empty()) { - test_name_stream << test_info->test_base_name << "/"; - } - test_name_stream << param_name; + test_name_stream << test_info->test_base_name << "/" << param_name; MakeAndRegisterTestInfo( test_suite_name.c_str(), test_name_stream.GetString().c_str(), nullptr, // No type parameter. diff --git a/googletest/include/gtest/internal/gtest-port-arch.h b/googletest/include/gtest/internal/gtest-port-arch.h index cece93d..d3239b2 100644 --- a/googletest/include/gtest/internal/gtest-port-arch.h +++ b/googletest/include/gtest/internal/gtest-port-arch.h @@ -102,6 +102,10 @@ # define GTEST_OS_QNX 1 #elif defined(__HAIKU__) #define GTEST_OS_HAIKU 1 +#elif defined ESP8266 +#define GTEST_OS_ESP8266 1 +#elif defined ESP32 +#define GTEST_OS_ESP32 1 #endif // __CYGWIN__ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index daa8151..6bb8f51 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -247,7 +247,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <memory> #include <type_traits> #ifndef _WIN32_WCE @@ -260,16 +259,14 @@ # include <TargetConditionals.h> #endif -#include <algorithm> // NOLINT -#include <iostream> // NOLINT -#include <sstream> // NOLINT -#include <string> // NOLINT +#include <iostream> // NOLINT +#include <memory> +#include <string> // NOLINT #include <tuple> -#include <utility> #include <vector> // NOLINT -#include "gtest/internal/gtest-port-arch.h" #include "gtest/internal/custom/gtest-port.h" +#include "gtest/internal/gtest-port-arch.h" #if !defined(GTEST_DEV_EMAIL_) # define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" @@ -356,7 +353,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # include <android/api-level.h> // NOLINT #endif -// Defines this to true if Google Test can use POSIX regular expressions. +// Defines this to true if and only if Google Test can use POSIX regular +// expressions. #ifndef GTEST_HAS_POSIX_RE # if GTEST_OS_LINUX_ANDROID // On Android, <regex.h> is only available starting with Gingerbread. @@ -397,7 +395,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // The user didn't tell us whether exceptions are enabled, so we need // to figure it out. # if defined(_MSC_VER) && defined(_CPPUNWIND) -// MSVC defines _CPPUNWIND to 1 if exceptions are enabled. +// MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__BORLANDC__) // C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS @@ -408,16 +406,17 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # endif // _HAS_EXCEPTIONS # define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS # elif defined(__clang__) -// clang defines __EXCEPTIONS if exceptions are enabled before clang 220714, -// but if cleanups are enabled after that. In Obj-C++ files, there can be -// cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions -// are disabled. clang has __has_feature(cxx_exceptions) which checks for C++ -// exceptions starting at clang r206352, but which checked for cleanups prior to -// that. To reliably check for C++ exception availability with clang, check for +// clang defines __EXCEPTIONS if and only if exceptions are enabled before clang +// 220714, but if and only if cleanups are enabled after that. In Obj-C++ files, +// there can be cleanups for ObjC exceptions which also need cleanups, even if +// C++ exceptions are disabled. clang has __has_feature(cxx_exceptions) which +// checks for C++ exceptions starting at clang r206352, but which checked for +// cleanups prior to that. To reliably check for C++ exception availability with +// clang, check for // __EXCEPTIONS && __has_feature(cxx_exceptions). # define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions)) # elif defined(__GNUC__) && __EXCEPTIONS -// gcc defines __EXCEPTIONS to 1 if exceptions are enabled. +// gcc defines __EXCEPTIONS to 1 if and only if exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__SUNPRO_CC) // Sun Pro CC supports exceptions. However, there is no compile-time way of @@ -425,7 +424,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // they are enabled unless the user tells us otherwise. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__IBMCPP__) && __EXCEPTIONS -// xlC defines __EXCEPTIONS to 1 if exceptions are enabled. +// xlC defines __EXCEPTIONS to 1 if and only if exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__HP_aCC) // Exception handling is in effect by default in HP aCC compiler. It has to @@ -438,15 +437,6 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # endif // defined(_MSC_VER) || defined(__BORLANDC__) #endif // GTEST_HAS_EXCEPTIONS -#if !defined(GTEST_HAS_STD_STRING) -// Even though we don't use this macro any longer, we keep it in case -// some clients still depend on it. -# define GTEST_HAS_STD_STRING 1 -#elif !GTEST_HAS_STD_STRING -// The user told us that ::std::string isn't available. -# error "::std::string isn't available." -#endif // !defined(GTEST_HAS_STD_STRING) - #ifndef GTEST_HAS_STD_WSTRING // The user didn't tell us whether ::std::wstring is available, so we need // to figure it out. @@ -455,7 +445,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // no support for it at least as recent as Froyo (2.2). #define GTEST_HAS_STD_WSTRING \ (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ - GTEST_OS_HAIKU)) + GTEST_OS_HAIKU || GTEST_OS_ESP32 || GTEST_OS_ESP8266)) #endif // GTEST_HAS_STD_WSTRING @@ -466,13 +456,14 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # ifdef _MSC_VER -# ifdef _CPPRTTI // MSVC defines this macro if RTTI is enabled. +#ifdef _CPPRTTI // MSVC defines this macro if and only if RTTI is enabled. # define GTEST_HAS_RTTI 1 # else # define GTEST_HAS_RTTI 0 # endif -// Starting with version 4.3.2, gcc defines __GXX_RTTI if RTTI is enabled. +// Starting with version 4.3.2, gcc defines __GXX_RTTI if and only if RTTI is +// enabled. # elif defined(__GNUC__) # ifdef __GXX_RTTI @@ -578,7 +569,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #ifndef GTEST_HAS_STREAM_REDIRECTION // By default, we assume that stream redirection is supported on all // platforms except known mobile ones. -# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT +#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \ + GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 # define GTEST_HAS_STREAM_REDIRECTION 0 # else # define GTEST_HAS_STREAM_REDIRECTION 1 @@ -852,20 +844,6 @@ class Secret; // expression is false, compiler will issue an error containing this identifier. #define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg) -// StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h. -// -// This template is declared, but intentionally undefined. -template <typename T1, typename T2> -struct StaticAssertTypeEqHelper; - -template <typename T> -struct StaticAssertTypeEqHelper<T, T> { - enum { value = true }; -}; - -// Evaluates to the number of elements in 'array'. -#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0])) - // A helper for suppressing warnings on constant condition. It just // returns 'condition'. GTEST_API_ bool IsTrue(bool condition); @@ -893,9 +871,9 @@ class GTEST_API_ RE { // Returns the string representation of the regex. const char* pattern() const { return pattern_; } - // FullMatch(str, re) returns true if regular expression re matches - // the entire str. - // PartialMatch(str, re) returns true if regular expression re + // FullMatch(str, re) returns true if and only if regular expression re + // matches the entire str. + // PartialMatch(str, re) returns true if and only if regular expression re // matches a substring of str (including str itself). static bool FullMatch(const ::std::string& str, const RE& re) { return FullMatch(str.c_str(), re); @@ -1237,7 +1215,8 @@ class GTEST_API_ AutoHandle { void Reset(Handle handle); private: - // Returns true if the handle is a valid handle object that can be closed. + // Returns true if and only if the handle is a valid handle object that can be + // closed. bool IsCloseable() const; Handle handle_; @@ -1339,7 +1318,8 @@ class ThreadWithParam : public ThreadWithParamBase { // When non-NULL, used to block execution until the controller thread // notifies. Notification* const thread_can_start_; - bool finished_; // true if we know that the thread function has finished. + bool finished_; // true if and only if we know that the thread function has + // finished. pthread_t thread_; // The native thread object. GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); @@ -1604,7 +1584,7 @@ class ThreadLocal : public ThreadLocalBase { class DefaultValueHolderFactory : public ValueHolderFactory { public: DefaultValueHolderFactory() {} - virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } + ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); @@ -1613,7 +1593,7 @@ class ThreadLocal : public ThreadLocalBase { class InstanceValueHolderFactory : public ValueHolderFactory { public: explicit InstanceValueHolderFactory(const T& value) : value_(value) {} - virtual ValueHolder* MakeNewHolder() const { + ValueHolder* MakeNewHolder() const override { return new ValueHolder(value_); } @@ -1813,7 +1793,7 @@ class GTEST_API_ ThreadLocal { class DefaultValueHolderFactory : public ValueHolderFactory { public: DefaultValueHolderFactory() {} - virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } + ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); @@ -1822,7 +1802,7 @@ class GTEST_API_ ThreadLocal { class InstanceValueHolderFactory : public ValueHolderFactory { public: explicit InstanceValueHolderFactory(const T& value) : value_(value) {} - virtual ValueHolder* MakeNewHolder() const { + ValueHolder* MakeNewHolder() const override { return new ValueHolder(value_); } @@ -1892,9 +1872,6 @@ class GTEST_API_ ThreadLocal { // we cannot detect it. GTEST_API_ size_t GetThreadCount(); -template <bool B> -using bool_constant = std::integral_constant<bool, B>; - #if GTEST_OS_WINDOWS # define GTEST_PATH_SEP_ "\\" # define GTEST_HAS_ALT_PATH_SEP_ 1 @@ -1995,6 +1972,22 @@ inline bool IsDir(const StatStruct& st) { } # endif // GTEST_OS_WINDOWS_MOBILE +#elif GTEST_OS_ESP8266 +typedef struct stat StatStruct; + +inline int FileNo(FILE* file) { return fileno(file); } +inline int IsATTY(int fd) { return isatty(fd); } +inline int Stat(const char* path, StatStruct* buf) { + // stat function not implemented on ESP8266 + return 0; +} +inline int StrCaseCmp(const char* s1, const char* s2) { + return strcasecmp(s1, s2); +} +inline char* StrDup(const char* src) { return strdup(src); } +inline int RmDir(const char* dir) { return rmdir(dir); } +inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); } + #else typedef struct stat StatStruct; @@ -2015,10 +2008,6 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); } GTEST_DISABLE_MSC_DEPRECATED_PUSH_() -inline const char* StrNCpy(char* dest, const char* src, size_t n) { - return strncpy(dest, src, n); -} - // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and // StrError() aren't needed on Windows CE at this time and thus not // defined there. @@ -2047,8 +2036,9 @@ inline int Close(int fd) { return close(fd); } inline const char* StrError(int errnum) { return strerror(errnum); } #endif inline const char* GetEnv(const char* name) { -#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT - // We are on Windows CE, which has no environment variables. +#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \ + GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 + // We are on an embedded platform, which has no environment variables. static_cast<void>(name); // To prevent 'unused argument' warning. return nullptr; #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9) diff --git a/googletest/include/gtest/internal/gtest-string.h b/googletest/include/gtest/internal/gtest-string.h index 26d8407..82aaa63 100644 --- a/googletest/include/gtest/internal/gtest-string.h +++ b/googletest/include/gtest/internal/gtest-string.h @@ -94,7 +94,8 @@ class GTEST_API_ String { static const char* Utf16ToAnsi(LPCWSTR utf16_str); #endif - // Compares two C strings. Returns true if they have the same content. + // Compares two C strings. Returns true if and only if they have the same + // content. // // Unlike strcmp(), this function can handle NULL argument(s). A // NULL C string is considered different to any non-NULL C string, @@ -107,16 +108,16 @@ class GTEST_API_ String { // returned. static std::string ShowWideCString(const wchar_t* wide_c_str); - // Compares two wide C strings. Returns true if they have the same - // content. + // Compares two wide C strings. Returns true if and only if they have the + // same content. // // Unlike wcscmp(), this function can handle NULL argument(s). A // NULL C string is considered different to any non-NULL C string, // including the empty string. static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); - // Compares two C strings, ignoring case. Returns true if they - // have the same content. + // Compares two C strings, ignoring case. Returns true if and only if + // they have the same content. // // Unlike strcasecmp(), this function can handle NULL argument(s). // A NULL C string is considered different to any non-NULL C string, @@ -124,8 +125,8 @@ class GTEST_API_ String { static bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs); - // Compares two wide C strings, ignoring case. Returns true if they - // have the same content. + // Compares two wide C strings, ignoring case. Returns true if and only if + // they have the same content. // // Unlike wcscasecmp(), this function can handle NULL argument(s). // A NULL C string is considered different to any non-NULL wide C string, @@ -139,8 +140,8 @@ class GTEST_API_ String { static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); - // Returns true if the given string ends with the given suffix, ignoring - // case. Any string is considered to end with an empty suffix. + // Returns true if and only if the given string ends with the given suffix, + // ignoring case. Any string is considered to end with an empty suffix. static bool EndsWithCaseInsensitive( const std::string& str, const std::string& suffix); diff --git a/googletest/include/gtest/internal/gtest-type-util.h b/googletest/include/gtest/internal/gtest-type-util.h index 3d7542d..082fdad 100644 --- a/googletest/include/gtest/internal/gtest-type-util.h +++ b/googletest/include/gtest/internal/gtest-type-util.h @@ -1,7 +1,3 @@ -// This file was GENERATED by command: -// pump.py gtest-type-util.h.pump -// DO NOT EDIT BY HAND!!! - // Copyright 2008 Google Inc. // All Rights Reserved. // @@ -32,12 +28,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Type utilities needed for implementing typed and type-parameterized -// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! -// -// Currently we support at most 50 types in a list, and at most 50 -// type-parameterized tests in one type-parameterized test suite. -// Please contact googletestframework@googlegroups.com if you need -// more. +// tests. // GOOGLETEST_CM0001 DO NOT DELETE @@ -105,1524 +96,9 @@ std::string GetTypeName() { #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P -// A unique type used as the default value for the arguments of class -// template Types. This allows us to simulate variadic templates -// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't -// support directly. +// A unique type indicating an empty node struct None {}; -// The following family of struct and struct templates are used to -// represent type lists. In particular, TypesN<T1, T2, ..., TN> -// represents a type list with N types (T1, T2, ..., and TN) in it. -// Except for Types0, every struct in the family has two member types: -// Head for the first type in the list, and Tail for the rest of the -// list. - -// The empty type list. -struct Types0 {}; - -// Type lists of length 1, 2, 3, and so on. - -template <typename T1> -struct Types1 { - typedef T1 Head; - typedef Types0 Tail; -}; -template <typename T1, typename T2> -struct Types2 { - typedef T1 Head; - typedef Types1<T2> Tail; -}; - -template <typename T1, typename T2, typename T3> -struct Types3 { - typedef T1 Head; - typedef Types2<T2, T3> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4> -struct Types4 { - typedef T1 Head; - typedef Types3<T2, T3, T4> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5> -struct Types5 { - typedef T1 Head; - typedef Types4<T2, T3, T4, T5> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6> -struct Types6 { - typedef T1 Head; - typedef Types5<T2, T3, T4, T5, T6> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7> -struct Types7 { - typedef T1 Head; - typedef Types6<T2, T3, T4, T5, T6, T7> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8> -struct Types8 { - typedef T1 Head; - typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9> -struct Types9 { - typedef T1 Head; - typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10> -struct Types10 { - typedef T1 Head; - typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11> -struct Types11 { - typedef T1 Head; - typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12> -struct Types12 { - typedef T1 Head; - typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13> -struct Types13 { - typedef T1 Head; - typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14> -struct Types14 { - typedef T1 Head; - typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15> -struct Types15 { - typedef T1 Head; - typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16> -struct Types16 { - typedef T1 Head; - typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17> -struct Types17 { - typedef T1 Head; - typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18> -struct Types18 { - typedef T1 Head; - typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19> -struct Types19 { - typedef T1 Head; - typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20> -struct Types20 { - typedef T1 Head; - typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21> -struct Types21 { - typedef T1 Head; - typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22> -struct Types22 { - typedef T1 Head; - typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23> -struct Types23 { - typedef T1 Head; - typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24> -struct Types24 { - typedef T1 Head; - typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25> -struct Types25 { - typedef T1 Head; - typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26> -struct Types26 { - typedef T1 Head; - typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27> -struct Types27 { - typedef T1 Head; - typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28> -struct Types28 { - typedef T1 Head; - typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29> -struct Types29 { - typedef T1 Head; - typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30> -struct Types30 { - typedef T1 Head; - typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31> -struct Types31 { - typedef T1 Head; - typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32> -struct Types32 { - typedef T1 Head; - typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33> -struct Types33 { - typedef T1 Head; - typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34> -struct Types34 { - typedef T1 Head; - typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35> -struct Types35 { - typedef T1 Head; - typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36> -struct Types36 { - typedef T1 Head; - typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37> -struct Types37 { - typedef T1 Head; - typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38> -struct Types38 { - typedef T1 Head; - typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39> -struct Types39 { - typedef T1 Head; - typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40> -struct Types40 { - typedef T1 Head; - typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41> -struct Types41 { - typedef T1 Head; - typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42> -struct Types42 { - typedef T1 Head; - typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43> -struct Types43 { - typedef T1 Head; - typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44> -struct Types44 { - typedef T1 Head; - typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45> -struct Types45 { - typedef T1 Head; - typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46> -struct Types46 { - typedef T1 Head; - typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47> -struct Types47 { - typedef T1 Head; - typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48> -struct Types48 { - typedef T1 Head; - typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47, T48> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48, typename T49> -struct Types49 { - typedef T1 Head; - typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47, T48, T49> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48, typename T49, typename T50> -struct Types50 { - typedef T1 Head; - typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47, T48, T49, T50> Tail; -}; - - -} // namespace internal - -// We don't want to require the users to write TypesN<...> directly, -// as that would require them to count the length. Types<...> is much -// easier to write, but generates horrible messages when there is a -// compiler error, as gcc insists on printing out each template -// argument, even if it has the default value (this means Types<int> -// will appear as Types<int, None, None, ..., None> in the compiler -// errors). -// -// Our solution is to combine the best part of the two approaches: a -// user would write Types<T1, ..., TN>, and Google Test will translate -// that to TypesN<T1, ..., TN> internally to make error messages -// readable. The translation is done by the 'type' member of the -// Types template. -template <typename T1 = internal::None, typename T2 = internal::None, - typename T3 = internal::None, typename T4 = internal::None, - typename T5 = internal::None, typename T6 = internal::None, - typename T7 = internal::None, typename T8 = internal::None, - typename T9 = internal::None, typename T10 = internal::None, - typename T11 = internal::None, typename T12 = internal::None, - typename T13 = internal::None, typename T14 = internal::None, - typename T15 = internal::None, typename T16 = internal::None, - typename T17 = internal::None, typename T18 = internal::None, - typename T19 = internal::None, typename T20 = internal::None, - typename T21 = internal::None, typename T22 = internal::None, - typename T23 = internal::None, typename T24 = internal::None, - typename T25 = internal::None, typename T26 = internal::None, - typename T27 = internal::None, typename T28 = internal::None, - typename T29 = internal::None, typename T30 = internal::None, - typename T31 = internal::None, typename T32 = internal::None, - typename T33 = internal::None, typename T34 = internal::None, - typename T35 = internal::None, typename T36 = internal::None, - typename T37 = internal::None, typename T38 = internal::None, - typename T39 = internal::None, typename T40 = internal::None, - typename T41 = internal::None, typename T42 = internal::None, - typename T43 = internal::None, typename T44 = internal::None, - typename T45 = internal::None, typename T46 = internal::None, - typename T47 = internal::None, typename T48 = internal::None, - typename T49 = internal::None, typename T50 = internal::None> -struct Types { - typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type; -}; - -template <> -struct Types<internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types0 type; -}; -template <typename T1> -struct Types<T1, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types1<T1> type; -}; -template <typename T1, typename T2> -struct Types<T1, T2, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types2<T1, T2> type; -}; -template <typename T1, typename T2, typename T3> -struct Types<T1, T2, T3, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types3<T1, T2, T3> type; -}; -template <typename T1, typename T2, typename T3, typename T4> -struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types4<T1, T2, T3, T4> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5> -struct Types<T1, T2, T3, T4, T5, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types5<T1, T2, T3, T4, T5> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6> -struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types6<T1, T2, T3, T4, T5, T6> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7> -struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, - T12> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, - T26> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, - T40> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - T46, internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - T46, T47, internal::None, internal::None, internal::None> { - typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - T46, T47, T48, internal::None, internal::None> { - typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47, T48> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48, typename T49> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - T46, T47, T48, T49, internal::None> { - typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47, T48, T49> type; -}; - -namespace internal { - # define GTEST_TEMPLATE_ template <typename T> class // The template "selector" struct TemplateSel<Tmpl> is used to @@ -1644,1692 +120,64 @@ struct TemplateSel { # define GTEST_BIND_(TmplSel, T) \ TmplSel::template Bind<T>::type -// A unique struct template used as the default value for the -// arguments of class template Templates. This allows us to simulate -// variadic templates (e.g. Templates<int>, Templates<int, double>, -// and etc), which C++ doesn't support directly. -template <typename T> -struct NoneT {}; - -// The following family of struct and struct templates are used to -// represent template lists. In particular, TemplatesN<T1, T2, ..., -// TN> represents a list of N templates (T1, T2, ..., and TN). Except -// for Templates0, every struct in the family has two member types: -// Head for the selector of the first template in the list, and Tail -// for the rest of the list. - -// The empty template list. -struct Templates0 {}; - -// Template lists of length 1, 2, 3, and so on. - -template <GTEST_TEMPLATE_ T1> -struct Templates1 { - typedef TemplateSel<T1> Head; - typedef Templates0 Tail; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2> -struct Templates2 { - typedef TemplateSel<T1> Head; - typedef Templates1<T2> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3> -struct Templates3 { - typedef TemplateSel<T1> Head; - typedef Templates2<T2, T3> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4> -struct Templates4 { - typedef TemplateSel<T1> Head; - typedef Templates3<T2, T3, T4> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5> -struct Templates5 { - typedef TemplateSel<T1> Head; - typedef Templates4<T2, T3, T4, T5> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6> -struct Templates6 { - typedef TemplateSel<T1> Head; - typedef Templates5<T2, T3, T4, T5, T6> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7> -struct Templates7 { - typedef TemplateSel<T1> Head; - typedef Templates6<T2, T3, T4, T5, T6, T7> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8> -struct Templates8 { - typedef TemplateSel<T1> Head; - typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9> -struct Templates9 { - typedef TemplateSel<T1> Head; - typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10> -struct Templates10 { - typedef TemplateSel<T1> Head; - typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11> -struct Templates11 { - typedef TemplateSel<T1> Head; - typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12> -struct Templates12 { - typedef TemplateSel<T1> Head; - typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13> -struct Templates13 { - typedef TemplateSel<T1> Head; - typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14> -struct Templates14 { - typedef TemplateSel<T1> Head; - typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15> -struct Templates15 { - typedef TemplateSel<T1> Head; - typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16> -struct Templates16 { - typedef TemplateSel<T1> Head; - typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17> -struct Templates17 { - typedef TemplateSel<T1> Head; - typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18> -struct Templates18 { - typedef TemplateSel<T1> Head; - typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19> -struct Templates19 { - typedef TemplateSel<T1> Head; - typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20> -struct Templates20 { - typedef TemplateSel<T1> Head; - typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21> -struct Templates21 { - typedef TemplateSel<T1> Head; - typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22> -struct Templates22 { - typedef TemplateSel<T1> Head; - typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23> -struct Templates23 { - typedef TemplateSel<T1> Head; - typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24> -struct Templates24 { - typedef TemplateSel<T1> Head; - typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25> -struct Templates25 { - typedef TemplateSel<T1> Head; - typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26> -struct Templates26 { - typedef TemplateSel<T1> Head; - typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27> -struct Templates27 { - typedef TemplateSel<T1> Head; - typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28> -struct Templates28 { - typedef TemplateSel<T1> Head; - typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29> -struct Templates29 { - typedef TemplateSel<T1> Head; - typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30> -struct Templates30 { - typedef TemplateSel<T1> Head; - typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31> -struct Templates31 { - typedef TemplateSel<T1> Head; - typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32> -struct Templates32 { - typedef TemplateSel<T1> Head; - typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33> -struct Templates33 { - typedef TemplateSel<T1> Head; - typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34> -struct Templates34 { - typedef TemplateSel<T1> Head; - typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35> -struct Templates35 { - typedef TemplateSel<T1> Head; - typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36> -struct Templates36 { - typedef TemplateSel<T1> Head; - typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37> -struct Templates37 { - typedef TemplateSel<T1> Head; - typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38> -struct Templates38 { - typedef TemplateSel<T1> Head; - typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39> -struct Templates39 { - typedef TemplateSel<T1> Head; - typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40> -struct Templates40 { - typedef TemplateSel<T1> Head; - typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41> -struct Templates41 { - typedef TemplateSel<T1> Head; - typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42> -struct Templates42 { - typedef TemplateSel<T1> Head; - typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43> -struct Templates43 { - typedef TemplateSel<T1> Head; - typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44> -struct Templates44 { - typedef TemplateSel<T1> Head; - typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45> -struct Templates45 { - typedef TemplateSel<T1> Head; - typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46> -struct Templates46 { - typedef TemplateSel<T1> Head; - typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46> Tail; +template <GTEST_TEMPLATE_ Head_, GTEST_TEMPLATE_... Tail_> +struct Templates { + using Head = TemplateSel<Head_>; + using Tail = Templates<Tail_...>; }; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47> -struct Templates47 { - typedef TemplateSel<T1> Head; - typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46, T47> Tail; +template <GTEST_TEMPLATE_ Head_> +struct Templates<Head_> { + using Head = TemplateSel<Head_>; + using Tail = None; }; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48> -struct Templates48 { - typedef TemplateSel<T1> Head; - typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46, T47, T48> Tail; +// Tuple-like type lists +template <typename Head_, typename... Tail_> +struct Types { + using Head = Head_; + using Tail = Types<Tail_...>; }; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, - GTEST_TEMPLATE_ T49> -struct Templates49 { - typedef TemplateSel<T1> Head; - typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46, T47, T48, T49> Tail; +template <typename Head_> +struct Types<Head_> { + using Head = Head_; + using Tail = None; }; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, - GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50> -struct Templates50 { - typedef TemplateSel<T1> Head; - typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46, T47, T48, T49, T50> Tail; +// Helper metafunctions to tell apart a single type from types +// generated by ::testing::Types +template <typename... Ts> +struct ProxyTypeList { + using type = Types<Ts...>; }; +template <typename> +struct is_proxy_type_list : std::false_type {}; -// We don't want to require the users to write TemplatesN<...> directly, -// as that would require them to count the length. Templates<...> is much -// easier to write, but generates horrible messages when there is a -// compiler error, as gcc insists on printing out each template -// argument, even if it has the default value (this means Templates<list> -// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler -// errors). -// -// Our solution is to combine the best part of the two approaches: a -// user would write Templates<T1, ..., TN>, and Google Test will translate -// that to TemplatesN<T1, ..., TN> internally to make error messages -// readable. The translation is done by the 'type' member of the -// Templates template. -template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT, - GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT, - GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT, - GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT, - GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT, - GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT, - GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT, - GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT, - GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT, - GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT, - GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT, - GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT, - GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT, - GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT, - GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT, - GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT, - GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT, - GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT, - GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT, - GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT, - GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT, - GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT, - GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT, - GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT, - GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT> -struct Templates { - typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46, T47, T48, T49, T50> type; -}; - -template <> -struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT> { - typedef Templates0 type; -}; -template <GTEST_TEMPLATE_ T1> -struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT> { - typedef Templates1<T1> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2> -struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT> { - typedef Templates2<T1, T2> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3> -struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates3<T1, T2, T3> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4> -struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates4<T1, T2, T3, T4> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5> -struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates5<T1, T2, T3, T4, T5> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6> -struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates6<T1, T2, T3, T4, T5, T6> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7> -struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT> { - typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT> { - typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT> { - typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT> { - typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT> { - typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT> { - typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT> { - typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT> { - typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT> { - typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT> { - typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT> { - typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT> { - typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, T46, NoneT, NoneT, NoneT, NoneT> { - typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, T46, T47, NoneT, NoneT, NoneT> { - typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46, T47> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, T46, T47, T48, NoneT, NoneT> { - typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46, T47, T48> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, - GTEST_TEMPLATE_ T49> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, T46, T47, T48, T49, NoneT> { - typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46, T47, T48, T49> type; -}; - -// The TypeList template makes it possible to use either a single type -// or a Types<...> list in TYPED_TEST_SUITE() and -// INSTANTIATE_TYPED_TEST_SUITE_P(). +template <typename... Ts> +struct is_proxy_type_list<ProxyTypeList<Ts...>> : std::true_type {}; +// Generator which conditionally creates type lists. +// It recognizes if a requested type list should be created +// and prevents creating a new type list nested within another one. template <typename T> -struct TypeList { - typedef Types1<T> type; -}; +struct GenerateTypeList { + private: + using proxy = typename std::conditional<is_proxy_type_list<T>::value, T, + ProxyTypeList<T>>::type; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48, typename T49, typename T50> -struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47, T48, T49, T50> > { - typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type; + public: + using type = typename proxy::type; }; #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P } // namespace internal + +template <typename... Ts> +using Types = internal::ProxyTypeList<Ts...>; + } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ diff --git a/googletest/include/gtest/internal/gtest-type-util.h.pump b/googletest/include/gtest/internal/gtest-type-util.h.pump deleted file mode 100644 index 5e31b7b..0000000 --- a/googletest/include/gtest/internal/gtest-type-util.h.pump +++ /dev/null @@ -1,302 +0,0 @@ -$$ -*- mode: c++; -*- -$var n = 50 $$ Maximum length of type lists we want to support. -// 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. - - -// Type utilities needed for implementing typed and type-parameterized -// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! -// -// Currently we support at most $n types in a list, and at most $n -// type-parameterized tests in one type-parameterized test suite. -// Please contact googletestframework@googlegroups.com if you need -// more. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ - -#include "gtest/internal/gtest-port.h" - -// #ifdef __GNUC__ is too general here. It is possible to use gcc without using -// libstdc++ (which is where cxxabi.h comes from). -# if GTEST_HAS_CXXABI_H_ -# include <cxxabi.h> -# elif defined(__HP_aCC) -# include <acxx_demangle.h> -# endif // GTEST_HASH_CXXABI_H_ - -namespace testing { -namespace internal { - -// Canonicalizes a given name with respect to the Standard C++ Library. -// This handles removing the inline namespace within `std` that is -// used by various standard libraries (e.g., `std::__1`). Names outside -// of namespace std are returned unmodified. -inline std::string CanonicalizeForStdLibVersioning(std::string s) { - static const char prefix[] = "std::__"; - if (s.compare(0, strlen(prefix), prefix) == 0) { - std::string::size_type end = s.find("::", strlen(prefix)); - if (end != s.npos) { - // Erase everything between the initial `std` and the second `::`. - s.erase(strlen("std"), end - strlen("std")); - } - } - return s; -} - -// GetTypeName<T>() returns a human-readable name of type T. -// NB: This function is also used in Google Mock, so don't move it inside of -// the typed-test-only section below. -template <typename T> -std::string GetTypeName() { -# if GTEST_HAS_RTTI - - const char* const name = typeid(T).name(); -# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC) - int status = 0; - // gcc's implementation of typeid(T).name() mangles the type name, - // so we have to demangle it. -# if GTEST_HAS_CXXABI_H_ - using abi::__cxa_demangle; -# endif // GTEST_HAS_CXXABI_H_ - char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status); - const std::string name_str(status == 0 ? readable_name : name); - free(readable_name); - return CanonicalizeForStdLibVersioning(name_str); -# else - return name; -# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC - -# else - - return "<type>"; - -# endif // GTEST_HAS_RTTI -} - -#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P - -// A unique type used as the default value for the arguments of class -// template Types. This allows us to simulate variadic templates -// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't -// support directly. -struct None {}; - -// The following family of struct and struct templates are used to -// represent type lists. In particular, TypesN<T1, T2, ..., TN> -// represents a type list with N types (T1, T2, ..., and TN) in it. -// Except for Types0, every struct in the family has two member types: -// Head for the first type in the list, and Tail for the rest of the -// list. - -// The empty type list. -struct Types0 {}; - -// Type lists of length 1, 2, 3, and so on. - -template <typename T1> -struct Types1 { - typedef T1 Head; - typedef Types0 Tail; -}; - -$range i 2..n - -$for i [[ -$range j 1..i -$range k 2..i -template <$for j, [[typename T$j]]> -struct Types$i { - typedef T1 Head; - typedef Types$(i-1)<$for k, [[T$k]]> Tail; -}; - - -]] - -} // namespace internal - -// We don't want to require the users to write TypesN<...> directly, -// as that would require them to count the length. Types<...> is much -// easier to write, but generates horrible messages when there is a -// compiler error, as gcc insists on printing out each template -// argument, even if it has the default value (this means Types<int> -// will appear as Types<int, None, None, ..., None> in the compiler -// errors). -// -// Our solution is to combine the best part of the two approaches: a -// user would write Types<T1, ..., TN>, and Google Test will translate -// that to TypesN<T1, ..., TN> internally to make error messages -// readable. The translation is done by the 'type' member of the -// Types template. - -$range i 1..n -template <$for i, [[typename T$i = internal::None]]> -struct Types { - typedef internal::Types$n<$for i, [[T$i]]> type; -}; - -template <> -struct Types<$for i, [[internal::None]]> { - typedef internal::Types0 type; -}; - -$range i 1..n-1 -$for i [[ -$range j 1..i -$range k i+1..n -template <$for j, [[typename T$j]]> -struct Types<$for j, [[T$j]]$for k[[, internal::None]]> { - typedef internal::Types$i<$for j, [[T$j]]> type; -}; - -]] - -namespace internal { - -# define GTEST_TEMPLATE_ template <typename T> class - -// The template "selector" struct TemplateSel<Tmpl> is used to -// represent Tmpl, which must be a class template with one type -// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined -// as the type Tmpl<T>. This allows us to actually instantiate the -// template "selected" by TemplateSel<Tmpl>. -// -// This trick is necessary for simulating typedef for class templates, -// which C++ doesn't support directly. -template <GTEST_TEMPLATE_ Tmpl> -struct TemplateSel { - template <typename T> - struct Bind { - typedef Tmpl<T> type; - }; -}; - -# define GTEST_BIND_(TmplSel, T) \ - TmplSel::template Bind<T>::type - -// A unique struct template used as the default value for the -// arguments of class template Templates. This allows us to simulate -// variadic templates (e.g. Templates<int>, Templates<int, double>, -// and etc), which C++ doesn't support directly. -template <typename T> -struct NoneT {}; - -// The following family of struct and struct templates are used to -// represent template lists. In particular, TemplatesN<T1, T2, ..., -// TN> represents a list of N templates (T1, T2, ..., and TN). Except -// for Templates0, every struct in the family has two member types: -// Head for the selector of the first template in the list, and Tail -// for the rest of the list. - -// The empty template list. -struct Templates0 {}; - -// Template lists of length 1, 2, 3, and so on. - -template <GTEST_TEMPLATE_ T1> -struct Templates1 { - typedef TemplateSel<T1> Head; - typedef Templates0 Tail; -}; - -$range i 2..n - -$for i [[ -$range j 1..i -$range k 2..i -template <$for j, [[GTEST_TEMPLATE_ T$j]]> -struct Templates$i { - typedef TemplateSel<T1> Head; - typedef Templates$(i-1)<$for k, [[T$k]]> Tail; -}; - - -]] - -// We don't want to require the users to write TemplatesN<...> directly, -// as that would require them to count the length. Templates<...> is much -// easier to write, but generates horrible messages when there is a -// compiler error, as gcc insists on printing out each template -// argument, even if it has the default value (this means Templates<list> -// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler -// errors). -// -// Our solution is to combine the best part of the two approaches: a -// user would write Templates<T1, ..., TN>, and Google Test will translate -// that to TemplatesN<T1, ..., TN> internally to make error messages -// readable. The translation is done by the 'type' member of the -// Templates template. - -$range i 1..n -template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]> -struct Templates { - typedef Templates$n<$for i, [[T$i]]> type; -}; - -template <> -struct Templates<$for i, [[NoneT]]> { - typedef Templates0 type; -}; - -$range i 1..n-1 -$for i [[ -$range j 1..i -$range k i+1..n -template <$for j, [[GTEST_TEMPLATE_ T$j]]> -struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> { - typedef Templates$i<$for j, [[T$j]]> type; -}; - -]] - -// The TypeList template makes it possible to use either a single type -// or a Types<...> list in TYPED_TEST_SUITE() and -// INSTANTIATE_TYPED_TEST_SUITE_P(). - -template <typename T> -struct TypeList { - typedef Types1<T> type; -}; - - -$range i 1..n -template <$for i, [[typename T$i]]> -struct TypeList<Types<$for i, [[T$i]]> > { - typedef typename Types<$for i, [[T$i]]>::type type; -}; - -#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P - -} // namespace internal -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ diff --git a/googletest/samples/prime_tables.h b/googletest/samples/prime_tables.h index 4178e70..72539bf 100644 --- a/googletest/samples/prime_tables.h +++ b/googletest/samples/prime_tables.h @@ -43,7 +43,7 @@ class PrimeTable { public: virtual ~PrimeTable() {} - // Returns true if n is a prime number. + // Returns true if and only if n is a prime number. virtual bool IsPrime(int n) const = 0; // Returns the smallest prime number greater than p; or returns -1 diff --git a/googletest/samples/sample1.cc b/googletest/samples/sample1.cc index 58dbf17..1d42759 100644 --- a/googletest/samples/sample1.cc +++ b/googletest/samples/sample1.cc @@ -41,7 +41,7 @@ int Factorial(int n) { return result; } -// Returns true if n is a prime number. +// Returns true if and only if n is a prime number. bool IsPrime(int n) { // Trivial case 1: small numbers if (n <= 1) return false; diff --git a/googletest/samples/sample1.h b/googletest/samples/sample1.h index a90eae4..12e49de 100644 --- a/googletest/samples/sample1.h +++ b/googletest/samples/sample1.h @@ -35,7 +35,7 @@ // Returns n! (the factorial of n). For negative n, n! is defined to be 1. int Factorial(int n); -// Returns true if n is a prime number. +// Returns true if and only if n is a prime number. bool IsPrime(int n); #endif // GTEST_SAMPLES_SAMPLE1_H_ diff --git a/googletest/scripts/README.md b/googletest/scripts/README.md new file mode 100644 index 0000000..fa359fe --- /dev/null +++ b/googletest/scripts/README.md @@ -0,0 +1,5 @@ +# 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. diff --git a/googletest/scripts/gen_gtest_pred_impl.py b/googletest/scripts/gen_gtest_pred_impl.py index b43efdf..7294277 100755 --- a/googletest/scripts/gen_gtest_pred_impl.py +++ b/googletest/scripts/gen_gtest_pred_impl.py @@ -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 += """; } @@ -510,7 +514,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 +524,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.""" @@ -588,7 +592,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' diff --git a/googletest/scripts/run_with_path.py b/googletest/scripts/run_with_path.py new file mode 100755 index 0000000..d46ab4d --- /dev/null +++ b/googletest/scripts/run_with_path.py @@ -0,0 +1,32 @@ +#!/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() diff --git a/googletest/scripts/upload.py b/googletest/scripts/upload.py index c852e4c..eba5711 100755 --- a/googletest/scripts/upload.py +++ b/googletest/scripts/upload.py @@ -1,18 +1,33 @@ #!/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"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# 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 -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# 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. """Tool for uploading diffs from a version control system to the codereview app. diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index e5ec287..da09a1c 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -122,8 +122,8 @@ GTEST_DEFINE_string_( "Indicates the file, line number, temporal index of " "the single death test to run, and a file descriptor to " "which a success code may be sent, all separated by " - "the '|' characters. This flag is specified if and only if the current " - "process is a sub-process launched for running a thread-safe " + "the '|' characters. This flag is specified if and only if the " + "current process is a sub-process launched for running a thread-safe " "death test. FOR INTERNAL USE ONLY."); } // namespace internal @@ -563,8 +563,8 @@ static ::std::string FormatDeathTestOutput(const ::std::string& output) { // status_ok: true if exit_status is acceptable in the context of // this particular death test, which fails if it is false // -// Returns true if all of the above conditions are met. Otherwise, the -// first failing condition, in the order given above, is the one that is +// Returns true if and only if all of the above conditions are met. Otherwise, +// the first failing condition, in the order given above, is the one that is // reported. Also sets the last death test message string. bool DeathTestImpl::Passed(bool status_ok) { if (!spawned()) diff --git a/googletest/src/gtest-filepath.cc b/googletest/src/gtest-filepath.cc index bd7b99f..9aad12f 100644 --- a/googletest/src/gtest-filepath.cc +++ b/googletest/src/gtest-filepath.cc @@ -93,7 +93,7 @@ static bool IsPathSeparator(char c) { // Returns the current working directory, or "" if unsuccessful. FilePath FilePath::GetCurrentDir() { #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \ - GTEST_OS_WINDOWS_RT || ARDUINO || defined(ESP_PLATFORM) + GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_ESP32 // These platforms do not have a current directory, so we just return // something reasonable. return FilePath(kCurrentDirectoryString); @@ -323,6 +323,9 @@ bool FilePath::CreateFolder() const { delete [] unicode; #elif GTEST_OS_WINDOWS int result = _mkdir(pathname_.c_str()); +#elif GTEST_OS_ESP8266 + // do nothing + int result = 0; #else int result = mkdir(pathname_.c_str(), 0777); #endif // GTEST_OS_WINDOWS_MOBILE diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index e29d992..8ed70da 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -99,14 +99,14 @@ const char kFlagfileFlag[] = "flagfile"; // A valid random seed must be in [1, kMaxRandomSeed]. const int kMaxRandomSeed = 99999; -// g_help_flag is true if the --help flag or an equivalent form is -// specified on the command line. +// g_help_flag is true if and only if the --help flag or an equivalent form +// is specified on the command line. GTEST_API_ extern bool g_help_flag; // Returns the current time in milliseconds. GTEST_API_ TimeInMillis GetTimeInMillis(); -// Returns true if Google Test should use colors in the output. +// Returns true if and only if Google Test should use colors in the output. GTEST_API_ bool ShouldUseColor(bool stdout_is_tty); // Formats the given time in milliseconds as seconds. @@ -266,8 +266,8 @@ GTEST_API_ bool ShouldShard(const char* total_shards_str, GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val); // Given the total number of shards, the shard index, and the test id, -// returns true if the test should be run on this shard. The test id is -// some arbitrary but unique non-negative integer assigned to each test +// returns true if and only if the test should be run on this shard. The test id +// is some arbitrary but unique non-negative integer assigned to each test // method. Assumes that 0 <= shard_index < total_shards. GTEST_API_ bool ShouldRunTestOnShard( int total_shards, int shard_index, int test_id); @@ -352,7 +352,7 @@ class TestPropertyKeyIs { // TestPropertyKeyIs has NO default constructor. explicit TestPropertyKeyIs(const std::string& key) : key_(key) {} - // Returns true if the test name of test property matches on key_. + // Returns true if and only if the test name of test property matches on key_. bool operator()(const TestProperty& test_property) const { return test_property.key() == key_; } @@ -385,15 +385,15 @@ class GTEST_API_ UnitTestOptions { // Functions for processing the gtest_filter flag. - // Returns true if the wildcard pattern matches the string. The - // first ':' or '\0' character in pattern marks the end of it. + // Returns true if and only if the wildcard pattern matches the string. + // The first ':' or '\0' character in pattern marks the end of it. // // This recursive algorithm isn't very efficient, but is clear and // works well enough for matching test names, which are short. static bool PatternMatchesString(const char *pattern, const char *str); - // Returns true if the user-specified filter matches the test suite - // name and the test name. + // Returns true if and only if the user-specified filter matches the test + // suite name and the test name. static bool FilterMatchesTest(const std::string& test_suite_name, const std::string& test_name); @@ -577,11 +577,12 @@ class GTEST_API_ UnitTestImpl { // Gets the elapsed time, in milliseconds. TimeInMillis elapsed_time() const { return elapsed_time_; } - // Returns true if the unit test passed (i.e. all test suites passed). + // Returns true if and only if the unit test passed (i.e. all test suites + // passed). bool Passed() const { return !Failed(); } - // Returns true if the unit test failed (i.e. some test suite failed - // or something outside of all tests failed). + // Returns true if and only if the unit test failed (i.e. some test suite + // failed or something outside of all tests failed). bool Failed() const { return failed_test_suite_count() > 0 || ad_hoc_test_result()->Failed(); } @@ -911,7 +912,7 @@ class GTEST_API_ UnitTestImpl { // desired. OsStackTraceGetterInterface* os_stack_trace_getter_; - // True if PostFlagParsingInit() has been called. + // True if and only if PostFlagParsingInit() has been called. bool post_flag_parse_init_performed_; // The random number seed used at the beginning of the test run. diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 9024f03..fc5ba6b 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -715,7 +715,7 @@ RE::~RE() { free(const_cast<char*>(pattern_)); } -// Returns true if regular expression re matches the entire str. +// Returns true if and only if regular expression re matches the entire str. bool RE::FullMatch(const char* str, const RE& re) { if (!re.is_valid_) return false; @@ -723,8 +723,8 @@ bool RE::FullMatch(const char* str, const RE& re) { return regexec(&re.full_regex_, str, 1, &match, 0) == 0; } -// Returns true if regular expression re matches a substring of str -// (including str itself). +// Returns true if and only if regular expression re matches a substring of +// str (including str itself). bool RE::PartialMatch(const char* str, const RE& re) { if (!re.is_valid_) return false; @@ -764,14 +764,14 @@ void RE::Init(const char* regex) { #elif GTEST_USES_SIMPLE_RE -// Returns true if ch appears anywhere in str (excluding the +// Returns true if and only if ch appears anywhere in str (excluding the // terminating '\0' character). bool IsInSet(char ch, const char* str) { return ch != '\0' && strchr(str, ch) != nullptr; } -// Returns true if ch belongs to the given classification. Unlike -// similar functions in <ctype.h>, these aren't affected by the +// Returns true if and only if ch belongs to the given classification. +// Unlike similar functions in <ctype.h>, these aren't affected by the // current locale. bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; } bool IsAsciiPunct(char ch) { @@ -784,13 +784,13 @@ bool IsAsciiWordChar(char ch) { ('0' <= ch && ch <= '9') || ch == '_'; } -// Returns true if "\\c" is a supported escape sequence. +// Returns true if and only if "\\c" is a supported escape sequence. bool IsValidEscape(char c) { return (IsAsciiPunct(c) || IsInSet(c, "dDfnrsStvwW")); } -// Returns true if the given atom (specified by escaped and pattern) -// matches ch. The result is undefined if the atom is invalid. +// Returns true if and only if the given atom (specified by escaped and +// pattern) matches ch. The result is undefined if the atom is invalid. bool AtomMatchesChar(bool escaped, char pattern_char, char ch) { if (escaped) { // "\\p" where p is pattern_char. switch (pattern_char) { @@ -828,7 +828,7 @@ bool ValidateRegex(const char* regex) { bool is_valid = true; - // True if ?, *, or + can follow the previous atom. + // True if and only if ?, *, or + can follow the previous atom. bool prev_repeatable = false; for (int i = 0; regex[i]; i++) { if (regex[i] == '\\') { // An escape sequence @@ -904,8 +904,8 @@ bool MatchRepetitionAndRegexAtHead( return false; } -// Returns true if regex matches a prefix of str. regex must be a -// valid simple regular expression and not start with "^", or the +// Returns true if and only if regex matches a prefix of str. regex must +// be a valid simple regular expression and not start with "^", or the // result is undefined. bool MatchRegexAtHead(const char* regex, const char* str) { if (*regex == '\0') // An empty regex matches a prefix of anything. @@ -935,8 +935,8 @@ bool MatchRegexAtHead(const char* regex, const char* str) { } } -// Returns true if regex matches any substring of str. regex must be -// a valid simple regular expression, or the result is undefined. +// Returns true if and only if regex matches any substring of str. regex must +// be a valid simple regular expression, or the result is undefined. // // The algorithm is recursive, but the recursion depth doesn't exceed // the regex length, so we won't need to worry about running out of @@ -964,13 +964,13 @@ RE::~RE() { free(const_cast<char*>(full_pattern_)); } -// Returns true if regular expression re matches the entire str. +// Returns true if and only if regular expression re matches the entire str. bool RE::FullMatch(const char* str, const RE& re) { return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str); } -// Returns true if regular expression re matches a substring of str -// (including str itself). +// Returns true if and only if regular expression re matches a substring of +// str (including str itself). bool RE::PartialMatch(const char* str, const RE& re) { return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str); } @@ -1102,13 +1102,10 @@ class CapturedStream { // code as part of a regular standalone executable, which doesn't // run in a Dalvik process (e.g. when running it through 'adb shell'). // - // The location /sdcard is directly accessible from native code - // and is the only location (unofficially) supported by the Android - // team. It's generally a symlink to the real SD Card mount point - // which can be /mnt/sdcard, /mnt/sdcard0, /system/media/sdcard, or - // other OEM-customized locations. Never rely on these, and always - // use /sdcard. - char name_template[] = "/sdcard/gtest_captured_stream.XXXXXX"; + // The location /data/local/tmp is directly accessible from native code. + // '/sdcard' and other variants cannot be relied on, as they are not + // guaranteed to be mounted, or may have a delay in mounting. + char name_template[] = "/data/local/tmp/gtest_captured_stream.XXXXXX"; # else char name_template[] = "/tmp/captured_stream.XXXXXX"; # endif // GTEST_OS_LINUX_ANDROID @@ -1330,7 +1327,7 @@ bool ParseInt32(const Message& src_text, const char* str, Int32* value) { // Reads and returns the Boolean environment variable corresponding to // the given flag; if it's not set, returns default_value. // -// The value is considered true if it's not "0". +// The value is considered true if and only if it's not "0". bool BoolFromGTestEnv(const char* flag, bool default_value) { #if defined(GTEST_GET_BOOL_FROM_ENV_) return GTEST_GET_BOOL_FROM_ENV_(flag, default_value); diff --git a/googletest/src/gtest-test-part.cc b/googletest/src/gtest-test-part.cc index 178317a..a938683 100644 --- a/googletest/src/gtest-test-part.cc +++ b/googletest/src/gtest-test-part.cc @@ -31,6 +31,8 @@ // The Google C++ Testing and Mocking Framework (Google Test) #include "gtest/gtest-test-part.h" + +#include "gtest/internal/gtest-port.h" #include "src/gtest-internal-inl.h" namespace testing { @@ -46,7 +48,9 @@ std::string TestPartResult::ExtractSummary(const char* message) { // Prints a TestPartResult object. std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { - return os << result.file_name() << ":" << result.line_number() << ": " + return os << internal::FormatFileLocation(result.file_name(), + result.line_number()) + << " " << (result.type() == TestPartResult::kSuccess ? "Success" : result.type() == TestPartResult::kSkip diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 8f3301c..7c1c9ed 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -177,8 +177,8 @@ namespace internal { // stack trace. const char kStackTraceMarker[] = "\nStack trace:\n"; -// g_help_flag is true if the --help flag or an equivalent form is -// specified on the command line. +// g_help_flag is true if and only if the --help flag or an equivalent form +// is specified on the command line. bool g_help_flag = false; // Utilty function to Open File for Writing @@ -215,15 +215,14 @@ GTEST_DEFINE_bool_( "Run disabled tests too, in addition to the tests normally being run."); GTEST_DEFINE_bool_( - break_on_failure, - internal::BoolFromGTestEnv("break_on_failure", false), - "True if a failed assertion should be a debugger break-point."); + break_on_failure, internal::BoolFromGTestEnv("break_on_failure", false), + "True if and only if a failed assertion should be a debugger " + "break-point."); -GTEST_DEFINE_bool_( - catch_exceptions, - internal::BoolFromGTestEnv("catch_exceptions", true), - "True if " GTEST_NAME_ - " should catch exceptions and treat them as test failures."); +GTEST_DEFINE_bool_(catch_exceptions, + internal::BoolFromGTestEnv("catch_exceptions", true), + "True if and only if " GTEST_NAME_ + " should catch exceptions and treat them as test failures."); GTEST_DEFINE_string_( color, @@ -270,17 +269,13 @@ GTEST_DEFINE_string_( "executable's name and, if necessary, made unique by adding " "digits."); -GTEST_DEFINE_bool_( - print_time, - internal::BoolFromGTestEnv("print_time", true), - "True if " GTEST_NAME_ - " should display elapsed time in text output."); +GTEST_DEFINE_bool_(print_time, internal::BoolFromGTestEnv("print_time", true), + "True if and only if " GTEST_NAME_ + " should display elapsed time in text output."); -GTEST_DEFINE_bool_( - print_utf8, - internal::BoolFromGTestEnv("print_utf8", true), - "True if " GTEST_NAME_ - " prints UTF8 characters as text."); +GTEST_DEFINE_bool_(print_utf8, internal::BoolFromGTestEnv("print_utf8", true), + "True if and only if " GTEST_NAME_ + " prints UTF8 characters as text."); GTEST_DEFINE_int32_( random_seed, @@ -294,16 +289,14 @@ GTEST_DEFINE_int32_( "How many times to repeat each test. Specify a negative number " "for repeating forever. Useful for shaking out flaky tests."); -GTEST_DEFINE_bool_( - show_internal_stack_frames, false, - "True if " GTEST_NAME_ " should include internal stack frames when " - "printing test failure stack traces."); +GTEST_DEFINE_bool_(show_internal_stack_frames, false, + "True if and only if " GTEST_NAME_ + " should include internal stack frames when " + "printing test failure stack traces."); -GTEST_DEFINE_bool_( - shuffle, - internal::BoolFromGTestEnv("shuffle", false), - "True if " GTEST_NAME_ - " should randomize tests' order on every run."); +GTEST_DEFINE_bool_(shuffle, internal::BoolFromGTestEnv("shuffle", false), + "True if and only if " GTEST_NAME_ + " should randomize tests' order on every run."); GTEST_DEFINE_int32_( stack_trace_depth, @@ -354,7 +347,7 @@ UInt32 Random::Generate(UInt32 range) { return state_ % range; } -// GTestIsInitialized() returns true if the user has initialized +// GTestIsInitialized() returns true if and only if the user has initialized // Google Test. Useful for catching the user mistake of not initializing // Google Test before calling RUN_ALL_TESTS(). static bool GTestIsInitialized() { return GetArgvs().size() > 0; } @@ -371,18 +364,18 @@ static int SumOverTestSuiteList(const std::vector<TestSuite*>& case_list, return sum; } -// Returns true if the test suite passed. +// Returns true if and only if the test suite passed. static bool TestSuitePassed(const TestSuite* test_suite) { return test_suite->should_run() && test_suite->Passed(); } -// Returns true if the test suite failed. +// Returns true if and only if the test suite failed. static bool TestSuiteFailed(const TestSuite* test_suite) { return test_suite->should_run() && test_suite->Failed(); } -// Returns true if test_suite contains at least one test that should -// run. +// Returns true if and only if test_suite contains at least one test that +// should run. static bool ShouldRunTestSuite(const TestSuite* test_suite) { return test_suite->should_run(); } @@ -482,8 +475,8 @@ std::string UnitTestOptions::GetAbsolutePathToOutputFile() { return result.string(); } -// Returns true if the wildcard pattern matches the string. The -// first ':' or '\0' character in pattern marks the end of it. +// Returns true if and only if the wildcard pattern matches the string. +// The first ':' or '\0' character in pattern marks the end of it. // // This recursive algorithm isn't very efficient, but is clear and // works well enough for matching test names, which are short. @@ -525,8 +518,8 @@ bool UnitTestOptions::MatchesFilter( } } -// Returns true if the user-specified filter matches the test suite -// name and the test name. +// Returns true if and only if the user-specified filter matches the test +// suite name and the test name. bool UnitTestOptions::FilterMatchesTest(const std::string& test_suite_name, const std::string& test_name) { const std::string& full_name = test_suite_name + "." + test_name.c_str(); @@ -910,7 +903,8 @@ const char* String::Utf16ToAnsi(LPCWSTR utf16_str) { #endif // GTEST_OS_WINDOWS_MOBILE -// Compares two C strings. Returns true if they have the same content. +// Compares two C strings. Returns true if and only if they have the same +// content. // // Unlike strcmp(), this function can handle NULL argument(s). A NULL // C string is considered different to any non-NULL C string, @@ -1320,7 +1314,7 @@ std::vector<std::string> SplitEscapedString(const std::string& str) { // lhs_value: "5" // rhs_value: "6" // -// The ignoring_case parameter is true if the assertion is a +// The ignoring_case parameter is true if and only if the assertion is a // *_STRCASEEQ*. When it's true, the string "Ignoring case" will // be inserted into the message. AssertionResult EqFailure(const char* lhs_expression, @@ -1448,8 +1442,7 @@ namespace internal { // The helper function for {ASSERT|EXPECT}_EQ with int or enum // arguments. AssertionResult CmpHelperEQ(const char* lhs_expression, - const char* rhs_expression, - std::intmax_t lhs, + const char* rhs_expression, std::intmax_t lhs, std::intmax_t rhs) { if (lhs == rhs) { return AssertionSuccess(); @@ -1465,18 +1458,18 @@ AssertionResult CmpHelperEQ(const char* lhs_expression, // A macro for implementing the helper functions needed to implement // ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here // just to avoid copy-and-paste of similar code. -#define GTEST_IMPL_CMP_HELPER_(op_name, op)\ -AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ - std::intmax_t val1, std::intmax_t val2) {\ - if (val1 op val2) {\ - return AssertionSuccess();\ - } else {\ - return AssertionFailure() \ - << "Expected: (" << expr1 << ") " #op " (" << expr2\ - << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\ - << " vs " << FormatForComparisonFailureMessage(val2, val1);\ - }\ -} +#define GTEST_IMPL_CMP_HELPER_(op_name, op) \ + AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ + std::intmax_t val1, std::intmax_t val2) { \ + if (val1 op val2) { \ + return AssertionSuccess(); \ + } else { \ + return AssertionFailure() \ + << "Expected: (" << expr1 << ") " #op " (" << expr2 \ + << "), actual: " << FormatForComparisonFailureMessage(val1, val2) \ + << " vs " << FormatForComparisonFailureMessage(val2, val1); \ + } \ + } // Implements the helper function for {ASSERT|EXPECT}_NE with int or // enum arguments. @@ -1563,9 +1556,9 @@ namespace { // Helper functions for implementing IsSubString() and IsNotSubstring(). -// This group of overloaded functions return true if needle is a -// substring of haystack. NULL is considered a substring of itself -// only. +// This group of overloaded functions return true if and only if needle +// is a substring of haystack. NULL is considered a substring of +// itself only. bool IsSubstringPred(const char* needle, const char* haystack) { if (needle == nullptr || haystack == nullptr) return needle == haystack; @@ -1865,8 +1858,8 @@ std::string String::ShowWideCString(const wchar_t * wide_c_str) { return internal::WideStringToUtf8(wide_c_str, -1); } -// Compares two wide C strings. Returns true if they have the same -// content. +// Compares two wide C strings. Returns true if and only if they have the +// same content. // // Unlike wcscmp(), this function can handle NULL argument(s). A NULL // C string is considered different to any non-NULL C string, @@ -1910,7 +1903,7 @@ AssertionResult CmpHelperSTRNE(const char* s1_expression, << " vs " << PrintToString(s2); } -// Compares two C strings, ignoring case. Returns true if they have +// Compares two C strings, ignoring case. Returns true if and only if they have // the same content. // // Unlike strcasecmp(), this function can handle NULL argument(s). A @@ -1922,18 +1915,18 @@ bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) { return posix::StrCaseCmp(lhs, rhs) == 0; } - // Compares two wide C strings, ignoring case. Returns true if they - // have the same content. - // - // Unlike wcscasecmp(), this function can handle NULL argument(s). - // A NULL C string is considered different to any non-NULL wide C string, - // including the empty string. - // NB: The implementations on different platforms slightly differ. - // On windows, this method uses _wcsicmp which compares according to LC_CTYPE - // environment variable. On GNU platform this method uses wcscasecmp - // which compares according to LC_CTYPE category of the current locale. - // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the - // current locale. +// Compares two wide C strings, ignoring case. Returns true if and only if they +// have the same content. +// +// Unlike wcscasecmp(), this function can handle NULL argument(s). +// A NULL C string is considered different to any non-NULL wide C string, +// including the empty string. +// NB: The implementations on different platforms slightly differ. +// On windows, this method uses _wcsicmp which compares according to LC_CTYPE +// environment variable. On GNU platform this method uses wcscasecmp +// which compares according to LC_CTYPE category of the current locale. +// On MacOS X, it uses towlower, which also uses LC_CTYPE category of the +// current locale. bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, const wchar_t* rhs) { if (lhs == nullptr) return rhs == nullptr; @@ -1956,7 +1949,7 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, #endif // OS selector } -// Returns true if str ends with the given suffix, ignoring case. +// Returns true if and only if str ends with the given suffix, ignoring case. // Any string is considered to end with an empty suffix. bool String::EndsWithCaseInsensitive( const std::string& str, const std::string& suffix) { @@ -2198,12 +2191,12 @@ static bool TestPartSkipped(const TestPartResult& result) { return result.skipped(); } -// Returns true if the test was skipped. +// Returns true if and only if the test was skipped. bool TestResult::Skipped() const { return !Failed() && CountIf(test_part_results_, TestPartSkipped) > 0; } -// Returns true if the test failed. +// Returns true if and only if the test failed. bool TestResult::Failed() const { for (int i = 0; i < total_part_count(); ++i) { if (GetTestPartResult(i).failed()) @@ -2212,22 +2205,22 @@ bool TestResult::Failed() const { return false; } -// Returns true if the test part fatally failed. +// Returns true if and only if the test part fatally failed. static bool TestPartFatallyFailed(const TestPartResult& result) { return result.fatally_failed(); } -// Returns true if the test fatally failed. +// Returns true if and only if the test fatally failed. bool TestResult::HasFatalFailure() const { return CountIf(test_part_results_, TestPartFatallyFailed) > 0; } -// Returns true if the test part non-fatally failed. +// Returns true if and only if the test part non-fatally failed. static bool TestPartNonfatallyFailed(const TestPartResult& result) { return result.nonfatally_failed(); } -// Returns true if the test has a non-fatal failure. +// Returns true if and only if the test has a non-fatal failure. bool TestResult::HasNonfatalFailure() const { return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0; } @@ -2523,18 +2516,18 @@ void Test::Run() { this, &Test::TearDown, "TearDown()"); } -// Returns true if the current test has a fatal failure. +// Returns true if and only if the current test has a fatal failure. bool Test::HasFatalFailure() { return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure(); } -// Returns true if the current test has a non-fatal failure. +// Returns true if and only if the current test has a non-fatal failure. bool Test::HasNonfatalFailure() { return internal::GetUnitTestImpl()->current_test_result()-> HasNonfatalFailure(); } -// Returns true if the current test was skipped. +// Returns true if and only if the current test was skipped. bool Test::IsSkipped() { return internal::GetUnitTestImpl()->current_test_result()->Skipped(); } @@ -2633,7 +2626,7 @@ class TestNameIs { explicit TestNameIs(const char* name) : name_(name) {} - // Returns true if the test name of test_info matches name_. + // Returns true if and only if the test name of test_info matches name_. bool operator()(const TestInfo * test_info) const { return test_info && test_info->name() == name_; } @@ -2992,7 +2985,7 @@ static const char* GetAnsiColorCode(GTestColor color) { #endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE -// Returns true if Google Test should use colors in the output. +// Returns true if and only if Google Test should use colors in the output. bool ShouldUseColor(bool stdout_is_tty) { const char* const gtest_color = GTEST_FLAG(color).c_str(); @@ -3226,9 +3219,7 @@ void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) { void PrettyUnitTestResultPrinter::OnTestPartResult( const TestPartResult& result) { switch (result.type()) { - // If the test part succeeded, or was skipped, - // we don't need to do anything. - case TestPartResult::kSkip: + // If the test part succeeded, we don't need to do anything. case TestPartResult::kSuccess: return; default: @@ -4514,6 +4505,7 @@ class ScopedPrematureExitFile { } ~ScopedPrematureExitFile() { +#if !defined GTEST_OS_ESP8266 if (!premature_exit_filepath_.empty()) { int retval = remove(premature_exit_filepath_.c_str()); if (retval) { @@ -4522,6 +4514,7 @@ class ScopedPrematureExitFile { << retval; } } +#endif } private: @@ -4709,11 +4702,12 @@ internal::TimeInMillis UnitTest::elapsed_time() const { return impl()->elapsed_time(); } -// Returns true if the unit test passed (i.e. all test suites passed). +// Returns true if and only if the unit test passed (i.e. all test suites +// passed). bool UnitTest::Passed() const { return impl()->Passed(); } -// Returns true if the unit test failed (i.e. some test suite failed -// or something outside of all tests failed). +// Returns true if and only if the unit test failed (i.e. some test suite +// failed or something outside of all tests failed). bool UnitTest::Failed() const { return impl()->Failed(); } // Gets the i-th test suite among all the test suites. i can range from 0 to @@ -5161,7 +5155,7 @@ class TestSuiteNameIs { // Constructor. explicit TestSuiteNameIs(const std::string& name) : name_(name) {} - // Returns true if the name of test_suite matches name_. + // Returns true if and only if the name of test_suite matches name_. bool operator()(const TestSuite* test_suite) const { return test_suite != nullptr && strcmp(test_suite->name(), name_.c_str()) == 0; @@ -5232,7 +5226,8 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); } // All other functions called from RunAllTests() may safely assume that // parameterized tests are ready to be counted and run. bool UnitTestImpl::RunAllTests() { - // True if Google Test is initialized before RUN_ALL_TESTS() is called. + // True if and only if Google Test is initialized before RUN_ALL_TESTS() is + // called. const bool gtest_is_initialized_before_run_all_tests = GTestIsInitialized(); // Do not run any test if the --help flag was specified. @@ -5248,7 +5243,7 @@ bool UnitTestImpl::RunAllTests() { // protocol. internal::WriteToShardStatusFileIfNeeded(); - // True if we are in a subprocess for running a thread-safe-style + // True if and only if we are in a subprocess for running a thread-safe-style // death test. bool in_subprocess_for_death_test = false; @@ -5281,7 +5276,7 @@ bool UnitTestImpl::RunAllTests() { random_seed_ = GTEST_FLAG(shuffle) ? GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0; - // True if at least one test has failed. + // True if and only if at least one test has failed. bool failed = false; TestEventListener* repeater = listeners()->repeater(); @@ -5479,8 +5474,8 @@ Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) { } // Given the total number of shards, the shard index, and the test id, -// returns true if the test should be run on this shard. The test id is -// some arbitrary but unique non-negative integer assigned to each test +// returns true if and only if the test should be run on this shard. The test id +// is some arbitrary but unique non-negative integer assigned to each test // method. Assumes that 0 <= shard_index < total_shards. bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) { return (test_id % total_shards) == shard_index; @@ -6053,7 +6048,7 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { void ParseGoogleTestFlagsOnly(int* argc, char** argv) { ParseGoogleTestFlagsOnlyImpl(argc, argv); - // Fix the value of *_NSGetArgc() on macOS, but if + // Fix the value of *_NSGetArgc() on macOS, but if and only if // *_NSGetArgv() == argv // Only applicable to char** version of argv #if GTEST_OS_MAC diff --git a/googletest/src/gtest_main.cc b/googletest/src/gtest_main.cc index f6e1dd9..46b27c3 100644 --- a/googletest/src/gtest_main.cc +++ b/googletest/src/gtest_main.cc @@ -30,13 +30,20 @@ #include <cstdio> #include "gtest/gtest.h" -#ifdef ARDUINO +#if GTEST_OS_ESP8266 || GTEST_OS_ESP32 +#if GTEST_OS_ESP8266 +extern "C" { +#endif void setup() { testing::InitGoogleTest(); } void loop() { RUN_ALL_TESTS(); } +#if GTEST_OS_ESP8266 +} +#endif + #else GTEST_API_ int main(int argc, char **argv) { diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 156d5d4..224e6e6 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -296,6 +296,14 @@ cc_test( ) py_test( + name = "gtest_skip_check_output_test", + size = "small", + srcs = ["gtest_skip_check_output_test.py"], + data = [":gtest_skip_test"], + deps = [":gtest_test_utils"], +) + +py_test( name = "gtest_skip_environment_check_output_test", size = "small", srcs = ["gtest_skip_environment_check_output_test.py"], diff --git a/googletest/test/googletest-death-test-test.cc b/googletest/test/googletest-death-test-test.cc index 814d771..cba906c 100644 --- a/googletest/test/googletest-death-test-test.cc +++ b/googletest/test/googletest-death-test-test.cc @@ -141,7 +141,7 @@ class TestForDeathTest : public testing::Test { DieInside("MemberFunction"); } - // True if MemberFunction() should die. + // True if and only if MemberFunction() should die. bool should_die_; const FilePath original_dir_; }; @@ -158,7 +158,7 @@ class MayDie { } private: - // True if MemberFunction() should die. + // True if and only if MemberFunction() should die. bool should_die_; }; @@ -573,8 +573,8 @@ TEST_F(TestForDeathTest, ErrorMessageMismatch) { }, "died but not with expected error"); } -// On exit, *aborted will be true if the EXPECT_DEATH() statement -// aborted the function. +// On exit, *aborted will be true if and only if the EXPECT_DEATH() +// statement aborted the function. void ExpectDeathTestHelper(bool* aborted) { *aborted = true; EXPECT_DEATH(DieIf(false), "DieIf"); // This assertion should fail. diff --git a/googletest/test/googletest-output-test-golden-lin.txt b/googletest/test/googletest-output-test-golden-lin.txt index 038de92..270b15a 100644 --- a/googletest/test/googletest-output-test-golden-lin.txt +++ b/googletest/test/googletest-output-test-golden-lin.txt @@ -12,7 +12,7 @@ Expected equality of these values: 3 Stack trace: (omitted) -[0;32m[==========] [mRunning 85 tests from 40 test suites. +[0;32m[==========] [mRunning 84 tests from 39 test suites. [0;32m[----------] [mGlobal test environment set-up. FooEnvironment::SetUp() called. BarEnvironment::SetUp() called. @@ -966,9 +966,6 @@ Expected equality of these values: Stack trace: (omitted) [0;31m[ FAILED ] [mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2 -[0;32m[----------] [m1 test from EmptyBasenameParamInst -[0;32m[ RUN ] [mEmptyBasenameParamInst.Passes/0 -[0;32m[ OK ] [mEmptyBasenameParamInst.Passes/0 [0;32m[----------] [m2 tests from PrintingStrings/ParamTest [0;32m[ RUN ] [mPrintingStrings/ParamTest.Success/a [0;32m[ OK ] [mPrintingStrings/ParamTest.Success/a @@ -995,8 +992,8 @@ Failed Expected fatal failure. Stack trace: (omitted) -[0;32m[==========] [m85 tests from 40 test suites ran. -[0;32m[ PASSED ] [m31 tests. +[0;32m[==========] [m84 tests from 39 test suites ran. +[0;32m[ PASSED ] [m30 tests. [0;31m[ FAILED ] [m54 tests, listed below: [0;31m[ FAILED ] [mNonfatalFailureTest.EscapesStringOperands [0;31m[ FAILED ] [mNonfatalFailureTest.DiffForLongStrings diff --git a/googletest/test/googletest-output-test_.cc b/googletest/test/googletest-output-test_.cc index 4f716d8..f724cca 100644 --- a/googletest/test/googletest-output-test_.cc +++ b/googletest/test/googletest-output-test_.cc @@ -96,14 +96,6 @@ INSTANTIATE_TEST_SUITE_P(PrintingFailingParams, FailingParamTest, testing::Values(2)); -// Tests that an empty value for the test suite basename yields just -// the test name without any prior / -class EmptyBasenameParamInst : public testing::TestWithParam<int> {}; - -TEST_P(EmptyBasenameParamInst, Passes) { EXPECT_EQ(1, GetParam()); } - -INSTANTIATE_TEST_SUITE_P(, EmptyBasenameParamInst, testing::Values(1)); - static const char kGoldenString[] = "\"Line\0 1\"\nLine 2"; TEST(NonfatalFailureTest, EscapesStringOperands) { diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc index 6c187df..2740aaa 100644 --- a/googletest/test/googletest-param-test-test.cc +++ b/googletest/test/googletest-param-test-test.cc @@ -37,6 +37,7 @@ # include <algorithm> # include <iostream> # include <list> +# include <set> # include <sstream> # include <string> # include <vector> @@ -802,7 +803,7 @@ TEST_P(PREFIX_WITH_MACRO(NamingTest), PREFIX_WITH_FOO(SomeTestName)) { ::testing::UnitTest::GetInstance()->current_test_info(); EXPECT_STREQ("FortyTwo/MacroNamingTest", test_info->test_suite_name()); - EXPECT_STREQ("FooSomeTestName", test_info->name()); + EXPECT_STREQ("FooSomeTestName/0", test_info->name()); } INSTANTIATE_TEST_SUITE_P(FortyTwo, MacroNamingTest, Values(42)); @@ -819,6 +820,36 @@ TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized), EXPECT_STREQ("FooSomeTestName", test_info->name()); } +TEST(MacroNameing, LookupNames) { + std::set<std::string> know_suite_names, know_test_names; + + auto ins = testing::UnitTest::GetInstance(); + int ts = 0; + while (const testing::TestSuite* suite = ins->GetTestSuite(ts++)) { + know_suite_names.insert(suite->name()); + + int ti = 0; + while (const testing::TestInfo* info = suite->GetTestInfo(ti++)) { + know_test_names.insert(std::string(suite->name()) + "." + info->name()); + } + } + + // Check that the expected form of the test suit name actualy exists. + EXPECT_NE( // + know_suite_names.find("FortyTwo/MacroNamingTest"), + know_suite_names.end()); + EXPECT_NE( + know_suite_names.find("MacroNamingTestNonParametrized"), + know_suite_names.end()); + // Check that the expected form of the test name actualy exists. + EXPECT_NE( // + know_test_names.find("FortyTwo/MacroNamingTest.FooSomeTestName/0"), + know_test_names.end()); + EXPECT_NE( + know_test_names.find("MacroNamingTestNonParametrized.FooSomeTestName"), + know_test_names.end()); +} + // Tests that user supplied custom parameter names are working correctly. // Runs the test with a builtin helper method which uses PrintToString, // as well as a custom function and custom functor to ensure all possible diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc index 06eedbd..cebd6ac 100644 --- a/googletest/test/googletest-printers-test.cc +++ b/googletest/test/googletest-printers-test.cc @@ -86,7 +86,9 @@ void PrintTo(EnumWithPrintTo e, std::ostream* os) { // A class implicitly convertible to std::intmax_t. class IntMaxConvertible { public: - constexpr operator std::intmax_t() const { return 42; } + constexpr operator std::intmax_t() const { // NOLINT(runtime/explicit) + return 42; + } }; // A user-defined unprintable class template in the global namespace. @@ -219,7 +221,6 @@ using ::testing::PrintToString; using ::testing::internal::FormatForComparisonFailureMessage; using ::testing::internal::ImplicitCast_; using ::testing::internal::NativeArray; -using ::testing::internal::RE; using ::testing::internal::RelationToSourceReference; using ::testing::internal::Strings; using ::testing::internal::UniversalPrint; @@ -526,10 +527,9 @@ TEST(PrintPointerTest, NonMemberFunctionPointer) { // standard disallows casting between pointers to functions and // pointers to objects, and some compilers (e.g. GCC 3.4) enforce // this limitation. - EXPECT_EQ( - PrintPointer(reinterpret_cast<const void*>( - reinterpret_cast<std::intptr_t>(&MyFunction))), - Print(&MyFunction)); + EXPECT_EQ(PrintPointer(reinterpret_cast<const void*>( + reinterpret_cast<std::intptr_t>(&MyFunction))), + Print(&MyFunction)); int (*p)(bool) = NULL; // NOLINT EXPECT_EQ("NULL", Print(p)); } @@ -1121,8 +1121,8 @@ TEST(PrintReferenceTest, HandlesFunctionPointer) { // standard disallows casting between pointers to functions and // pointers to objects, and some compilers (e.g. GCC 3.4) enforce // this limitation. - const std::string fp_string = PrintPointer(reinterpret_cast<const void*>( - reinterpret_cast<std::intptr_t>(fp))); + const std::string fp_string = PrintPointer( + reinterpret_cast<const void*>(reinterpret_cast<std::intptr_t>(fp))); EXPECT_EQ("@" + fp_pointer_string + " " + fp_string, PrintByRef(fp)); } diff --git a/googletest/test/googletest-throw-on-failure-test.py b/googletest/test/googletest-throw-on-failure-test.py index a38cd33..ea627c4 100755 --- a/googletest/test/googletest-throw-on-failure-test.py +++ b/googletest/test/googletest-throw-on-failure-test.py @@ -86,7 +86,7 @@ class ThrowOnFailureTest(gtest_test_utils.TestCase): variable; None if the variable should be unset. flag_value: value of the --gtest_break_on_failure flag; None if the flag should not be present. - should_fail: True if the program is expected to fail. + should_fail: True if and only if the program is expected to fail. """ SetEnvVar(THROW_ON_FAILURE, env_var_value) diff --git a/googletest/test/gtest-unittest-api_test.cc b/googletest/test/gtest-unittest-api_test.cc index 480a41f..7d2d8cc 100644 --- a/googletest/test/gtest-unittest-api_test.cc +++ b/googletest/test/gtest-unittest-api_test.cc @@ -188,7 +188,7 @@ TEST(ApiTest, TestSuiteImmutableAccessorsWork) { ASSERT_TRUE(test_suite != nullptr); EXPECT_STREQ("TestSuiteWithCommentTest/0", test_suite->name()); - EXPECT_STREQ(GetTypeName<int>().c_str(), test_suite->type_param()); + EXPECT_STREQ(GetTypeName<Types<int>>().c_str(), test_suite->type_param()); EXPECT_TRUE(test_suite->should_run()); EXPECT_EQ(0, test_suite->disabled_test_count()); EXPECT_EQ(1, test_suite->test_to_run_count()); @@ -199,7 +199,7 @@ TEST(ApiTest, TestSuiteImmutableAccessorsWork) { EXPECT_STREQ("Dummy", tests[0]->name()); EXPECT_STREQ("TestSuiteWithCommentTest/0", tests[0]->test_suite_name()); EXPECT_TRUE(IsNull(tests[0]->value_param())); - EXPECT_STREQ(GetTypeName<int>().c_str(), tests[0]->type_param()); + EXPECT_STREQ(GetTypeName<Types<int>>().c_str(), tests[0]->type_param()); EXPECT_TRUE(tests[0]->should_run()); delete[] tests; @@ -265,7 +265,8 @@ class FinalSuccessChecker : public Environment { #if GTEST_HAS_TYPED_TEST EXPECT_STREQ("TestSuiteWithCommentTest/0", test_suites[2]->name()); - EXPECT_STREQ(GetTypeName<int>().c_str(), test_suites[2]->type_param()); + EXPECT_STREQ(GetTypeName<Types<int>>().c_str(), + test_suites[2]->type_param()); EXPECT_TRUE(test_suites[2]->should_run()); EXPECT_EQ(0, test_suites[2]->disabled_test_count()); ASSERT_EQ(1, test_suites[2]->total_test_count()); @@ -317,7 +318,7 @@ class FinalSuccessChecker : public Environment { EXPECT_STREQ("Dummy", tests[0]->name()); EXPECT_STREQ("TestSuiteWithCommentTest/0", tests[0]->test_suite_name()); EXPECT_TRUE(IsNull(tests[0]->value_param())); - EXPECT_STREQ(GetTypeName<int>().c_str(), tests[0]->type_param()); + EXPECT_STREQ(GetTypeName<Types<int>>().c_str(), tests[0]->type_param()); EXPECT_TRUE(tests[0]->should_run()); EXPECT_TRUE(tests[0]->result()->Passed()); EXPECT_EQ(0, tests[0]->result()->test_property_count()); diff --git a/googletest/test/gtest_environment_test.cc b/googletest/test/gtest_environment_test.cc index 58908e6..064bfc5 100644 --- a/googletest/test/gtest_environment_test.cc +++ b/googletest/test/gtest_environment_test.cc @@ -116,7 +116,7 @@ void Check(bool condition, const char* msg) { } } -// Runs the tests. Return true if successful. +// Runs the tests. Return true if and only if successful. // // The 'failure' parameter specifies the type of failure that should // be generated by the global set-up. diff --git a/googletest/test/gtest_pred_impl_unittest.cc b/googletest/test/gtest_pred_impl_unittest.cc index 4d77896..1afe5e2 100644 --- a/googletest/test/gtest_pred_impl_unittest.cc +++ b/googletest/test/gtest_pred_impl_unittest.cc @@ -144,10 +144,10 @@ class Predicate1Test : public testing::Test { } } - // true if 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 if the test function did run to finish. + // true if and only if the test function did run to finish. static bool finished_; static int n1_; @@ -539,10 +539,10 @@ class Predicate2Test : public testing::Test { } } - // true if 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 if the test function did run to finish. + // true if and only if the test function did run to finish. static bool finished_; static int n1_; @@ -976,10 +976,10 @@ class Predicate3Test : public testing::Test { } } - // true if 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 if the test function did run to finish. + // true if and only if the test function did run to finish. static bool finished_; static int n1_; @@ -1455,10 +1455,10 @@ class Predicate4Test : public testing::Test { } } - // true if 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 if the test function did run to finish. + // true if and only if the test function did run to finish. static bool finished_; static int n1_; @@ -1976,10 +1976,10 @@ class Predicate5Test : public testing::Test { } } - // true if 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 if the test function did run to finish. + // true if and only if the test function did run to finish. static bool finished_; static int n1_; diff --git a/googletest/test/gtest_premature_exit_test.cc b/googletest/test/gtest_premature_exit_test.cc index 777a8bf..1d1187e 100644 --- a/googletest/test/gtest_premature_exit_test.cc +++ b/googletest/test/gtest_premature_exit_test.cc @@ -45,7 +45,7 @@ namespace { class PrematureExitTest : public Test { public: - // Returns true if the given file exists. + // Returns true if and only if the given file exists. static bool FileExists(const char* filepath) { StatStruct stat; return Stat(filepath, &stat) == 0; @@ -61,7 +61,7 @@ class PrematureExitTest : public Test { } } - // Returns true if the premature-exit file exists. + // Returns true if and only if the premature-exit file exists. bool PrematureExitFileExists() const { return FileExists(premature_exit_file_path_); } diff --git a/googlemock/scripts/upload_gmock.py b/googletest/test/gtest_skip_check_output_test.py index 5dc484b..14e63ab 100755 --- a/googlemock/scripts/upload_gmock.py +++ b/googletest/test/gtest_skip_check_output_test.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -# Copyright 2009, Google Inc. -# All rights reserved. +# Copyright 2019 Google LLC. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -28,51 +27,33 @@ # 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. +"""Tests Google Test's gtest skip in environment setup behavior. -"""upload_gmock.py v0.1.0 -- uploads a Google Mock patch for review. - -This simple wrapper passes all command line flags and ---cc=googlemock@googlegroups.com to upload.py. - -USAGE: upload_gmock.py [options for upload.py] +This script invokes gtest_skip_in_environment_setup_test_ and verifies its +output. """ -__author__ = 'wan@google.com (Zhanyong Wan)' - -import os -import sys +import re -CC_FLAG = '--cc=' -GMOCK_GROUP = 'googlemock@googlegroups.com' +import gtest_test_utils +# Path to the gtest_skip_in_environment_setup_test binary +EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_skip_test') -def main(): - # Finds the path to upload.py, assuming it is in the same directory - # as this file. - my_dir = os.path.dirname(os.path.abspath(__file__)) - upload_py_path = os.path.join(my_dir, 'upload.py') +OUTPUT = gtest_test_utils.Subprocess([EXE_PATH]).output - # Adds Google Mock discussion group to the cc line if it's not there - # already. - upload_py_argv = [upload_py_path] - found_cc_flag = False - for arg in sys.argv[1:]: - if arg.startswith(CC_FLAG): - found_cc_flag = True - cc_line = arg[len(CC_FLAG):] - cc_list = [addr for addr in cc_line.split(',') if addr] - if GMOCK_GROUP not in cc_list: - cc_list.append(GMOCK_GROUP) - upload_py_argv.append(CC_FLAG + ','.join(cc_list)) - else: - upload_py_argv.append(arg) - if not found_cc_flag: - upload_py_argv.append(CC_FLAG + GMOCK_GROUP) +# Test. +class SkipEntireEnvironmentTest(gtest_test_utils.TestCase): - # Invokes upload.py with the modified command line flags. - os.execv(upload_py_path, upload_py_argv) + def testSkipEntireEnvironmentTest(self): + self.assertIn('Skipped\nskipping single test\n', OUTPUT) + skip_fixture = 'Skipped\nskipping all tests for this fixture\n' + self.assertIsNotNone( + re.search(skip_fixture + '.*' + skip_fixture, OUTPUT, flags=re.DOTALL), + repr(OUTPUT)) + self.assertNotIn('FAILED', OUTPUT) if __name__ == '__main__': - main() + gtest_test_utils.Main() diff --git a/googletest/test/gtest_skip_test.cc b/googletest/test/gtest_skip_test.cc index 717e105..4a23004 100644 --- a/googletest/test/gtest_skip_test.cc +++ b/googletest/test/gtest_skip_test.cc @@ -35,7 +35,7 @@ using ::testing::Test; TEST(SkipTest, DoesSkip) { - GTEST_SKIP(); + GTEST_SKIP() << "skipping single test"; EXPECT_EQ(0, 1); } diff --git a/googletest/test/gtest_test_utils.py b/googletest/test/gtest_test_utils.py index abd56ec..ef9363c 100755 --- a/googletest/test/gtest_test_utils.py +++ b/googletest/test/gtest_test_utils.py @@ -215,10 +215,11 @@ class Subprocess: Returns: An object that represents outcome of the executed process. It has the following attributes: - terminated_by_signal True if the child process has been terminated - by a signal. + terminated_by_signal True if and only if the child process has been + terminated by a signal. signal Sygnal that terminated the child process. - exited True if the child process exited normally. + exited True if and only if the child process exited + normally. exit_code The code with which the child process exited. output Child process's stdout and stderr output combined in a string. diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index d90fee9..ae8834d 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -233,7 +233,6 @@ using testing::internal::AppendUserMessage; using testing::internal::ArrayAwareFind; using testing::internal::ArrayEq; using testing::internal::CodePointToUtf8; -using testing::internal::CompileAssertTypesEqual; using testing::internal::CopyArray; using testing::internal::CountIf; using testing::internal::EqFailure; @@ -2168,12 +2167,12 @@ static Environment* record_property_env GTEST_ATTRIBUTE_UNUSED_ = // First, some predicates and predicate-formatters needed by the tests. -// Returns true if the argument is an even number. +// Returns true if and only if the argument is an even number. bool IsEven(int n) { return (n % 2) == 0; } -// A functor that returns true if the argument is an even number. +// A functor that returns true if and only if the argument is an even number. struct IsEvenFunctor { bool operator()(int n) { return IsEven(n); } }; @@ -2217,13 +2216,13 @@ struct AssertIsEvenFunctor { } }; -// Returns true if the sum of the arguments is an even number. +// Returns true if and only if the sum of the arguments is an even number. bool SumIsEven2(int n1, int n2) { return IsEven(n1 + n2); } -// A functor that returns true if the sum of the arguments is an even -// number. +// A functor that returns true if and only if the sum of the arguments is an +// even number. struct SumIsEven3Functor { bool operator()(int n1, int n2, int n3) { return IsEven(n1 + n2 + n3); @@ -3953,11 +3952,11 @@ enum { // On Linux, kCaseB and kCaseA have the same value when truncated to // int size. We want to test whether this will confuse the // assertions. - kCaseB = std::numeric_limits<std::intmax_t>::max(), + kCaseB = (std::numeric_limits<std::intmax_t>::max)(), # else - kCaseB = std::numeric_limits<int>::max(), + kCaseB = (std::numeric_limits<int>::max)(), # endif // GTEST_OS_LINUX @@ -5344,7 +5343,7 @@ TEST_P(CodeLocationForTESTP, Verify) { VERIFY_CODE_LOCATION; } -INSTANTIATE_TEST_SUITE_P(, CodeLocationForTESTP, Values(0)); +INSTANTIATE_TEST_SUITE_P(All, CodeLocationForTESTP, Values(0)); template <typename T> class CodeLocationForTYPEDTEST : public Test { @@ -6171,7 +6170,7 @@ TEST_F(ParseFlagsTest, WideStrings) { #if GTEST_USE_OWN_FLAGFILE_FLAG_ class FlagfileTest : public ParseFlagsTest { public: - virtual void SetUp() { + void SetUp() override { ParseFlagsTest::SetUp(); testdata_path_.Set(internal::FilePath( @@ -6181,7 +6180,7 @@ class FlagfileTest : public ParseFlagsTest { EXPECT_TRUE(testdata_path_.CreateFolder()); } - virtual void TearDown() { + void TearDown() override { testing::internal::posix::RmDir(testdata_path_.c_str()); ParseFlagsTest::TearDown(); } @@ -7102,18 +7101,12 @@ TEST(IsAProtocolMessageTest, ValueIsFalseWhenTypeIsNotAProtocolMessage) { EXPECT_FALSE(IsAProtocolMessage<const ConversionHelperBase>::value); } -// Tests that CompileAssertTypesEqual compiles when the type arguments are -// equal. -TEST(CompileAssertTypesEqual, CompilesWhenTypesAreEqual) { - CompileAssertTypesEqual<void, void>(); - CompileAssertTypesEqual<int*, int*>(); -} - // Tests GTEST_REMOVE_REFERENCE_AND_CONST_. template <typename T1, typename T2> void TestGTestRemoveReferenceAndConst() { - CompileAssertTypesEqual<T1, GTEST_REMOVE_REFERENCE_AND_CONST_(T2)>(); + static_assert(std::is_same<T1, GTEST_REMOVE_REFERENCE_AND_CONST_(T2)>::value, + "GTEST_REMOVE_REFERENCE_AND_CONST_ failed."); } TEST(RemoveReferenceToConstTest, Works) { @@ -7128,7 +7121,8 @@ TEST(RemoveReferenceToConstTest, Works) { template <typename T1, typename T2> void TestGTestReferenceToConst() { - CompileAssertTypesEqual<T1, GTEST_REFERENCE_TO_CONST_(T2)>(); + static_assert(std::is_same<T1, GTEST_REFERENCE_TO_CONST_(T2)>::value, + "GTEST_REFERENCE_TO_CONST_ failed."); } TEST(GTestReferenceToConstTest, Works) { @@ -7359,20 +7353,15 @@ TEST(IndexSequence, MakeIndexSequence) { // ElemFromList TEST(ElemFromList, Basic) { using testing::internal::ElemFromList; - using Idx = testing::internal::MakeIndexSequence<3>::type; - EXPECT_TRUE(( - std::is_same<int, ElemFromList<0, Idx, int, double, char>::type>::value)); EXPECT_TRUE( - (std::is_same<double, - ElemFromList<1, Idx, int, double, char>::type>::value)); + (std::is_same<int, ElemFromList<0, int, double, char>::type>::value)); EXPECT_TRUE( - (std::is_same<char, - ElemFromList<2, Idx, int, double, char>::type>::value)); + (std::is_same<double, ElemFromList<1, int, double, char>::type>::value)); EXPECT_TRUE( - (std::is_same< - char, ElemFromList<7, testing::internal::MakeIndexSequence<12>::type, - int, int, int, int, int, int, int, char, int, int, - int, int>::type>::value)); + (std::is_same<char, ElemFromList<2, int, double, char>::type>::value)); + EXPECT_TRUE(( + std::is_same<char, ElemFromList<7, int, int, int, int, int, int, int, + char, int, int, int, int>::type>::value)); } // FlatTuple diff --git a/library.json b/library.json index e46fcbd..91169b7 100644 --- a/library.json +++ b/library.json @@ -8,10 +8,11 @@ "type": "git", "url": "https://github.com/google/googletest.git" }, - "version": "1.8.1", + "version": "1.10.0", "frameworks": "arduino", "platforms": [ - "espressif32" + "espressif32", + "espressif8266" ], "export": { "include": [ @@ -22,30 +23,18 @@ ], "exclude": [ "ci", - "googlemock/build-aux", "googlemock/cmake", - "googlemock/make", - "googlemock/msvc", "googlemock/scripts", "googlemock/src/gmock-all.cc", "googlemock/src/gmock_main.cc", "googlemock/test", "googlemock/CMakeLists.txt", - "googlemock/Makefile.am", - "googlemock/configure.ac", "googletest/cmake", - "googletest/codegear", - "googletest/m4", - "googletest/make", - "googletest/msvc", "googletest/scripts", "googletest/src/gtest-all.cc", "googletest/src/gtest_main.cc", "googletest/test", - "googletest/xcode", - "googletest/CMakeLists.txt", - "googletest/Makefile.am", - "googletest/configure.ac" + "googletest/CMakeLists.txt" ] }, "build": { @@ -54,6 +43,24 @@ "-Igooglemock", "-Igoogletest/include", "-Igoogletest" + ], + "srcFilter": [ + "+<*>", + "-<.git/>", + "-<googlemock>", + "-<googlemock/test/>", + "-<googlemock/src>", + "+<googlemock/src/gmock-all.cc>", + "+<googletest/src/gtest-all.cc>", + "+<googlemock/src/gmock_main.cc>", + "-<googletest>", + "-<googletest/codegear/>", + "-<googletest/samples>", + "-<googletest/test/>", + "-<googletest/xcode>", + "-<googletest/src>", + "+<googletest/src/gtest-all.cc>", + "+<googletest/src/gtest_main.cc>" ] } } diff --git a/platformio.ini b/platformio.ini index 3910026..7be1f7d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -19,7 +19,7 @@ platform = espressif32 board = esp32dev framework = arduino build_flags = -I./googletest/include -I./googletest -src_filter = +<*> -<.git/> -<googlemock> -<googletest/codegear/> -<googletest/samples> -<googletest/test/> -<googletest/xcode> -<googletest/src> +<googletest/src/gtest-all.cc> +<googletest/src/gtest_main.cc> +src_filter = +<*> -<.git/> -<googlemock> -<googletest/samples> -<googletest/test/> -<googletest/src> +<googletest/src/gtest-all.cc> +<googletest/src/gtest_main.cc> upload_speed = 921600 [env:googlemock_esp32] @@ -27,5 +27,21 @@ platform = espressif32 board = esp32dev framework = arduino build_flags = -I./googlemock/include -I./googletest/include -I./googletest -I./googlemock -src_filter = +<*> -<.git/> -<googletest> -<googlemock/test/> -<googlemock/src> +<googlemock/src/gmock-all.cc> +<googlemock/src/gmock_main.cc> +<googletest/src/gtest-all.cc> +src_filter = +<*> -<.git/> -<googletest> -<googlemock/test/> -<googlemock/src> +<googlemock/src/gmock-all.cc> +<googletest/src/gtest-all.cc> +<googlemock/src/gmock_main.cc> upload_speed = 921600 + +[env:googletest_esp8266] +platform = espressif8266 +board = huzzah +framework = arduino +build_flags = -I./googletest/include -I./googletest +src_filter = +<*> -<.git/> -<googlemock> -<googletest/codegear/> -<googletest/samples> -<googletest/test/> -<googletest/xcode> -<googletest/src> +<googletest/src/gtest-all.cc> +<googletest/src/gtest_main.cc> +upload_speed = 921600 + +[env:googlemock_esp8266] +platform = espressif8266 +board = huzzah +framework = arduino +build_flags = -I./googlemock/include -I./googletest/include -I./googletest -I./googlemock +src_filter = +<*> -<.git/> -<googletest> -<googlemock/test/> -<googlemock/src> +<googlemock/src/gmock-all.cc> +<googletest/src/gtest-all.cc> +<googlemock/src/gmock_main.cc> +upload_speed = 921600
\ No newline at end of file |