diff --git a/test/test_detail_random_provider.cpp b/test/test_detail_random_provider.cpp index c5992b2..de6299a 100644 --- a/test/test_detail_random_provider.cpp +++ b/test/test_detail_random_provider.cpp @@ -8,8 +8,6 @@ // Positive and negative testing for detail::random_provider // -// The mock needs to load first for posix system call redirection to work properly -#include "mock_random.hpp" #include #include #include @@ -20,11 +18,8 @@ #include #include - int main() { -#if !defined(BOOST_UUID_TEST_RANDOM_MOCK) // Positive Testing - boost::uuids::detail::random_provider provider; boost::array ints; @@ -37,41 +32,12 @@ int main() // test name() BOOST_TEST_GT(strlen(provider.name()), 4u); - // test get_random_bytes() + // test the equivalent of get_random_bytes() std::uint32_t buf1[16]; std::uint32_t buf2[16]; provider.generate(buf1, buf1 + 16); provider.generate(buf2, buf2 + 16); BOOST_TEST_NE(0, memcmp(buf1, buf2, 64)); -#else // Negative Testing - - if (expectations_capable()) - { - // Test fail acquiring context if the provider supports it - if (provider_acquires_context()) - { - expect_next_call_success(false); - BOOST_TEST_THROWS(boost::uuids::detail::random_provider(), - boost::uuids::entropy_error); - BOOST_TEST(expectations_met()); - } - - // Test fail acquiring entropy - if (provider_acquires_context()) - { - expect_next_call_success(true); - } - expect_next_call_success(false); - // 4 is important for the posix negative test (partial read) to work properly - // as it sees a size of 4, returns 1, causing a 2nd loop to read 3 more bytes... - std::uint32_t buf[1]; - BOOST_TEST_THROWS(boost::uuids::detail::random_provider().generate(buf, buf + 1), - boost::uuids::entropy_error); - BOOST_TEST(expectations_met()); - } - -#endif - return boost::report_errors(); }