]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5297] Addressed point 4-
authorFrancis Dupont <fdupont@isc.org>
Sat, 14 Oct 2017 17:36:04 +0000 (19:36 +0200)
committerFrancis Dupont <fdupont@isc.org>
Sat, 14 Oct 2017 17:36:04 +0000 (19:36 +0200)
src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc

index 6ddfa7a93fdc519c27360d40f515c753fe50ddbe..5d5934a6ff95b6883d815b865cc1514e9b1436c7 100644 (file)
@@ -941,6 +941,30 @@ TEST_F(HostReservationParserTest, dhcp6NullPrefix2) {
     testInvalidConfig<HostReservationParser6>(config);
 }
 
+// This test verifies that the configuration parser throws an exception
+// when slash is missing for the prefix..
+TEST_F(HostReservationParserTest, dhcp6NullPrefix3) {
+    std::string config = "{ \"duid\": \"01:02:03:04:05:06:07:08:09:0A\","
+        "\"prefixes\": [ \"2001:db8:2000:0101::\" ] }";
+    testInvalidConfig<HostReservationParser6>(config);
+}
+
+// This test verifies that the configuration parser throws an exception
+// when slash is followed by nothing for the prefix..
+TEST_F(HostReservationParserTest, dhcp6NullPrefix4) {
+    std::string config = "{ \"duid\": \"01:02:03:04:05:06:07:08:09:0A\","
+        "\"prefixes\": [ \"2001:db8:2000:0101::/\" ] }";
+    testInvalidConfig<HostReservationParser6>(config);
+}
+
+// This test verifies that the configuration parser throws an exception
+// when slash is not followed by a number for the prefix..
+TEST_F(HostReservationParserTest, dhcp6NullPrefix5) {
+    std::string config = "{ \"duid\": \"01:02:03:04:05:06:07:08:09:0A\","
+        "\"prefixes\": [ \"2001:db8:2000:0101::/foo\" ] }";
+    testInvalidConfig<HostReservationParser6>(config);
+}
+
 // This test verifies that the configuration parser throws an exception
 // when the same address is reserved twice.
 TEST_F(HostReservationParserTest, dhcp6DuplicatedAddress) {