Passwordfile library 5.0.12
C++ library to read/write passwords from/to encrypted files
Loading...
Searching...
No Matches
opensslrandomdevice.cpp
Go to the documentation of this file.
2
3#include "./utils.h"
4
5#include <cppunit/TestFixture.h>
6#include <cppunit/extensions/HelperMacros.h>
7
8#include <random>
9
10using namespace std;
11using namespace Util;
12using namespace CppUtilities::Literals;
13
14using namespace CPPUNIT_NS;
15
19class OpenSslRandomDeviceTests : public TestFixture {
20 CPPUNIT_TEST_SUITE(OpenSslRandomDeviceTests);
21 CPPUNIT_TEST(testUsageWithStandardClasses);
22 CPPUNIT_TEST_SUITE_END();
23
24public:
25 void setUp() override;
26 void tearDown() override;
27
29};
30
32
36
40
45{
46 uniform_int_distribution<> dist(1, 10);
47 const Util::OpenSslRandomDevice random;
48 const auto val = dist(random);
49 CPPUNIT_ASSERT_GREATEREQUAL(1, val);
50 CPPUNIT_ASSERT_LESSEQUAL(10, val);
51}
The OpenSslRandomDeviceTests class tests the Util::OpenSslRandomDevice class.
void testUsageWithStandardClasses()
Tests using the OpenSslRandomDevice with std::uniform_int_distribution.
Provides a random device using the OpenSSL function RAND_bytes().
Contains utility classes and functions.
Definition openssl.h:9
CPPUNIT_TEST_SUITE_REGISTRATION(OpenSslRandomDeviceTests)