// // random_test.cpp // shared_random_generator-test // // Created by Sam Jaffe on 8/14/20. // Copyright © 2020 Sam Jaffe. All rights reserved. // #include "random/random.h" #include "random/distribution.h" #include "random/mock/mock_device.h" #include "xcode_gtest_helper.h" using testing::_; using engine::random::Index; using engine::random::MockDevice; using engine::random::Uniform; TEST(RandomTest, UsesInt32Type) { auto mock = std::make_shared(); engine::random::Random generator{mock}; EXPECT_CALL(*mock, apply_int32_t(_)).Times(1); generator(Uniform(-10, 10)); } TEST(RandomTest, UsesUInt32Type) { auto mock = std::make_shared(); engine::random::Random generator{mock}; EXPECT_CALL(*mock, apply_uint32_t(_)).Times(1); generator(Uniform(0u, 10u)); } TEST(RandomTest, UsesSizeType) { auto mock = std::make_shared(); engine::random::Random generator{mock}; EXPECT_CALL(*mock, apply_size_t(_)).Times(1); generator(Index(10)); } TEST(RandomTest, UsesDoubleType) { auto mock = std::make_shared(); engine::random::Random generator{mock}; EXPECT_CALL(*mock, apply_double(_)).Times(1); generator(Uniform(0.0, 10.0)); }