]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4545] Moved lenient flag
authorFrancis Dupont <fdupont@isc.org>
Mon, 6 Jul 2026 14:43:20 +0000 (16:43 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 6 Jul 2026 21:04:00 +0000 (23:04 +0200)
src/lib/dhcp/tests/option6_iaprefix_unittest.cc

index 08ed105ab4fe7d642f7472f2a2f531986b1d883e..393932c1192280dda670c4c8c9e7f4a03db32a23 100644 (file)
@@ -27,24 +27,21 @@ using namespace isc::util;
 using namespace isc::asiolink;
 
 namespace {
-// RAII device to make sure that lenient parsing flag is reset to false on exit.
-class LenientOptionParsing {
-public:
-    LenientOptionParsing(bool value) {
-        Option::lenient_parsing_ = value;
-    }
-
-    ~LenientOptionParsing() {
-        Option::lenient_parsing_ = false;
-    }
-};
 
+/// @brief Unit test fixture class.
 class Option6IAPrefixTest : public ::testing::Test {
 public:
+    /// @brief Constructor.
     Option6IAPrefixTest() : buf_(255), out_buf_(255) {
         for (unsigned i = 0; i < 255; i++) {
             buf_[i] = 255 - i;
         }
+        Option::lenient_parsing_ = false;
+    }
+
+    /// @brief Destructor.
+    ~Option6IAPrefixTest() {
+        Option::lenient_parsing_ = false;
     }
 
     /// @brief creates on-wire representation of IAPREFIX option
@@ -293,7 +290,7 @@ TEST_F(Option6IAPrefixTest, constructorInvalidPrefixLength) {
                      buf_.begin(), buf_.end())), BadValue);
 
     // Lenient parsing accepts and fixes it.
-    LenientOptionParsing lop(true);
+    Option::lenient_parsing_ = true;
     ASSERT_NO_THROW(opt.reset(new Option6IAPrefix(D6O_IAPREFIX,
                         buf_.begin(), buf_.end())));
     ASSERT_TRUE(opt);