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

[#2860] Added comments to tests per review

This commit is contained in:
Marcin Siodelski
2023-05-24 16:42:23 +02:00
parent bba6b9e89b
commit 86f328ceee

View File

@@ -76,6 +76,14 @@ TEST(IPRangePermutationTest, ipv4) {
iterations.push_back(ordered_addrs);
}
// We want to make sure that each new permutation instance produces a different
// sequence of addresses. It checks whether or not the random device has been
// initialized properly. If the random device uses the same seed for each
// new permutation, the output sequence is always the same. The test below
// checks that the sequences are different by comparing the respective addresses
// for two different permutations. It is ok if some of them are equal because it
// is statistically probable. The threshold of 20% should guard against some
// of them being equal without a risk of sporadic test failures.
int overlaps = 0;
for (auto i = 0; i < iterations[0].size(); ++i) {
if (iterations[0][i] == iterations[1][i]) {
@@ -130,6 +138,14 @@ TEST(IPRangePermutationTest, ipv6) {
iterations.push_back(ordered_addrs);
}
// We want to make sure that each new permutation instance produces a different
// sequence of addresses. It checks whether or not the random device has been
// initialized properly. If the random device uses the same seed for each
// new permutation, the output sequence is always the same. The test below
// checks that the sequences are different by comparing the respective addresses
// for two different permutations. It is ok if some of them are equal because it
// is statistically probable. The threshold of 20% should guard against some
// of them being equal without a risk of sporadic test failures.
int overlaps = 0;
for (auto i = 0; i < iterations[0].size(); ++i) {
if (iterations[0][i] == iterations[1][i]) {
@@ -185,6 +201,14 @@ TEST(IPRangePermutationTest, pd) {
ASSERT_EQ(2, iterations.size());
// We want to make sure that each new permutation instance produces a different
// sequence of prefixes. It checks whether or not the random device has been
// initialized properly. If the random device uses the same seed for each
// new permutation, the output sequence is always the same. The test below
// checks that the sequences are different by comparing the respective prefixes
// for two different permutations. It is ok if some of them are equal because it
// is statistically probable. The threshold of 20% should guard against some
// of them being equal without a risk of sporadic test failures.
int overlaps = 0;
for (auto i = 0; i < iterations[0].size(); ++i) {
if (iterations[0][i] == iterations[1][i]) {