BIND 10 trac980, updated. 55689c559b3ac60765940d64a5b51007f94bddf7 [trac980] Both abbreviated forms at once tested
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jun 21 12:22:43 UTC 2011
The branch, trac980 has been updated
via 55689c559b3ac60765940d64a5b51007f94bddf7 (commit)
from 3f47015eab1abd9c7193a9e740f794c6a718c9f7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 55689c559b3ac60765940d64a5b51007f94bddf7
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Jun 21 14:16:56 2011 +0200
[trac980] Both abbreviated forms at once tested
-----------------------------------------------------------------------
Summary of changes:
src/lib/acl/tests/loader_test.cc | 41 +++++++++++++++++++++++++++++++------
1 files changed, 34 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/acl/tests/loader_test.cc b/src/lib/acl/tests/loader_test.cc
index 3481ce1..7dc088d 100644
--- a/src/lib/acl/tests/loader_test.cc
+++ b/src/lib/acl/tests/loader_test.cc
@@ -139,9 +139,8 @@ public:
EXPECT_THROW(loader_.load(el(JSON)), LoaderError);
}
// Check that the subexpression is NamedCheck with correct data
- void isSubexprNamed(const shared_ptr<CompoundCheck<Log> >& compound,
- size_t index, const string& name,
- ConstElementPtr data)
+ void isSubexprNamed(const CompoundCheck<Log>* compound, size_t index,
+ const string& name, ConstElementPtr data)
{
if (index < compound->getSubexpressions().size()) {
const NamedCheck*
@@ -244,8 +243,8 @@ TEST_F(LoaderTest, AndAbbrev) {
// elements, which is in the lexicographical order of the strings.
// This is not required from our interface, but is easier to write
// the test.
- isSubexprNamed(oper, 0, "name1", el("1"));
- isSubexprNamed(oper, 1, "name2", el("2"));
+ isSubexprNamed(&*oper, 0, "name1", el("1"));
+ isSubexprNamed(&*oper, 1, "name2", el("2"));
}
}
@@ -259,8 +258,36 @@ TEST_F(LoaderTest, OrAbbrev) {
if (oper) {
// The subexpressions are correct
EXPECT_EQ(2, oper->getSubexpressions().size());
- isSubexprNamed(oper, 0, "name1", el("1"));
- isSubexprNamed(oper, 1, "name1", el("2"));
+ isSubexprNamed(&*oper, 0, "name1", el("1"));
+ isSubexprNamed(&*oper, 1, "name1", el("2"));
+ }
+}
+
+// Combined abbreviated form, both at once
+
+// The abbreviated form of check
+TEST_F(LoaderTest, BothAbbrev) {
+ addNamed("name1");
+ addNamed("name2");
+ shared_ptr<LogicOperator<AllOfSpec, Log> > oper(
+ loadCheckAny<LogicOperator<AllOfSpec, Log> >("{\"name1\": 1, \"name2\": [3, 4]}"));
+ // If we don't have anything loaded, the rest would crash. It is already
+ // reported from within loadCheckAny if it isn't loaded.
+ if (oper) {
+ // The subexpressions are correct
+ ASSERT_EQ(2, oper->getSubexpressions().size());
+ // Note: this test relies on the ordering in which map returns it's
+ // elements, which is in the lexicographical order of the strings.
+ // This is not required from our interface, but is easier to write
+ // the test.
+ isSubexprNamed(&*oper, 0, "name1", el("1"));
+ const LogicOperator<AnyOfSpec, Log>*
+ orOper(dynamic_cast<const LogicOperator<AnyOfSpec, Log>*>(
+ oper->getSubexpressions()[1]));
+ ASSERT_TRUE(orOper) << "Different type than AnyOf operator";
+ EXPECT_EQ(2, orOper->getSubexpressions().size());
+ isSubexprNamed(orOper, 0, "name2", el("3"));
+ isSubexprNamed(orOper, 1, "name2", el("4"));
}
}
More information about the bind10-changes
mailing list