Commit c2fb21d9 authored by JINMEI Tatuya's avatar JINMEI Tatuya

added test/documentation for operator= and copy constructor

(trac ticket #47, reviewed by Evan)


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@788 e5f2f494-b856-4b98-b285-d166d9295462
parent eb27d3af
......@@ -261,7 +261,11 @@ public:
/// \param buffer A buffer storing the wire format data.
/// \param downcase Whether to convert upper case alphabets to lower case.
explicit Name(InputBuffer& buffer, bool downcase = false);
///
/// We use the default copy constructor intentionally.
//@}
/// We use the default copy assignment operator intentionally.
///
///
/// \name Getter Methods
......
......@@ -266,6 +266,36 @@ TEST_F(NameTest, fromWire)
25).getLabelCount());
}
TEST_F(NameTest, copyConstruct)
{
Name copy(example_name);
EXPECT_EQ(copy, example_name);
// Check the copied data is valid even after the original is deleted
Name* copy2 = new Name(example_name);
Name copy3(*copy2);
delete copy2;
EXPECT_EQ(copy3, example_name);
}
TEST_F(NameTest, assignment)
{
Name copy(".");
copy = example_name;
EXPECT_EQ(copy, example_name);
// Check if the copied data is valid even after the original is deleted
Name* copy2 = new Name(example_name);
Name copy3(".");
copy3 = *copy2;
delete copy2;
EXPECT_EQ(copy3, example_name);
// Self assignment
copy = copy;
EXPECT_EQ(copy, example_name);
}
TEST_F(NameTest, toText)
{
// tests derived from BIND9
......
Markdown is supported
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