From: Francis Dupont Date: Sat, 14 Oct 2017 17:36:04 +0000 (+0200) Subject: [5297] Addressed point 4- X-Git-Tag: Kea-1.3.0~2^2~1^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ba8af1a550b4d3ad9288f1ca4a3e38d1297d97a;p=thirdparty%2Fkea.git [5297] Addressed point 4- --- diff --git a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc index 6ddfa7a93f..5d5934a6ff 100644 --- a/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc @@ -941,6 +941,30 @@ TEST_F(HostReservationParserTest, dhcp6NullPrefix2) { testInvalidConfig(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(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(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(config); +} + // This test verifies that the configuration parser throws an exception // when the same address is reserved twice. TEST_F(HostReservationParserTest, dhcp6DuplicatedAddress) {