|
@@ -50,7 +50,7 @@ TEST(OptionSpaceTest, setVendorSpace) {
|
|
|
EXPECT_TRUE(space.isVendorSpace());
|
|
|
|
|
|
// Override the vendor space flag.
|
|
|
- space.setVendorSpace(false);
|
|
|
+ space.clearVendorSpace();
|
|
|
EXPECT_FALSE(space.isVendorSpace());
|
|
|
}
|
|
|
|
|
@@ -92,4 +92,52 @@ TEST(OptionSpaceTest, validateName) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// The purpose of this test is to verify that the constructors of the
|
|
|
+// OptionSpace6 class set the class members to correct values.
|
|
|
+TEST(OptionSpace6Test, constructor) {
|
|
|
+ // Create some option space and do not specify enterprise number.
|
|
|
+ // In such case the vendor space flag is expected to be
|
|
|
+ // set to false.
|
|
|
+ OptionSpace6 space1("abcd");
|
|
|
+ EXPECT_EQ("abcd", space1.getName());
|
|
|
+ EXPECT_FALSE(space1.isVendorSpace());
|
|
|
+
|
|
|
+ // Create an option space and specify an enterprise number. In this
|
|
|
+ // case the vendor space flag is expected to be set to true and the
|
|
|
+ // enterprise number should be set to a desired value.
|
|
|
+ OptionSpace6 space2("abcd", 2145);
|
|
|
+ EXPECT_EQ("abcd", space2.getName());
|
|
|
+ EXPECT_TRUE(space2.isVendorSpace());
|
|
|
+ EXPECT_EQ(2145, space2.getEnterpriseNumber());
|
|
|
+
|
|
|
+ // Verify that constructors throw an exception when invalid option
|
|
|
+ // space name has been specified.
|
|
|
+ EXPECT_THROW(OptionSpace6("isc dhcp"), InvalidOptionSpace);
|
|
|
+ EXPECT_THROW(OptionSpace6("isc%dhcp", 2145), InvalidOptionSpace);
|
|
|
+}
|
|
|
+
|
|
|
+// The purpose of this test is to verify an option space can be marked
|
|
|
+// vendor option space and enterprise number can be set.
|
|
|
+TEST(OptionSpace6Test, setVendorSpace) {
|
|
|
+ OptionSpace6 space("isc");
|
|
|
+ EXPECT_EQ("isc", space.getName());
|
|
|
+ EXPECT_FALSE(space.isVendorSpace());
|
|
|
+
|
|
|
+ // Mark it vendor option space and set enterprise id.
|
|
|
+ space.setVendorSpace(1234);
|
|
|
+ EXPECT_TRUE(space.isVendorSpace());
|
|
|
+ EXPECT_EQ(1234, space.getEnterpriseNumber());
|
|
|
+
|
|
|
+ // Override the enterprise number to make sure and make sure that
|
|
|
+ // the new number is returned by the object.
|
|
|
+ space.setVendorSpace(2345);
|
|
|
+ EXPECT_TRUE(space.isVendorSpace());
|
|
|
+ EXPECT_EQ(2345, space.getEnterpriseNumber());
|
|
|
+
|
|
|
+ // Clear the vendor option space flag.
|
|
|
+ space.clearVendorSpace();
|
|
|
+ EXPECT_FALSE(space.isVendorSpace());
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
}; // end of anonymous namespace
|