|
@@ -41,61 +41,74 @@ namespace {
|
|
|
TEST(ValueStorageTest, BooleanTesting) {
|
|
|
BooleanStorage testStore;
|
|
|
|
|
|
- // verify that we can add and retrieve them
|
|
|
+ // Verify that we can add and retrieve parameters.
|
|
|
testStore.setParam("firstBool", false);
|
|
|
testStore.setParam("secondBool", true);
|
|
|
|
|
|
EXPECT_FALSE(testStore.getParam("firstBool"));
|
|
|
EXPECT_TRUE(testStore.getParam("secondBool"));
|
|
|
|
|
|
- // verify that we can update them
|
|
|
+ // Verify that we can update paramaters.
|
|
|
testStore.setParam("firstBool", true);
|
|
|
testStore.setParam("secondBool", false);
|
|
|
|
|
|
EXPECT_TRUE(testStore.getParam("firstBool"));
|
|
|
EXPECT_FALSE(testStore.getParam("secondBool"));
|
|
|
|
|
|
- // verify that we can delete one
|
|
|
+ // Verify that we can delete a parameter and it will no longer be found.
|
|
|
testStore.delParam("firstBool");
|
|
|
ASSERT_THROW(testStore.getParam("firstBool"), isc::dhcp::DhcpConfigError);
|
|
|
|
|
|
- // verify that the delete was safe
|
|
|
+ // Verify that the delete was safe and the store still operates.
|
|
|
EXPECT_FALSE(testStore.getParam("secondBool"));
|
|
|
|
|
|
- // verify that we can empty the list
|
|
|
+ // Verify that looking for a parameter that never existed throws.
|
|
|
+ ASSERT_THROW(testStore.getParam("bogusBool"), isc::dhcp::DhcpConfigError);
|
|
|
+
|
|
|
+ // Verify that attempting to delete a parameter that never existed does not throw.
|
|
|
+ ASSERT_NO_THROW(testStore.delParam("bogusBool"));
|
|
|
+
|
|
|
+ // Verify that we can empty the list.
|
|
|
testStore.clear();
|
|
|
ASSERT_THROW(testStore.getParam("secondBool"), isc::dhcp::DhcpConfigError);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// This test verifies that Uint32Storage functions properly.
|
|
|
TEST(ValueStorageTest, Uint32Testing) {
|
|
|
Uint32Storage testStore;
|
|
|
|
|
|
- uint32_t intOne = -77;
|
|
|
+ uint32_t intOne = 77;
|
|
|
uint32_t intTwo = 33;
|
|
|
|
|
|
- // verify that we can add and retrieve them
|
|
|
+ // Verify that we can add and retrieve parameters.
|
|
|
testStore.setParam("firstInt", intOne);
|
|
|
testStore.setParam("secondInt", intTwo);
|
|
|
|
|
|
EXPECT_EQ(testStore.getParam("firstInt"), intOne);
|
|
|
EXPECT_EQ(testStore.getParam("secondInt"), intTwo);
|
|
|
|
|
|
- // verify that we can update them
|
|
|
+ // Verify that we can update parameters.
|
|
|
testStore.setParam("firstInt", --intOne);
|
|
|
testStore.setParam("secondInt", ++intTwo);
|
|
|
|
|
|
EXPECT_EQ(testStore.getParam("firstInt"), intOne);
|
|
|
EXPECT_EQ(testStore.getParam("secondInt"), intTwo);
|
|
|
|
|
|
- // verify that we can delete one
|
|
|
+ // Verify that we can delete a parameter and it will no longer be found.
|
|
|
testStore.delParam("firstInt");
|
|
|
ASSERT_THROW(testStore.getParam("firstInt"), isc::dhcp::DhcpConfigError);
|
|
|
|
|
|
- // verify that the delete was safe
|
|
|
+ // Verify that the delete was safe and the store still operates.
|
|
|
EXPECT_EQ(testStore.getParam("secondInt"), intTwo);
|
|
|
|
|
|
- // verify that we can empty the list
|
|
|
+ // Verify that looking for a parameter that never existed throws.
|
|
|
+ ASSERT_THROW(testStore.getParam("bogusInt"), isc::dhcp::DhcpConfigError);
|
|
|
+
|
|
|
+ // Verify that attempting to delete a parameter that never existed does not throw.
|
|
|
+ ASSERT_NO_THROW(testStore.delParam("bogusInt"));
|
|
|
+
|
|
|
+ // Verify that we can empty the list.
|
|
|
testStore.clear();
|
|
|
ASSERT_THROW(testStore.getParam("secondInt"), isc::dhcp::DhcpConfigError);
|
|
|
}
|
|
@@ -107,14 +120,14 @@ TEST(ValueStorageTest, StringTesting) {
|
|
|
std::string stringOne = "seventy-seven";
|
|
|
std::string stringTwo = "thirty-three";
|
|
|
|
|
|
- // verify that we can add and retrieve them
|
|
|
+ // Verify that we can add and retrieve parameters.
|
|
|
testStore.setParam("firstString", stringOne);
|
|
|
testStore.setParam("secondString", stringTwo);
|
|
|
|
|
|
EXPECT_EQ(testStore.getParam("firstString"), stringOne);
|
|
|
EXPECT_EQ(testStore.getParam("secondString"), stringTwo);
|
|
|
|
|
|
- // verify that we can update them
|
|
|
+ // Verify that we can update parameters.
|
|
|
stringOne.append("-boo");
|
|
|
stringTwo.append("-boo");
|
|
|
|
|
@@ -124,14 +137,20 @@ TEST(ValueStorageTest, StringTesting) {
|
|
|
EXPECT_EQ(testStore.getParam("firstString"), stringOne);
|
|
|
EXPECT_EQ(testStore.getParam("secondString"), stringTwo);
|
|
|
|
|
|
- // verify that we can delete one
|
|
|
+ // Verify that we can delete a parameter and it will no longer be found.
|
|
|
testStore.delParam("firstString");
|
|
|
ASSERT_THROW(testStore.getParam("firstString"), isc::dhcp::DhcpConfigError);
|
|
|
|
|
|
- // verify that the delete was safe
|
|
|
+ // Verify that the delete was safe and the store still operates.
|
|
|
EXPECT_EQ(testStore.getParam("secondString"), stringTwo);
|
|
|
|
|
|
- // verify that we can empty the list
|
|
|
+ // Verify that looking for a parameter that never existed throws.
|
|
|
+ ASSERT_THROW(testStore.getParam("bogusString"), isc::dhcp::DhcpConfigError);
|
|
|
+
|
|
|
+ // Verify that attempting to delete a parameter that never existed does not throw.
|
|
|
+ ASSERT_NO_THROW(testStore.delParam("bogusString"));
|
|
|
+
|
|
|
+ // Verify that we can empty the list.
|
|
|
testStore.clear();
|
|
|
ASSERT_THROW(testStore.getParam("secondString"), isc::dhcp::DhcpConfigError);
|
|
|
}
|