63#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_
64#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_
73template <
class MockClass>
75template <
class MockClass>
77template <
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
110template <
typename Base>
114 ::testing::Mock::AllowUninterestingCalls(
reinterpret_cast<uintptr_t
>(
this));
118 ::testing::Mock::UnregisterCallReaction(
reinterpret_cast<uintptr_t
>(
this));
122template <
typename Base>
126 ::testing::Mock::WarnUninterestingCalls(
reinterpret_cast<uintptr_t
>(
this));
130 ::testing::Mock::UnregisterCallReaction(
reinterpret_cast<uintptr_t
>(
this));
134template <
typename Base>
138 ::testing::Mock::FailUninterestingCalls(
reinterpret_cast<uintptr_t
>(
this));
142 ::testing::Mock::UnregisterCallReaction(
reinterpret_cast<uintptr_t
>(
this));
148template <
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>
171 explicit NiceMock(A&& arg) : MockClass(std::forward<A>(arg)) {
172 static_assert(
sizeof(*this) ==
sizeof(MockClass),
173 "The impl subclass shouldn't introduce any padding");
171 explicit NiceMock(A&& arg) : MockClass(std::forward<A>(arg)) {
…}
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");
189template <
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>
213 explicit NaggyMock(A&& arg) : MockClass(std::forward<A>(arg)) {
214 static_assert(
sizeof(*this) ==
sizeof(MockClass),
215 "The impl subclass shouldn't introduce any padding");
213 explicit NaggyMock(A&& arg) : MockClass(std::forward<A>(arg)) {
…}
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");
231template <
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>
255 explicit StrictMock(A&& arg) : MockClass(std::forward<A>(arg)) {
256 static_assert(
sizeof(*this) ==
sizeof(MockClass),
257 "The impl subclass shouldn't introduce any padding");
255 explicit StrictMock(A&& arg) : MockClass(std::forward<A>(arg)) {
…}
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");
273#undef 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)
#define GTEST_INTERNAL_EMPTY_BASE_CLASS
std::true_type StrictnessModifierProbe(const NiceMock< T > &)
constexpr bool HasStrictnessModifier()