// // Copyright 2019 The Abseil Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef ABSL_RANDOM_INTERNAL_MOCK_HELPERS_H_ #define ABSL_RANDOM_INTERNAL_MOCK_HELPERS_H_ #include <utility> #include "absl/base/config.h" #include "absl/base/internal/fast_type_id.h" #include "absl/types/optional.h" namespace absl { ABSL_NAMESPACE_BEGIN namespace random_internal { // A no-op validator meeting the ValidatorT requirements for MockHelpers. // // Custom validators should follow a similar structure, passing the type to // MockHelpers::MockFor<KeyT>(m, CustomValidatorT()). struct NoOpValidator { … }; // MockHelpers works in conjunction with MockOverloadSet, MockingBitGen, and // BitGenRef to enable the mocking capability for absl distribution functions. // // MockingBitGen registers mocks based on the typeid of a mock signature, KeyT, // which is used to generate a unique id. // // KeyT is a signature of the form: // result_type(discriminator_type, std::tuple<args...>) // The mocked function signature will be composed from KeyT as: // result_type(args...) // class MockHelpers { … }; } // namespace random_internal ABSL_NAMESPACE_END } // namespace absl #endif // ABSL_RANDOM_INTERNAL_MOCK_HELPERS_H_