Passwordfile library
5.0.12
C++ library to read/write passwords from/to encrypted files
Loading...
Searching...
No Matches
tests
opensslrandomdevice.cpp
Go to the documentation of this file.
1
#include "
../util/opensslrandomdevice.h
"
2
3
#include "
./utils.h
"
4
5
#include <cppunit/TestFixture.h>
6
#include <cppunit/extensions/HelperMacros.h>
7
8
#include <random>
9
10
using namespace
std;
11
using namespace
Util
;
12
using namespace
CppUtilities::Literals;
13
14
using namespace
CPPUNIT_NS;
15
19
class
OpenSslRandomDeviceTests
:
public
TestFixture {
20
CPPUNIT_TEST_SUITE(
OpenSslRandomDeviceTests
);
21
CPPUNIT_TEST(
testUsageWithStandardClasses
);
22
CPPUNIT_TEST_SUITE_END();
23
24
public
:
25
void
setUp
()
override
;
26
void
tearDown
()
override
;
27
28
void
testUsageWithStandardClasses
();
29
};
30
31
CPPUNIT_TEST_SUITE_REGISTRATION
(
OpenSslRandomDeviceTests
);
32
33
void
OpenSslRandomDeviceTests::setUp
()
34
{
35
}
36
37
void
OpenSslRandomDeviceTests::tearDown
()
38
{
39
}
40
44
void
OpenSslRandomDeviceTests::testUsageWithStandardClasses
()
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
}
OpenSslRandomDeviceTests
The OpenSslRandomDeviceTests class tests the Util::OpenSslRandomDevice class.
Definition
opensslrandomdevice.cpp:19
OpenSslRandomDeviceTests::tearDown
void tearDown() override
Definition
opensslrandomdevice.cpp:37
OpenSslRandomDeviceTests::setUp
void setUp() override
Definition
opensslrandomdevice.cpp:33
OpenSslRandomDeviceTests::testUsageWithStandardClasses
void testUsageWithStandardClasses()
Tests using the OpenSslRandomDevice with std::uniform_int_distribution.
Definition
opensslrandomdevice.cpp:44
Util::OpenSslRandomDevice
Provides a random device using the OpenSSL function RAND_bytes().
Definition
opensslrandomdevice.h:11
Util
Contains utility classes and functions.
Definition
openssl.h:9
opensslrandomdevice.h
CPPUNIT_TEST_SUITE_REGISTRATION
CPPUNIT_TEST_SUITE_REGISTRATION(OpenSslRandomDeviceTests)
utils.h
Generated on Tue Aug 6 2024 22:26:30 for Passwordfile library by
1.11.0