2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#3207] Remove helper class

This commit is contained in:
Slawek Figiel
2024-02-09 11:46:23 +01:00
parent 50b1b752bf
commit 1679c812d9
2 changed files with 0 additions and 29 deletions

View File

@@ -25,12 +25,6 @@
namespace isc {
namespace perfdhcp {
class InvalidLimits : public isc::BadValue {
public:
InvalidLimits(const char* file, size_t line, const char* what) :
isc::BadValue(file, line, what) {}
};
/// \brief Uniform random integer generator
///
/// Generate uniformly distributed integers in range of [min, max]
@@ -44,14 +38,6 @@ public:
min_(std::min(min, max)), max_(std::max(min, max)),
dist_(min_, max_), generator_(rng_, dist_)
{
// To preserve the restriction of the underlying uniform_int class (and
// to retain compatibility with earlier versions of the class), we will
// abort if the minimum and maximum given are the wrong way round.
if (min > max) {
isc_throw(InvalidLimits, "minimum limit is greater than maximum "
"when initializing UniformRandomIntegerGenerator");
}
// Init with the current time
rng_.seed(time(0));
}

View File

@@ -41,21 +41,6 @@ private:
const static int max_ = 10;
};
// Some validation tests will incur performance penalty, so the tests are
// made only in "debug" version with assert(). But if NDEBUG is defined
// the tests will be failed since assert() is non-op in non-debug version.
// The "#ifndef NDEBUG" is added to make the tests be performed only in
// non-debug environment.
// Note: the death test is not supported by all platforms. We need to
// compile tests using it selectively.
#if !defined(NDEBUG)
// Test of the constructor
TEST_F(UniformRandomIntegerGeneratorTest, Constructor) {
// The range must be min<=max
ASSERT_THROW(UniformRandomIntegerGenerator(3, 2), InvalidLimits);
}
#endif
// Test of the generated integers are in the range [min, max]
TEST_F(UniformRandomIntegerGeneratorTest, IntegerRange) {
vector<int> numbers;