diff options
author | Vincent Ambo <tazjin@google.com> | 2020-06-17T13·53+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-06-17T13·53+0100 |
commit | 8f2828c4b4ce502d242eca80a80269448857f4a6 (patch) | |
tree | cc3fad62dff6f279ce77f17047c4eef5ebbaf251 /absl/random/bit_gen_ref_test.cc | |
parent | 768eb2ca2857342673fcd462792ce04b8bac3fa3 (diff) |
Squashed 'third_party/abseil_cpp/' changes from 768eb2ca2..ccdbb5941
ccdbb5941 Export of internal Abseil changes 01f5f81f9 Export of internal Abseil changes 2c92bdc7c Export of internal Abseil changes e7ebf9803 Export of internal Abseil changes 2eba343b5 Export of internal Abseil changes a8b03d90e Export of internal Abseil changes 1d31b5c36 Export of internal Abseil changes da3a87690 Export of internal Abseil changes 8faf20461 Exclude empty directories (#697) 2069dc796 Export of internal Abseil changes 4832bf6bf Added a BUILD file in root to expose license. (#695) af8f994af Export of internal Abseil changes 33caf1097 Export of internal Abseil changes cf1a02e2d Export of internal Abseil changes git-subtree-dir: third_party/abseil_cpp git-subtree-split: ccdbb5941f992fabda7eae3ce72f55efc17c826a
Diffstat (limited to 'absl/random/bit_gen_ref_test.cc')
-rw-r--r-- | absl/random/bit_gen_ref_test.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/absl/random/bit_gen_ref_test.cc b/absl/random/bit_gen_ref_test.cc index ca0e4d707250..1135cf2da0bf 100644 --- a/absl/random/bit_gen_ref_test.cc +++ b/absl/random/bit_gen_ref_test.cc @@ -17,30 +17,31 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/base/internal/fast_type_id.h" #include "absl/random/internal/sequence_urbg.h" #include "absl/random/random.h" namespace absl { ABSL_NAMESPACE_BEGIN -class ConstBitGen : public absl::random_internal::MockingBitGenBase { - bool CallImpl(const std::type_info&, void*, void* result) override { +class ConstBitGen { + public: + // URBG interface + using result_type = absl::BitGen::result_type; + + static constexpr result_type(min)() { return (absl::BitGen::min)(); } + static constexpr result_type(max)() { return (absl::BitGen::max)(); } + result_type operator()() { return 1; } + + // InvokeMock method + bool InvokeMock(base_internal::FastTypeIdType index, void*, void* result) { *static_cast<int*>(result) = 42; return true; } }; -namespace random_internal { -template <> -struct DistributionCaller<ConstBitGen> { - template <typename DistrT, typename FormatT, typename... Args> - static typename DistrT::result_type Call(ConstBitGen* gen, Args&&... args) { - return gen->template Call<DistrT, FormatT>(std::forward<Args>(args)...); - } -}; -} // namespace random_internal - namespace { + int FnTest(absl::BitGenRef gen_ref) { return absl::Uniform(gen_ref, 1, 7); } template <typename T> |