// // mock_device.h // shared_random_generator // // Created by Sam Jaffe on 3/25/23. // Copyright © 2023 Sam Jaffe. All rights reserved. // #pragma once #include #include #include #include #ifndef CONCAT #define CONCAT2(A, B) A##B #define CONCAT(A, B) CONCAT2(A, B) #endif #define MOCK_DEVICE(T) \ MOCK_METHOD1(CONCAT(apply_, T), T(std::string const &)); \ T apply(Distribution const & dist) final { \ return CONCAT(apply_, T)(to_string(dist)); \ } namespace engine::random { class MockDevice : public Device { public: result_type operator()() final { return apply_uint32_t("?"); } IMPLEMENT_DEVICE(MOCK_DEVICE) }; } #undef MOCK_DEVICE