summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcp/tests/pkt4_unittest.cc
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2015-12-11 16:13:18 +0100
committerMarcin Siodelski <marcin@isc.org>2015-12-11 16:13:18 +0100
commitcea271d0ee61dcf54fe6940cd58cb327c16c7d49 (patch)
treede2a653f9532b7c3b775ec3b32c879845672904b /src/lib/dhcp/tests/pkt4_unittest.cc
parent[4206b] Minor updates to the Pkt4::getLabel method. (diff)
downloadkea-cea271d0ee61dcf54fe6940cd58cb327c16c7d49.tar.xz
kea-cea271d0ee61dcf54fe6940cd58cb327c16c7d49.zip
[4206b] Added unit tests for malfromed client id in getLabel.
Diffstat (limited to 'src/lib/dhcp/tests/pkt4_unittest.cc')
-rw-r--r--src/lib/dhcp/tests/pkt4_unittest.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/dhcp/tests/pkt4_unittest.cc b/src/lib/dhcp/tests/pkt4_unittest.cc
index 36f2b353f6..4d0382d04e 100644
--- a/src/lib/dhcp/tests/pkt4_unittest.cc
+++ b/src/lib/dhcp/tests/pkt4_unittest.cc
@@ -1024,6 +1024,19 @@ TEST_F(Pkt4Test, getLabel) {
}
+// Test that empty client identifier option doesn't cause an exception from
+// Pkt4::getLabel.
+TEST_F(Pkt4Test, getLabelEmptyClientId) {
+ Pkt4 pkt(DHCPOFFER, 1234);
+
+ // Create empty client identifier option.
+ OptionPtr empty_opt(new Option(Option::V4, DHO_DHCP_CLIENT_IDENTIFIER));
+ pkt.addOption(empty_opt);
+
+ EXPECT_EQ("[hwtype=1 ], cid=[no info], tid=0x4d2"
+ " (malformed client-id)", pkt.getLabel());
+}
+
// Tests that the variant of makeLabel which doesn't include transaction
// id produces expected output.
TEST_F(Pkt4Test, makeLabelWithoutTransactionId) {