gmock-generated-nice-strict.h
Go to the documentation of this file.
00001 // This file was GENERATED by command:
00002 //     pump.py gmock-generated-nice-strict.h.pump
00003 // DO NOT EDIT BY HAND!!!
00004 
00005 // Copyright 2008, Google Inc.
00006 // All rights reserved.
00007 //
00008 // Redistribution and use in source and binary forms, with or without
00009 // modification, are permitted provided that the following conditions are
00010 // met:
00011 //
00012 //     * Redistributions of source code must retain the above copyright
00013 // notice, this list of conditions and the following disclaimer.
00014 //     * Redistributions in binary form must reproduce the above
00015 // copyright notice, this list of conditions and the following disclaimer
00016 // in the documentation and/or other materials provided with the
00017 // distribution.
00018 //     * Neither the name of Google Inc. nor the names of its
00019 // contributors may be used to endorse or promote products derived from
00020 // this software without specific prior written permission.
00021 //
00022 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00028 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00030 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 //
00034 // Author: wan@google.com (Zhanyong Wan)
00035 
00036 // Implements class templates NiceMock, NaggyMock, and StrictMock.
00037 //
00038 // Given a mock class MockFoo that is created using Google Mock,
00039 // NiceMock<MockFoo> is a subclass of MockFoo that allows
00040 // uninteresting calls (i.e. calls to mock methods that have no
00041 // EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo
00042 // that prints a warning when an uninteresting call occurs, and
00043 // StrictMock<MockFoo> is a subclass of MockFoo that treats all
00044 // uninteresting calls as errors.
00045 //
00046 // Currently a mock is naggy by default, so MockFoo and
00047 // NaggyMock<MockFoo> behave like the same.  However, we will soon
00048 // switch the default behavior of mocks to be nice, as that in general
00049 // leads to more maintainable tests.  When that happens, MockFoo will
00050 // stop behaving like NaggyMock<MockFoo> and start behaving like
00051 // NiceMock<MockFoo>.
00052 //
00053 // NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
00054 // their respective base class, with up-to 10 arguments.  Therefore
00055 // you can write NiceMock<MockFoo>(5, "a") to construct a nice mock
00056 // where MockFoo has a constructor that accepts (int, const char*),
00057 // for example.
00058 //
00059 // A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
00060 // and StrictMock<MockFoo> only works for mock methods defined using
00061 // the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.
00062 // If a mock method is defined in a base class of MockFoo, the "nice"
00063 // or "strict" modifier may not affect it, depending on the compiler.
00064 // In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
00065 // supported.
00066 //
00067 // Another known limitation is that the constructors of the base mock
00068 // cannot have arguments passed by non-const reference, which are
00069 // banned by the Google C++ style guide anyway.
00070 
00071 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
00072 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
00073 
00074 #include "gmock/gmock-spec-builders.h"
00075 #include "gmock/internal/gmock-port.h"
00076 
00077 namespace testing {
00078 
00079 template <class MockClass>
00080 class NiceMock : public MockClass {
00081  public:
00082   // We don't factor out the constructor body to a common method, as
00083   // we have to avoid a possible clash with members of MockClass.
00084   NiceMock() {
00085     ::testing::Mock::AllowUninterestingCalls(
00086         internal::ImplicitCast_<MockClass*>(this));
00087   }
00088 
00089   // C++ doesn't (yet) allow inheritance of constructors, so we have
00090   // to define it for each arity.
00091   template <typename A1>
00092   explicit NiceMock(const A1& a1) : MockClass(a1) {
00093     ::testing::Mock::AllowUninterestingCalls(
00094         internal::ImplicitCast_<MockClass*>(this));
00095   }
00096   template <typename A1, typename A2>
00097   NiceMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
00098     ::testing::Mock::AllowUninterestingCalls(
00099         internal::ImplicitCast_<MockClass*>(this));
00100   }
00101 
00102   template <typename A1, typename A2, typename A3>
00103   NiceMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
00104     ::testing::Mock::AllowUninterestingCalls(
00105         internal::ImplicitCast_<MockClass*>(this));
00106   }
00107 
00108   template <typename A1, typename A2, typename A3, typename A4>
00109   NiceMock(const A1& a1, const A2& a2, const A3& a3,
00110       const A4& a4) : MockClass(a1, a2, a3, a4) {
00111     ::testing::Mock::AllowUninterestingCalls(
00112         internal::ImplicitCast_<MockClass*>(this));
00113   }
00114 
00115   template <typename A1, typename A2, typename A3, typename A4, typename A5>
00116   NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00117       const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
00118     ::testing::Mock::AllowUninterestingCalls(
00119         internal::ImplicitCast_<MockClass*>(this));
00120   }
00121 
00122   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00123       typename A6>
00124   NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00125       const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
00126     ::testing::Mock::AllowUninterestingCalls(
00127         internal::ImplicitCast_<MockClass*>(this));
00128   }
00129 
00130   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00131       typename A6, typename A7>
00132   NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00133       const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
00134       a6, a7) {
00135     ::testing::Mock::AllowUninterestingCalls(
00136         internal::ImplicitCast_<MockClass*>(this));
00137   }
00138 
00139   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00140       typename A6, typename A7, typename A8>
00141   NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00142       const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
00143       a2, a3, a4, a5, a6, a7, a8) {
00144     ::testing::Mock::AllowUninterestingCalls(
00145         internal::ImplicitCast_<MockClass*>(this));
00146   }
00147 
00148   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00149       typename A6, typename A7, typename A8, typename A9>
00150   NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00151       const A5& a5, const A6& a6, const A7& a7, const A8& a8,
00152       const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
00153     ::testing::Mock::AllowUninterestingCalls(
00154         internal::ImplicitCast_<MockClass*>(this));
00155   }
00156 
00157   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00158       typename A6, typename A7, typename A8, typename A9, typename A10>
00159   NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00160       const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
00161       const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
00162     ::testing::Mock::AllowUninterestingCalls(
00163         internal::ImplicitCast_<MockClass*>(this));
00164   }
00165 
00166   virtual ~NiceMock() {
00167     ::testing::Mock::UnregisterCallReaction(
00168         internal::ImplicitCast_<MockClass*>(this));
00169   }
00170 
00171  private:
00172   GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock);
00173 };
00174 
00175 template <class MockClass>
00176 class NaggyMock : public MockClass {
00177  public:
00178   // We don't factor out the constructor body to a common method, as
00179   // we have to avoid a possible clash with members of MockClass.
00180   NaggyMock() {
00181     ::testing::Mock::WarnUninterestingCalls(
00182         internal::ImplicitCast_<MockClass*>(this));
00183   }
00184 
00185   // C++ doesn't (yet) allow inheritance of constructors, so we have
00186   // to define it for each arity.
00187   template <typename A1>
00188   explicit NaggyMock(const A1& a1) : MockClass(a1) {
00189     ::testing::Mock::WarnUninterestingCalls(
00190         internal::ImplicitCast_<MockClass*>(this));
00191   }
00192   template <typename A1, typename A2>
00193   NaggyMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
00194     ::testing::Mock::WarnUninterestingCalls(
00195         internal::ImplicitCast_<MockClass*>(this));
00196   }
00197 
00198   template <typename A1, typename A2, typename A3>
00199   NaggyMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
00200     ::testing::Mock::WarnUninterestingCalls(
00201         internal::ImplicitCast_<MockClass*>(this));
00202   }
00203 
00204   template <typename A1, typename A2, typename A3, typename A4>
00205   NaggyMock(const A1& a1, const A2& a2, const A3& a3,
00206       const A4& a4) : MockClass(a1, a2, a3, a4) {
00207     ::testing::Mock::WarnUninterestingCalls(
00208         internal::ImplicitCast_<MockClass*>(this));
00209   }
00210 
00211   template <typename A1, typename A2, typename A3, typename A4, typename A5>
00212   NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00213       const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
00214     ::testing::Mock::WarnUninterestingCalls(
00215         internal::ImplicitCast_<MockClass*>(this));
00216   }
00217 
00218   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00219       typename A6>
00220   NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00221       const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
00222     ::testing::Mock::WarnUninterestingCalls(
00223         internal::ImplicitCast_<MockClass*>(this));
00224   }
00225 
00226   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00227       typename A6, typename A7>
00228   NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00229       const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
00230       a6, a7) {
00231     ::testing::Mock::WarnUninterestingCalls(
00232         internal::ImplicitCast_<MockClass*>(this));
00233   }
00234 
00235   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00236       typename A6, typename A7, typename A8>
00237   NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00238       const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
00239       a2, a3, a4, a5, a6, a7, a8) {
00240     ::testing::Mock::WarnUninterestingCalls(
00241         internal::ImplicitCast_<MockClass*>(this));
00242   }
00243 
00244   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00245       typename A6, typename A7, typename A8, typename A9>
00246   NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00247       const A5& a5, const A6& a6, const A7& a7, const A8& a8,
00248       const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
00249     ::testing::Mock::WarnUninterestingCalls(
00250         internal::ImplicitCast_<MockClass*>(this));
00251   }
00252 
00253   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00254       typename A6, typename A7, typename A8, typename A9, typename A10>
00255   NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00256       const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
00257       const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
00258     ::testing::Mock::WarnUninterestingCalls(
00259         internal::ImplicitCast_<MockClass*>(this));
00260   }
00261 
00262   virtual ~NaggyMock() {
00263     ::testing::Mock::UnregisterCallReaction(
00264         internal::ImplicitCast_<MockClass*>(this));
00265   }
00266 
00267  private:
00268   GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock);
00269 };
00270 
00271 template <class MockClass>
00272 class StrictMock : public MockClass {
00273  public:
00274   // We don't factor out the constructor body to a common method, as
00275   // we have to avoid a possible clash with members of MockClass.
00276   StrictMock() {
00277     ::testing::Mock::FailUninterestingCalls(
00278         internal::ImplicitCast_<MockClass*>(this));
00279   }
00280 
00281   // C++ doesn't (yet) allow inheritance of constructors, so we have
00282   // to define it for each arity.
00283   template <typename A1>
00284   explicit StrictMock(const A1& a1) : MockClass(a1) {
00285     ::testing::Mock::FailUninterestingCalls(
00286         internal::ImplicitCast_<MockClass*>(this));
00287   }
00288   template <typename A1, typename A2>
00289   StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) {
00290     ::testing::Mock::FailUninterestingCalls(
00291         internal::ImplicitCast_<MockClass*>(this));
00292   }
00293 
00294   template <typename A1, typename A2, typename A3>
00295   StrictMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) {
00296     ::testing::Mock::FailUninterestingCalls(
00297         internal::ImplicitCast_<MockClass*>(this));
00298   }
00299 
00300   template <typename A1, typename A2, typename A3, typename A4>
00301   StrictMock(const A1& a1, const A2& a2, const A3& a3,
00302       const A4& a4) : MockClass(a1, a2, a3, a4) {
00303     ::testing::Mock::FailUninterestingCalls(
00304         internal::ImplicitCast_<MockClass*>(this));
00305   }
00306 
00307   template <typename A1, typename A2, typename A3, typename A4, typename A5>
00308   StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00309       const A5& a5) : MockClass(a1, a2, a3, a4, a5) {
00310     ::testing::Mock::FailUninterestingCalls(
00311         internal::ImplicitCast_<MockClass*>(this));
00312   }
00313 
00314   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00315       typename A6>
00316   StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00317       const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) {
00318     ::testing::Mock::FailUninterestingCalls(
00319         internal::ImplicitCast_<MockClass*>(this));
00320   }
00321 
00322   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00323       typename A6, typename A7>
00324   StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00325       const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5,
00326       a6, a7) {
00327     ::testing::Mock::FailUninterestingCalls(
00328         internal::ImplicitCast_<MockClass*>(this));
00329   }
00330 
00331   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00332       typename A6, typename A7, typename A8>
00333   StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00334       const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1,
00335       a2, a3, a4, a5, a6, a7, a8) {
00336     ::testing::Mock::FailUninterestingCalls(
00337         internal::ImplicitCast_<MockClass*>(this));
00338   }
00339 
00340   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00341       typename A6, typename A7, typename A8, typename A9>
00342   StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00343       const A5& a5, const A6& a6, const A7& a7, const A8& a8,
00344       const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
00345     ::testing::Mock::FailUninterestingCalls(
00346         internal::ImplicitCast_<MockClass*>(this));
00347   }
00348 
00349   template <typename A1, typename A2, typename A3, typename A4, typename A5,
00350       typename A6, typename A7, typename A8, typename A9, typename A10>
00351   StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
00352       const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9,
00353       const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) {
00354     ::testing::Mock::FailUninterestingCalls(
00355         internal::ImplicitCast_<MockClass*>(this));
00356   }
00357 
00358   virtual ~StrictMock() {
00359     ::testing::Mock::UnregisterCallReaction(
00360         internal::ImplicitCast_<MockClass*>(this));
00361   }
00362 
00363  private:
00364   GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock);
00365 };
00366 
00367 // The following specializations catch some (relatively more common)
00368 // user errors of nesting nice and strict mocks.  They do NOT catch
00369 // all possible errors.
00370 
00371 // These specializations are declared but not defined, as NiceMock,
00372 // NaggyMock, and StrictMock cannot be nested.
00373 
00374 template <typename MockClass>
00375 class NiceMock<NiceMock<MockClass> >;
00376 template <typename MockClass>
00377 class NiceMock<NaggyMock<MockClass> >;
00378 template <typename MockClass>
00379 class NiceMock<StrictMock<MockClass> >;
00380 
00381 template <typename MockClass>
00382 class NaggyMock<NiceMock<MockClass> >;
00383 template <typename MockClass>
00384 class NaggyMock<NaggyMock<MockClass> >;
00385 template <typename MockClass>
00386 class NaggyMock<StrictMock<MockClass> >;
00387 
00388 template <typename MockClass>
00389 class StrictMock<NiceMock<MockClass> >;
00390 template <typename MockClass>
00391 class StrictMock<NaggyMock<MockClass> >;
00392 template <typename MockClass>
00393 class StrictMock<StrictMock<MockClass> >;
00394 
00395 }  // namespace testing
00396 
00397 #endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:41