]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5495] Added comments in get config tests (4, 6, d2, ca)
authorFrancis Dupont <fdupont@isc.org>
Wed, 11 Apr 2018 12:57:52 +0000 (14:57 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 11 Apr 2018 12:57:52 +0000 (14:57 +0200)
src/bin/agent/tests/get_config_unittest.cc
src/bin/d2/tests/get_config_unittest.cc
src/bin/dhcp4/tests/get_config_unittest.cc.skel
src/bin/dhcp6/tests/get_config_unittest.cc.skel

index f20343c6062f4b074f363cf94ed0ad8efa202765..aff503bea6ea4332e422f670abf126583f9ef9f5 100644 (file)
@@ -257,16 +257,22 @@ TEST_F(CtrlAgentGetCfgTest, simple) {
         prettyPrint(unparsed, std::cerr, 0, 4);
         std::cerr << "\n";
     } else {
+        // get the expected config using the agent syntax parser
         ElementPtr jsond;
         ASSERT_NO_THROW(jsond = parseAGENT(expected, true));
+        // get the expected config using the generic JSON syntax parser
         ElementPtr jsonj;
         ASSERT_NO_THROW(jsonj = parseJSON(expected));
+        // the generic JSON parser does not handle comments
         EXPECT_TRUE(isEquivalent(jsond, moveComments(jsonj)));
+        // replace the path by its actual value
         ConstElementPtr ca;
         ASSERT_NO_THROW(ca = jsonj->get("Control-agent"));
         ASSERT_TRUE(ca);
         pathReplacer(ca);
+        // check that unparsed and updated expected values match
         EXPECT_TRUE(isEquivalent(unparsed, jsonj));
+        // check on pretty prints too
         std::string current = prettyPrint(unparsed, 0, 4);
         std::string expected2 = prettyPrint(jsonj, 0, 4);
         EXPECT_EQ(expected2, current);
index 008af6b7e7e9bb4d29c0be0c74742335323c3efa..06643f54f4a3b5d76b4109825d300e4dbebe611f 100644 (file)
@@ -240,12 +240,17 @@ TEST_F(D2GetConfigTest, sample1) {
         prettyPrint(unparsed, std::cerr, 0, 4);
         std::cerr << "\n";
     } else {
+        // get the expected config using the d2 syntax parser
         ElementPtr jsond;
         ASSERT_NO_THROW(jsond = parseDHCPDDNS(expected, true));
+        // get the expected config using the generic JSON syntax parser
         ElementPtr jsonj;
         ASSERT_NO_THROW(jsonj = parseJSON(expected));
+        // the generic JSON parser does not handle comments
         EXPECT_TRUE(isEquivalent(jsond, moveComments(jsonj)));
+        // check that unparsed and expected values match
         EXPECT_TRUE(isEquivalent(unparsed, jsonj));
+        // check on pretty prints too
         std::string current = prettyPrint(unparsed, 0, 4) + "\n";
         EXPECT_EQ(expected, current);
         if (expected != current) {
index 4a0242c7d645c1a8828b48e08621d33677f5341e..03cf51f32a2d34135f44d6ba7e7ea0ade4f1e2f1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -318,12 +318,17 @@ TEST_P(Dhcp4GetConfigTest, run) {
         ASSERT_NO_THROW(outputFormatted(dhcp->str()));
     } else {
         expected = UNPARSED_CONFIGS[config_counter];
+        // get the expected config using the dhcpv4 syntax parser
         ElementPtr jsond;
         ASSERT_NO_THROW(jsond = parseDHCP4(expected, true));
         ElementPtr jsonj;
+        // get the expected config using the generic JSON syntax parser
         ASSERT_NO_THROW(jsonj = parseJSON(expected));
-        EXPECT_TRUE(isEquivalent(dhcp, jsonj));
+        // the generic JSON parser does not handle comments
         EXPECT_TRUE(isEquivalent(jsond, moveComments(jsonj)));
+        // check that unparsed and expected values match
+        EXPECT_TRUE(isEquivalent(dhcp, jsonj));
+        // check on pretty prints too
         std::string current = prettyPrint(dhcp, 4, 4) + "\n";
         EXPECT_EQ(expected, current);
         if (expected != current) {
index 50c71cd53dc86e5f9f4069c02d7b4cbb8454db7d..a66ef09a41513d82508d2eb00890b5a5f4b0601e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -322,12 +322,17 @@ TEST_P(Dhcp6GetConfigTest, run) {
         ASSERT_NO_THROW(outputFormatted(dhcp->str()));
     } else {
         expected = UNPARSED_CONFIGS[config_counter];
+        // get the expected config using the dhcpv6 syntax parser
         ElementPtr jsond;
         ASSERT_NO_THROW(jsond = parseDHCP6(expected, true));
+        // get the expected config using the generic JSON syntax parser
         ElementPtr jsonj;
         ASSERT_NO_THROW(jsonj = parseJSON(expected));
-        EXPECT_TRUE(isEquivalent(dhcp, jsonj));
+        // the generic JSON parser does not handle comments
         EXPECT_TRUE(isEquivalent(jsond, moveComments(jsonj)));
+        // check that unparsed and expected values match
+        EXPECT_TRUE(isEquivalent(dhcp, jsonj));
+        // check on pretty prints too
         std::string current = prettyPrint(dhcp, 4, 4) + "\n";
         EXPECT_EQ(expected, current);
         if (expected != current) {