Commit 79df5509 authored by Marcin Siodelski's avatar Marcin Siodelski

[3439] Addressed review comments.

Removed unused template parameter from functions in dhcp_parsers test.
parent 643f0f1b
...@@ -1053,8 +1053,7 @@ public: ...@@ -1053,8 +1053,7 @@ public:
/// to another context. /// to another context.
/// @param values A storage holding value to be checked. /// @param values A storage holding value to be checked.
/// @tparam ContainerType A type of the storage. /// @tparam ContainerType A type of the storage.
/// @tparam ValueType A type of the value in the container. template<typename ContainerType>
template<typename ContainerType, typename ValueType>
void checkValueEq(const boost::shared_ptr<ContainerType>& ref_values, void checkValueEq(const boost::shared_ptr<ContainerType>& ref_values,
const boost::shared_ptr<ContainerType>& values) { const boost::shared_ptr<ContainerType>& values) {
ASSERT_NO_THROW(values->getParam("foo")); ASSERT_NO_THROW(values->getParam("foo"));
...@@ -1070,8 +1069,7 @@ public: ...@@ -1070,8 +1069,7 @@ public:
/// to another context. /// to another context.
/// @param values A storage holding position to be checked. /// @param values A storage holding position to be checked.
/// @tparam ContainerType A type of the storage. /// @tparam ContainerType A type of the storage.
/// @tparam ValueType A type of the value in the container. template<typename ContainerType>
template<typename ContainerType, typename ValueType>
void checkPositionEq(const std::string& name, void checkPositionEq(const std::string& name,
const boost::shared_ptr<ContainerType>& ref_values, const boost::shared_ptr<ContainerType>& ref_values,
const boost::shared_ptr<ContainerType>& values) { const boost::shared_ptr<ContainerType>& values) {
...@@ -1098,7 +1096,7 @@ public: ...@@ -1098,7 +1096,7 @@ public:
/// @param values A storage holding value to be checked. /// @param values A storage holding value to be checked.
/// @tparam ContainerType A type of the storage. /// @tparam ContainerType A type of the storage.
/// @tparam ValueType A type of the value in the container. /// @tparam ValueType A type of the value in the container.
template<typename ContainerType, typename ValueType> template<typename ContainerType>
void checkValueNeq(const boost::shared_ptr<ContainerType>& ref_values, void checkValueNeq(const boost::shared_ptr<ContainerType>& ref_values,
const boost::shared_ptr<ContainerType>& values) { const boost::shared_ptr<ContainerType>& values) {
ASSERT_NO_THROW(values->getParam("foo")); ASSERT_NO_THROW(values->getParam("foo"));
...@@ -1114,8 +1112,7 @@ public: ...@@ -1114,8 +1112,7 @@ public:
/// to another context. /// to another context.
/// @param values A storage holding position to be checked. /// @param values A storage holding position to be checked.
/// @tparam ContainerType A type of the storage. /// @tparam ContainerType A type of the storage.
/// @tparam ValueType A type of the value in the container. template<typename ContainerType>
template<typename ContainerType, typename ValueType>
void checkPositionNeq(const std::string& name, void checkPositionNeq(const std::string& name,
const boost::shared_ptr<ContainerType>& ref_values, const boost::shared_ptr<ContainerType>& ref_values,
const boost::shared_ptr<ContainerType>& values) { const boost::shared_ptr<ContainerType>& values) {
...@@ -1274,19 +1271,18 @@ public: ...@@ -1274,19 +1271,18 @@ public:
{ {
SCOPED_TRACE("Check that boolean values are equal in both" SCOPED_TRACE("Check that boolean values are equal in both"
" contexts"); " contexts");
checkValueEq<BooleanStorage, bool>(ctx.boolean_values_, checkValueEq(ctx.boolean_values_, ctx_new->boolean_values_);
ctx_new->boolean_values_);
} }
// New context has the same boolean values' positions. // New context has the same boolean values' positions.
{ {
SCOPED_TRACE("Check that positions of boolean values are equal" SCOPED_TRACE("Check that positions of boolean values are equal"
" in both contexts"); " in both contexts");
checkPositionEq<BooleanStorage, bool>("pos0", ctx.boolean_values_, checkPositionEq("pos0", ctx.boolean_values_,
ctx_new->boolean_values_); ctx_new->boolean_values_);
checkPositionEq<BooleanStorage, bool>("pos1", ctx.boolean_values_, checkPositionEq("pos1", ctx.boolean_values_,
ctx_new->boolean_values_); ctx_new->boolean_values_);
checkPositionEq<BooleanStorage, bool>("pos2", ctx.boolean_values_, checkPositionEq("pos2", ctx.boolean_values_,
ctx_new->boolean_values_); ctx_new->boolean_values_);
} }
...@@ -1295,19 +1291,18 @@ public: ...@@ -1295,19 +1291,18 @@ public:
{ {
SCOPED_TRACE("Check that uint32_t values are equal in both" SCOPED_TRACE("Check that uint32_t values are equal in both"
" contexts"); " contexts");
checkValueEq<Uint32Storage, uint32_t>(ctx.uint32_values_, checkValueEq(ctx.uint32_values_, ctx_new->uint32_values_);
ctx_new->uint32_values_);
} }
// New context has the same uint32 values' positions. // New context has the same uint32 values' positions.
{ {
SCOPED_TRACE("Check that positions of uint32 values are equal" SCOPED_TRACE("Check that positions of uint32 values are equal"
" in both contexts"); " in both contexts");
checkPositionEq<Uint32Storage, bool>("pos0", ctx.uint32_values_, checkPositionEq("pos0", ctx.uint32_values_,
ctx_new->uint32_values_); ctx_new->uint32_values_);
checkPositionEq<Uint32Storage, bool>("pos1", ctx.uint32_values_, checkPositionEq("pos1", ctx.uint32_values_,
ctx_new->uint32_values_); ctx_new->uint32_values_);
checkPositionEq<Uint32Storage, bool>("pos2", ctx.uint32_values_, checkPositionEq("pos2", ctx.uint32_values_,
ctx_new->uint32_values_); ctx_new->uint32_values_);
} }
...@@ -1315,27 +1310,25 @@ public: ...@@ -1315,27 +1310,25 @@ public:
{ {
SCOPED_TRACE("Check that positions of uint32_t values are equal" SCOPED_TRACE("Check that positions of uint32_t values are equal"
" in both contexts"); " in both contexts");
checkPositionEq<Uint32Storage, uint32_t>("foo", ctx.uint32_values_, checkPositionEq("foo", ctx.uint32_values_, ctx_new->uint32_values_);
ctx_new->uint32_values_);
} }
// New context has the same string value. // New context has the same string value.
ASSERT_TRUE(ctx_new->string_values_); ASSERT_TRUE(ctx_new->string_values_);
{ {
SCOPED_TRACE("Check that string values are equal in both contexts"); SCOPED_TRACE("Check that string values are equal in both contexts");
checkValueEq<StringStorage, std::string>(ctx.string_values_, checkValueEq(ctx.string_values_, ctx_new->string_values_);
ctx_new->string_values_);
} }
// New context has the same string values' positions. // New context has the same string values' positions.
{ {
SCOPED_TRACE("Check that positions of string values are equal" SCOPED_TRACE("Check that positions of string values are equal"
" in both contexts"); " in both contexts");
checkPositionEq<StringStorage, bool>("pos0", ctx.string_values_, checkPositionEq("pos0", ctx.string_values_,
ctx_new->string_values_); ctx_new->string_values_);
checkPositionEq<StringStorage, bool>("pos1", ctx.string_values_, checkPositionEq("pos1", ctx.string_values_,
ctx_new->string_values_); ctx_new->string_values_);
checkPositionEq<StringStorage, bool>("pos2", ctx.string_values_, checkPositionEq("pos2", ctx.string_values_,
ctx_new->string_values_); ctx_new->string_values_);
} }
...@@ -1373,8 +1366,7 @@ public: ...@@ -1373,8 +1366,7 @@ public:
ctx.boolean_values_->setParam("foo", false, ctx.boolean_values_->setParam("foo", false,
Element::Position("kea.conf", Element::Position("kea.conf",
12, 10)); 12, 10));
checkValueNeq<BooleanStorage, bool>(ctx.boolean_values_, checkValueNeq(ctx.boolean_values_, ctx_new->boolean_values_);
ctx_new->boolean_values_);
} }
...@@ -1386,19 +1378,19 @@ public: ...@@ -1386,19 +1378,19 @@ public:
ctx.boolean_values_->setParam("pos0", false, ctx.boolean_values_->setParam("pos0", false,
Element::Position("foo.conf", Element::Position("foo.conf",
1, 2)); 1, 2));
checkPositionNeq<BooleanStorage, bool>("pos0", ctx.boolean_values_, checkPositionNeq("pos0", ctx.boolean_values_,
ctx_new->boolean_values_); ctx_new->boolean_values_);
// Modify line number. // Modify line number.
ctx.boolean_values_->setParam("pos1", false, ctx.boolean_values_->setParam("pos1", false,
Element::Position("kea.conf", Element::Position("kea.conf",
11, 20)); 11, 20));
checkPositionNeq<BooleanStorage, bool>("pos1", ctx.boolean_values_, checkPositionNeq("pos1", ctx.boolean_values_,
ctx_new->boolean_values_); ctx_new->boolean_values_);
// Modify position within a line. // Modify position within a line.
ctx.boolean_values_->setParam("pos2", false, ctx.boolean_values_->setParam("pos2", false,
Element::Position("kea.conf", Element::Position("kea.conf",
101, 201)); 101, 201));
checkPositionNeq<BooleanStorage, bool>("pos2", ctx.boolean_values_, checkPositionNeq("pos2", ctx.boolean_values_,
ctx_new->boolean_values_); ctx_new->boolean_values_);
} }
...@@ -1410,8 +1402,7 @@ public: ...@@ -1410,8 +1402,7 @@ public:
" value and position is changed"); " value and position is changed");
ctx.uint32_values_->setParam("foo", 987, ctx.uint32_values_->setParam("foo", 987,
Element::Position("kea.conf", 10, 11)); Element::Position("kea.conf", 10, 11));
checkValueNeq<Uint32Storage, uint32_t>(ctx.uint32_values_, checkValueNeq(ctx.uint32_values_, ctx_new->uint32_values_);
ctx_new->uint32_values_);
} }
{ {
...@@ -1421,19 +1412,19 @@ public: ...@@ -1421,19 +1412,19 @@ public:
// Modify file name. // Modify file name.
ctx.uint32_values_->setParam("pos0", 123, ctx.uint32_values_->setParam("pos0", 123,
Element::Position("foo.conf", 1, 2)); Element::Position("foo.conf", 1, 2));
checkPositionNeq<Uint32Storage, bool>("pos0", ctx.uint32_values_, checkPositionNeq("pos0", ctx.uint32_values_,
ctx_new->uint32_values_); ctx_new->uint32_values_);
// Modify line number. // Modify line number.
ctx.uint32_values_->setParam("pos1", 123, ctx.uint32_values_->setParam("pos1", 123,
Element::Position("kea.conf", Element::Position("kea.conf",
11, 20)); 11, 20));
checkPositionNeq<Uint32Storage, bool>("pos1", ctx.uint32_values_, checkPositionNeq("pos1", ctx.uint32_values_,
ctx_new->uint32_values_); ctx_new->uint32_values_);
// Modify position within a line. // Modify position within a line.
ctx.uint32_values_->setParam("pos2", 123, ctx.uint32_values_->setParam("pos2", 123,
Element::Position("kea.conf", Element::Position("kea.conf",
101, 201)); 101, 201));
checkPositionNeq<Uint32Storage, bool>("pos2", ctx.uint32_values_, checkPositionNeq("pos2", ctx.uint32_values_,
ctx_new->uint32_values_); ctx_new->uint32_values_);
} }
...@@ -1445,8 +1436,7 @@ public: ...@@ -1445,8 +1436,7 @@ public:
" value and position is changed"); " value and position is changed");
ctx.string_values_->setParam("foo", "different string", ctx.string_values_->setParam("foo", "different string",
Element::Position("kea.conf", 10, 11)); Element::Position("kea.conf", 10, 11));
checkValueNeq<StringStorage, std::string>(ctx.string_values_, checkValueNeq(ctx.string_values_, ctx_new->string_values_);
ctx_new->string_values_);
} }
{ {
...@@ -1456,19 +1446,19 @@ public: ...@@ -1456,19 +1446,19 @@ public:
// Modify file name. // Modify file name.
ctx.string_values_->setParam("pos0", "some string", ctx.string_values_->setParam("pos0", "some string",
Element::Position("foo.conf", 1, 2)); Element::Position("foo.conf", 1, 2));
checkPositionNeq<StringStorage, bool>("pos0", ctx.string_values_, checkPositionNeq("pos0", ctx.string_values_,
ctx_new->string_values_); ctx_new->string_values_);
// Modify line number. // Modify line number.
ctx.string_values_->setParam("pos1", "some string", ctx.string_values_->setParam("pos1", "some string",
Element::Position("kea.conf", Element::Position("kea.conf",
11, 20)); 11, 20));
checkPositionNeq<StringStorage, bool>("pos1", ctx.string_values_, checkPositionNeq("pos1", ctx.string_values_,
ctx_new->string_values_); ctx_new->string_values_);
// Modify position within a line. // Modify position within a line.
ctx.string_values_->setParam("pos2", "some string", ctx.string_values_->setParam("pos2", "some string",
Element::Position("kea.conf", Element::Position("kea.conf",
101, 201)); 101, 201));
checkPositionNeq<StringStorage, bool>("pos2", ctx.string_values_, checkPositionNeq("pos2", ctx.string_values_,
ctx_new->string_values_); ctx_new->string_values_);
} }
......
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