Commit c85f9765 authored by Razvan Becheriu's avatar Razvan Becheriu

[#1265] fixed comments and added asserts

parent 0d006d31
......@@ -433,6 +433,7 @@ TEST_F(JSONFileBackendTest, jsonFile) {
// Check subnet 1.
auto subnet = subnets->begin();
ASSERT_TRUE(subnet != subnets->end());
EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText());
EXPECT_EQ(24, (*subnet)->get().second);
......@@ -445,6 +446,7 @@ TEST_F(JSONFileBackendTest, jsonFile) {
// Check subnet 2.
++subnet;
ASSERT_TRUE(subnet != subnets->end());
EXPECT_EQ("192.0.3.0", (*subnet)->get().first.toText());
EXPECT_EQ(24, (*subnet)->get().second);
......@@ -457,6 +459,7 @@ TEST_F(JSONFileBackendTest, jsonFile) {
// And finally check subnet 3.
++subnet;
ASSERT_TRUE(subnet != subnets->end());
EXPECT_EQ("192.0.4.0", (*subnet)->get().first.toText());
EXPECT_EQ(24, (*subnet)->get().second);
......@@ -506,6 +509,7 @@ TEST_F(JSONFileBackendTest, hashComments) {
// Check subnet 1.
auto subnet = subnets->begin();
ASSERT_TRUE(subnet != subnets->end());
EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText());
EXPECT_EQ(22, (*subnet)->get().second);
......@@ -556,6 +560,7 @@ TEST_F(JSONFileBackendTest, cppLineComments) {
// Check subnet 1.
auto subnet = subnets->begin();
ASSERT_TRUE(subnet != subnets->end());
EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText());
EXPECT_EQ(22, (*subnet)->get().second);
......@@ -606,6 +611,7 @@ TEST_F(JSONFileBackendTest, cBlockComments) {
// Check subnet 1.
auto subnet = subnets->begin();
ASSERT_TRUE(subnet != subnets->end());
EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText());
EXPECT_EQ(22, (*subnet)->get().second);
......@@ -656,6 +662,7 @@ TEST_F(JSONFileBackendTest, include) {
// Check subnet 1.
auto subnet = subnets->begin();
ASSERT_TRUE(subnet != subnets->end());
EXPECT_EQ("192.0.2.0", (*subnet)->get().first.toText());
EXPECT_EQ(22, (*subnet)->get().second);
......
......@@ -175,6 +175,7 @@ typedef boost::shared_ptr<TestCBControlDHCPv6> TestCBControlDHCPv6Ptr;
/// @c CBControlDHCPv6 object.
class NakedControlledDhcpv6Srv: public ControlledDhcpv6Srv {
public:
/// @brief Constructor.
NakedControlledDhcpv6Srv()
: ControlledDhcpv6Srv(0) {
......@@ -399,6 +400,7 @@ TEST_F(JSONFileBackendTest, jsonFile) {
" } ],"
"\"valid-lifetime\": 4000 }"
"}";
writeFile(TEST_FILE, config);
// Now initialize the server
......@@ -416,7 +418,6 @@ TEST_F(JSONFileBackendTest, jsonFile) {
ASSERT_TRUE(subnets);
ASSERT_EQ(3, subnets->size()); // We expect 3 subnets.
// Check subnet 1.
auto subnet = subnets->begin();
ASSERT_TRUE(subnet != subnets->end());
......@@ -485,7 +486,7 @@ TEST_F(JSONFileBackendTest, hashComments) {
srv.reset(new ControlledDhcpv6Srv(0))
);
// And configure it using config without
// And configure it using config with comments.
EXPECT_NO_THROW(srv->init(TEST_FILE));
// Now check if the configuration has been applied correctly.
......@@ -537,7 +538,7 @@ TEST_F(JSONFileBackendTest, cppLineComments) {
srv.reset(new ControlledDhcpv6Srv(0))
);
// And configure it using config without
// And configure it using config with comments.
EXPECT_NO_THROW(srv->init(TEST_FILE));
// Now check if the configuration has been applied correctly.
......@@ -589,7 +590,7 @@ TEST_F(JSONFileBackendTest, cBlockComments) {
srv.reset(new ControlledDhcpv6Srv(0))
);
// And configure it using config without
// And configure it using config with comments.
EXPECT_NO_THROW(srv->init(TEST_FILE));
// Now check if the configuration has been applied correctly.
......@@ -641,7 +642,7 @@ TEST_F(JSONFileBackendTest, include) {
srv.reset(new ControlledDhcpv6Srv(0))
);
// And configure it using config without
// And configure it using config with comments.
EXPECT_NO_THROW(srv->init(TEST_FILE));
// Now check if the configuration has been applied correctly.
......@@ -687,14 +688,13 @@ TEST_F(JSONFileBackendTest, recursiveInclude) {
writeFile(TEST_FILE, config_recursive_include);
writeFile(TEST_INCLUDE, include);
// Now initialize the server
boost::scoped_ptr<ControlledDhcpv6Srv> srv;
ASSERT_NO_THROW(
srv.reset(new ControlledDhcpv6Srv(0))
);
// And configure it using config
// And configure it using config with comments.
try {
srv->init(TEST_FILE);
FAIL() << "Expected Dhcp6ParseError but nothing was raised";
......@@ -704,7 +704,6 @@ TEST_F(JSONFileBackendTest, recursiveInclude) {
}
}
// This test checks if configuration can be read from a JSON file.
// This test checks if configuration detects failure when trying:
// - empty file
// - empty filename
......@@ -895,7 +894,6 @@ TEST_F(JSONFileBackendTest, defaultLeaseDbBackend) {
EXPECT_NO_THROW(static_cast<void>(LeaseMgrFactory::instance()));
}
// This test verifies that the timer triggering configuration updates
// is invoked according to the configured value of the
// config-fetch-wait-time.
......@@ -958,7 +956,7 @@ public:
///
/// Destroys MySQL schema.
virtual ~JSONFileBackendMySQLTest() {
// If data wipe enabled, delete transient data otherwise destroy the schema
// If data wipe enabled, delete transient data otherwise destroy the schema.
destroyMySQLSchema();
}
......
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