Parcourir la source

[4291] Added unit test

Francis Dupont il y a 9 ans
Parent
commit
56c63d71b2
1 fichiers modifiés avec 18 ajouts et 1 suppressions
  1. 18 1
      src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc

+ 18 - 1
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 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
@@ -932,6 +932,23 @@ TEST_F(ParseConfigTest, emptyOptionData) {
     ASSERT_EQ(0, opt->getAddresses().size());
 }
 
+// This test verifies an option data without suboptions is supported
+TEST_F(ParseConfigTest, optionDataNoSubOpion) {
+    // Configuration string.
+    const std::string config =
+        "{ \"option-data\": [ {"
+        "    \"name\": \"vendor-encapsulated-options\""
+        " } ]"
+        "}";
+
+    int rcode = 0;
+    ASSERT_NO_THROW(rcode = parseConfiguration(config));
+    EXPECT_EQ(0, rcode);
+    const OptionPtr opt = getOptionPtr("dhcp4", DHO_VENDOR_ENCAPSULATED_OPTIONS);
+    ASSERT_TRUE(opt);
+    ASSERT_EQ(0, opt->getOptions().size());
+}
+
 /// The next set of tests check basic operation of the HooksLibrariesParser.
 //
 // Convenience function to set a configuration of zero or more hooks