]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Do not use std::rand in long response unit test.
authorMarcin Siodelski <marcin@isc.org>
Wed, 16 May 2018 16:27:40 +0000 (18:27 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 16 May 2018 16:27:40 +0000 (18:27 +0200)
It gives unpredictable results on OpenBSD. Okayed on jabber.

src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc

index d46489ef40334d3b99ec9f7f0bc9dca0a27b1da5..24fe8d74d751fbc33fa87ac7e431816d48c6d90b 100644 (file)
@@ -371,13 +371,10 @@ public:
     /// can catch out of order delivery.
     static ConstElementPtr longResponseHandler(const std::string&,
                                                const ConstElementPtr&) {
-        // By seeding the generator with the constant value we will always
-        // get the same sequence of generated strings.
-        std::srand(1);
         ElementPtr arguments = Element::createList();
-        for (unsigned i = 0; i < 40000; ++i) {
+        for (unsigned i = 0; i < 80000; ++i) {
             std::ostringstream s;
-            s << std::setw(10) << std::rand();
+            s << std::setw(5) << i;
             arguments->add(Element::create(s.str()));
         }
         return (createAnswer(0, arguments));
index dfd5467efa7b3d0197f2bdb8b54a8bbfb2b884bf..e6fcb40ab4208ed4ad01bf9ff94a20aefd6cdd8d 100644 (file)
@@ -380,13 +380,10 @@ public:
     /// can catch out of order delivery.
     static ConstElementPtr longResponseHandler(const std::string&,
                                                const ConstElementPtr&) {
-        // By seeding the generator with the constant value we will always
-        // get the same sequence of generated strings.
-        std::srand(1);
         ElementPtr arguments = Element::createList();
-        for (unsigned i = 0; i < 40000; ++i) {
+        for (unsigned i = 0; i < 80000; ++i) {
             std::ostringstream s;
-            s << std::setw(10) << std::rand();
+            s << std::setw(5) << i;
             arguments->add(Element::create(s.str()));
         }
         return (createAnswer(0, arguments));