Commit 2accef34 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

Merge branch 'trac4027' of github.com:isc-projects/kea into trac4027

with resolving conflict (the HEAD version wasn't complete)
	src/lib/dhcp/tests/pkt4o6_unittest.cc
parents 1084fad9 b8b57816
......@@ -34,7 +34,7 @@ public:
/// @brief Constructor, used in message reception.
///
/// @param pkt4 DHCPv4 message
/// @param pkt4 Content of the DHCPv4-message option
/// @param pkt6 encapsulating unpacked DHCPv6 message
/// the DHCPv4 message option will be removed
Pkt4o6(const OptionBuffer& pkt4, const Pkt6Ptr& pkt6);
......@@ -52,10 +52,10 @@ public:
///
/// Calls pack() on both DHCPv4 and DHCPv6 parts
/// Inserts the DHCPv4-message option
/// @ref pkt4::pack and @ref pkt6::pack
/// @ref Pkt4::pack and @ref Pkt6::pack
virtual void pack();
/// @brief Checks if a DHCPv4 message has beeb transported over DHCPv6
/// @brief Checks if a DHCPv4 message has been transported over DHCPv6
///
/// @return Boolean value which indicates whether the message is
/// transported over DHCPv6 (true) or native DHCPv4 (false)
......
......@@ -27,6 +27,9 @@
using namespace isc::dhcp;
namespace {
/// @brief A Fixture class dedicated to testing of the Pkt4o6 class that
/// represents a DHCPv4-over-DHCPv6 packet.
class Pkt4o6Test : public ::testing::Test {
protected:
Pkt4o6Test() :
......@@ -48,6 +51,7 @@ protected:
OptionBuffer buffer4_; // wire-format data buffer of pkt4_
};
// This test verifies that the constructors are working as expected.
TEST_F(Pkt4o6Test, construct) {
// Construct 4o6 packet, unpack the data to examine it
boost::scoped_ptr<Pkt4o6> pkt4o6(new Pkt4o6(buffer4_, pkt6_));
......@@ -68,6 +72,8 @@ TEST_F(Pkt4o6Test, construct) {
EXPECT_EQ(DHCPDISCOVER, pkt4o6->getType());
}
// This test verifies that the pack() method handles the building
// process correctly.
TEST_F(Pkt4o6Test, pack) {
// prepare unpacked DHCPv4 packet (see the note in constructor test)
pkt4_.reset(new Pkt4(&buffer4_[0], buffer4_.size()));
......@@ -95,4 +101,6 @@ TEST_F(Pkt4o6Test, pack) {
EXPECT_EQ(0, memcmp(&cp[8], &buffer4_[0], buffer4_.size()));
}
/// @todo: Add a test that handles actual DHCP4o6 traffic capture
/// once we get it. We should add the capture to pkt_captures{4,6}.cc
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment