63 #ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_ 64 #define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_ 67 #include <type_traits> 73 template <
class MockClass>
75 template <
class MockClass>
77 template <
class MockClass>
101 #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW && \ 102 (defined(_MSC_VER) || defined(__clang__)) 105 #define GTEST_INTERNAL_EMPTY_BASE_CLASS __declspec(empty_bases) 107 #define GTEST_INTERNAL_EMPTY_BASE_CLASS 110 template <
typename Base>
114 ::testing::Mock::AllowUninterestingCalls(reinterpret_cast<uintptr_t>(
this));
118 ::testing::Mock::UnregisterCallReaction(reinterpret_cast<uintptr_t>(
this));
122 template <
typename Base>
126 ::testing::Mock::WarnUninterestingCalls(reinterpret_cast<uintptr_t>(
this));
130 ::testing::Mock::UnregisterCallReaction(reinterpret_cast<uintptr_t>(
this));
134 template <
typename Base>
138 ::testing::Mock::FailUninterestingCalls(reinterpret_cast<uintptr_t>(
this));
142 ::testing::Mock::UnregisterCallReaction(reinterpret_cast<uintptr_t>(
this));
148 template <
class MockClass>
153 static_assert(!internal::HasStrictnessModifier<MockClass>(),
154 "Can't apply NiceMock to a class hierarchy that already has a " 155 "strictness modifier. See " 156 "https://google.github.io/googletest/" 157 "gmock_cook_book.html#NiceStrictNaggy");
159 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
160 "The impl subclass shouldn't introduce any padding");
170 template <
typename A>
172 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
173 "The impl subclass shouldn't introduce any padding");
176 template <
typename TArg1,
typename TArg2,
typename... An>
178 : MockClass(
std::forward<TArg1>(arg1),
std::forward<TArg2>(arg2),
179 std::forward<An>(args)...) {
180 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
181 "The impl subclass shouldn't introduce any padding");
185 NiceMock(
const NiceMock&) =
delete;
186 NiceMock& operator=(
const NiceMock&) =
delete;
189 template <
class MockClass>
193 static_assert(!internal::HasStrictnessModifier<MockClass>(),
194 "Can't apply NaggyMock to a class hierarchy that already has a " 195 "strictness modifier. See " 196 "https://google.github.io/googletest/" 197 "gmock_cook_book.html#NiceStrictNaggy");
201 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
202 "The impl subclass shouldn't introduce any padding");
212 template <
typename A>
214 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
215 "The impl subclass shouldn't introduce any padding");
218 template <
typename TArg1,
typename TArg2,
typename... An>
220 : MockClass(
std::forward<TArg1>(arg1),
std::forward<TArg2>(arg2),
221 std::forward<An>(args)...) {
222 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
223 "The impl subclass shouldn't introduce any padding");
227 NaggyMock(
const NaggyMock&) =
delete;
228 NaggyMock& operator=(
const NaggyMock&) =
delete;
231 template <
class MockClass>
237 !internal::HasStrictnessModifier<MockClass>(),
238 "Can't apply StrictMock to a class hierarchy that already has a " 239 "strictness modifier. See " 240 "https://google.github.io/googletest/" 241 "gmock_cook_book.html#NiceStrictNaggy");
243 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
244 "The impl subclass shouldn't introduce any padding");
254 template <
typename A>
256 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
257 "The impl subclass shouldn't introduce any padding");
260 template <
typename TArg1,
typename TArg2,
typename... An>
262 : MockClass(
std::forward<TArg1>(arg1),
std::forward<TArg2>(arg2),
263 std::forward<An>(args)...) {
264 static_assert(
sizeof(*
this) ==
sizeof(MockClass),
265 "The impl subclass shouldn't introduce any padding");
269 StrictMock(
const StrictMock&) =
delete;
270 StrictMock& operator=(
const StrictMock&) =
delete;
273 #undef GTEST_INTERNAL_EMPTY_BASE_CLASS 277 #endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_
constexpr bool HasStrictnessModifier()
#define GTEST_INTERNAL_EMPTY_BASE_CLASS
NaggyMock(TArg1 &&arg1, TArg2 &&arg2, An &&... args)
NiceMock(TArg1 &&arg1, TArg2 &&arg2, An &&... args)
StrictMock(TArg1 &&arg1, TArg2 &&arg2, An &&... args)
std::true_type StrictnessModifierProbe(const NiceMock< T > &)