Go to the documentation of this file.
28 #ifndef ABSL_RANDOM_MOCKING_BIT_GEN_H_
29 #define ABSL_RANDOM_MOCKING_BIT_GEN_H_
35 #include <type_traits>
38 #include "gmock/gmock.h"
39 #include "gtest/gtest.h"
40 #include "absl/base/internal/fast_type_id.h"
41 #include "absl/container/flat_hash_map.h"
42 #include "absl/meta/type_traits.h"
43 #include "absl/random/distributions.h"
44 #include "absl/random/internal/distribution_caller.h"
45 #include "absl/random/random.h"
46 #include "absl/strings/str_cat.h"
47 #include "absl/strings/str_join.h"
48 #include "absl/types/span.h"
49 #include "absl/types/variant.h"
50 #include "absl/utility/utility.h"
55 namespace random_internal {
57 struct DistributionCaller;
119 template <
typename ResultT,
typename...
Args>
128 template <
typename MockFnType,
typename ResultT,
typename Tuple>
132 template <
typename MockFnType,
typename ResultT,
typename...
Args>
149 virtual void Apply(
void* args_tuple,
153 template <
typename MockFnType,
typename ResultT,
typename ArgTupleT>
160 *
static_cast<ResultT*
>(
result) =
162 *
static_cast<ArgTupleT*
>(args_tuple));
178 template <
typename ResultT,
typename ArgTupleT,
typename SelfT>
181 std::declval<ArgTupleT>()))& {
182 using MockFnType = decltype(
GetMockFnType(std::declval<ResultT>(),
183 std::declval<ArgTupleT>()));
186 std::is_same<SelfT, ::testing::NiceMock<absl::MockingBitGen>>
::value,
200 mock = absl::make_unique<ImplT>();
202 return static_cast<ImplT*
>(mock.get())->mock_fn_;
220 if (
it ==
mocks_.end())
return false;
221 it->second->Apply(args_tuple,
result);
226 std::unique_ptr<FunctionHolder>>
231 friend struct ::absl::random_internal::DistributionCaller;
232 friend class ::absl::BitGenRef;
233 friend class ::absl::random_internal::MockHelpers;
240 #endif // ABSL_RANDOM_MOCKING_BIT_GEN_H_
bool InvokeMock(base_internal::FastTypeIdType type, void *args_tuple, void *result)
auto RegisterMock(SelfT &, base_internal::FastTypeIdType type) -> decltype(GetMockFnType(std::declval< ResultT >(), std::declval< ArgTupleT >()))&
typename std::conditional< B, T, F >::type conditional_t
#define ABSL_NAMESPACE_END
virtual void Apply(void *args_tuple, void *result)=0
#define ABSL_NAMESPACE_BEGIN
typename random_internal::randen_engine< uint64_t > ::result_type result_type
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
ResultT operator()(Args... args)
static constexpr result_type() min()
static constexpr result_type() max()
const void * FastTypeIdType
static constexpr result_type() max()
static constexpr result_type() min()
absl::flat_hash_map< base_internal::FastTypeIdType, std::unique_ptr< FunctionHolder > > mocks_
void Apply(void *args_tuple, void *result) override
static auto GetMockFnType(ResultT, std::tuple< Args... >) -> ::testing::MockFunction< ResultT(Args...)>
virtual ~FunctionHolder()=default
absl::BitGen::result_type result_type
auto apply(Functor &&functor, Tuple &&t) -> decltype(utility_internal::apply_helper(absl::forward< Functor >(functor), absl::forward< Tuple >(t), absl::make_index_sequence< std::tuple_size< typename std::remove_reference< Tuple >::type >::value >
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:30