EXPECT_EQ(context, desc_copy->getContext());
}
+// This test verifies that the OptionDescriptor assignment operator
+// does the shallow copy.
+TEST(OptionDescriptorTest, assign) {
+ // Create a persistent option descriptor.
+ auto desc = OptionDescriptor::create(true);
+ ASSERT_TRUE(desc);
+
+ // Create another option descriptor.
+ OptionPtr option = Option::create(Option::V4, 234);
+ ElementPtr context = Element::createMap();
+ context->set("name", Element::create("value"));
+ auto desc1 = OptionDescriptor::create(option, true, "value", context);
+ ASSERT_TRUE(desc1);
+
+ // Assign the option descriptor.
+ desc = desc1;
+
+ // Check it.
+ ASSERT_TRUE(desc);
+ EXPECT_EQ(option, desc->option_);
+ EXPECT_TRUE(desc->persistent_);
+ EXPECT_EQ("value", desc->formatted_value_);
+ EXPECT_EQ(context, desc->getContext());
+}
+
/// This class fixture for testing @c CfgOption class, holding option
/// configuration.
class CfgOptionTest : public ::testing::Test {
-// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
LabelSequence ls9, ls10, ls11, ls12;
};
+// Check the assignment operator.
+TEST_F(LabelSequenceTest, assign) {
+ // Create the label sequence with example.org (n1 name).
+ LabelSequence ls(n1);
+ EXPECT_TRUE(ls == ls1);
+
+ // Assign the label sequence to example.com (n2 name).
+ ls = ls2;
+ EXPECT_FALSE(ls == ls1);
+ EXPECT_TRUE(ls == ls2);
+}
+
// Basic equality tests
TEST_F(LabelSequenceTest, equals_sensitive) {
EXPECT_TRUE(ls1.equals(ls1, true));