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);
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) {
-// 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
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) {
-// 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
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) {