]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1423] Protected all tests against free content
authorFrancis Dupont <fdupont@isc.org>
Tue, 20 Oct 2020 09:51:10 +0000 (11:51 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 20 Oct 2020 09:51:10 +0000 (11:51 +0200)
src/bin/agent/tests/parser_unittests.cc
src/bin/d2/tests/parser_unittest.cc
src/bin/dhcp4/tests/parser_unittest.cc
src/bin/dhcp6/tests/parser_unittest.cc
src/bin/netconf/tests/parser_unittests.cc

index c32fd34101d5fc2c4aa6fa749ce9b15785f6f85d..125d650de3f8e7bf3b447bba5fc8d8cf734e2141 100644 (file)
@@ -743,6 +743,7 @@ TEST(ParserTest, mapEntries) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
                     static_cast<void>(set.insert(elem.first));
+                    // Skip entries with free content.
                     if ((elem.first != "user-context") &&
                         (elem.first != "parameters")) {
                         extract(elem.second, set);
@@ -797,8 +798,9 @@ TEST(ParserTest, duplicateMapEntries) {
             } else if (json->getType() == Element::map) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
-                    // Skip user-context.
-                    if (elem.first == "user-context") {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
                         continue;
                     }
 
index e10891c23aad82e92ba9f73c3bc7bea01af0a8ee..70a372f5b91d93852d03a7d5c9b8822436434564 100644 (file)
@@ -685,7 +685,9 @@ TEST(ParserTest, mapEntries) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
                     static_cast<void>(set.insert(elem.first));
-                    if (elem.first != "user-context") {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
                         extract(elem.second, set);
                     }
                 }
@@ -738,8 +740,9 @@ TEST(ParserTest, duplicateMapEntries) {
             } else if (json->getType() == Element::map) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
-                    // Skip user-context.
-                    if (elem.first == "user-context") {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
                         continue;
                     }
 
index 58562edf3b17a717f83bc9c676956f3b32cfb937..b387652e675f9de7ba3ad526a9934114b38a0f74 100644 (file)
@@ -743,7 +743,9 @@ TEST(ParserTest, mapEntries) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
                     static_cast<void>(set.insert(elem.first));
-                    if (elem.first != "user-context") {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
                         extract(elem.second, set);
                     }
                 }
@@ -812,6 +814,12 @@ TEST(ParserTest, duplicateMapEntries) {
             } else if (json->getType() == Element::map) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
+                        continue;
+                    }
+
                     // Perform tests.
                     string dup = elem.first + "DDDD";
                     json->set(dup, elem.second);
index 29e266812d2efdfe6ef521c2bcc9693cb764ba85..750ba034d782df2575517f79b31766339cd15a8d 100644 (file)
@@ -733,7 +733,9 @@ TEST(ParserTest, mapEntries) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
                     static_cast<void>(set.insert(elem.first));
-                    if (elem.first != "user-context") {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
                         extract(elem.second, set);
                     }
                 }
@@ -802,6 +804,12 @@ TEST(ParserTest, duplicateMapEntries) {
             } else if (json->getType() == Element::map) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
+                        continue;
+                    }
+
                     // Perform tests.
                     string dup = elem.first + "DDDD";
                     json->set(dup, elem.second);
index 2aeeca06825ab997b3a8a981f1a97775bc02b6ae..8cbf85de91f8938a83f05acb1cd7346f27a11038 100644 (file)
@@ -803,7 +803,9 @@ TEST(ParserTest, mapEntries) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
                     static_cast<void>(set.insert(elem.first));
-                    if (elem.first != "user-context") {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
                         extract(elem.second, set);
                     }
                 }
@@ -856,8 +858,9 @@ TEST(ParserTest, duplicateMapEntries) {
             } else if (json->getType() == Element::map) {
                 // Handle maps.
                 for (auto elem : json->mapValue()) {
-                    // Skip user-context.
-                    if (elem.first == "user-context") {
+                    // Skip entries with free content.
+                    if ((elem.first != "user-context") &&
+                        (elem.first != "parameters")) {
                         continue;
                     }