#include "../util/opensslrandomdevice.h" #include "./utils.h" #include #include #include using namespace std; using namespace Util; using namespace CppUtilities::Literals; using namespace CPPUNIT_NS; /*! * \brief The OpenSslRandomDeviceTests class tests the Util::OpenSslRandomDevice class. */ class OpenSslRandomDeviceTests : public TestFixture { CPPUNIT_TEST_SUITE(OpenSslRandomDeviceTests); CPPUNIT_TEST(testUsageWithStandardClasses); CPPUNIT_TEST_SUITE_END(); public: void setUp() override; void tearDown() override; void testUsageWithStandardClasses(); }; CPPUNIT_TEST_SUITE_REGISTRATION(OpenSslRandomDeviceTests); void OpenSslRandomDeviceTests::setUp() { } void OpenSslRandomDeviceTests::tearDown() { } /*! * \brief Tests using the OpenSslRandomDevice with std::uniform_int_distribution. */ void OpenSslRandomDeviceTests::testUsageWithStandardClasses() { uniform_int_distribution<> dist(1, 10); const Util::OpenSslRandomDevice random; const auto val = dist(random); CPPUNIT_ASSERT_GREATEREQUAL(1, val); CPPUNIT_ASSERT_LESSEQUAL(10, val); }