BIND 10 trac979, updated. 0f1b7a45520517a40b7b85d57d461e20e81b7aa9 [trac979] Few more tests

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Jun 24 21:29:29 UTC 2011


The branch, trac979 has been updated
       via  0f1b7a45520517a40b7b85d57d461e20e81b7aa9 (commit)
       via  885a4ecf9c87b8e3a028b6488b0e6b853365edc8 (commit)
      from  77367a5d67709b65afd8689159e5192416326cb7 (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 0f1b7a45520517a40b7b85d57d461e20e81b7aa9
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Jun 24 23:29:14 2011 +0200

    [trac979] Few more tests

commit 885a4ecf9c87b8e3a028b6488b0e6b853365edc8
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Jun 24 23:16:42 2011 +0200

    [trac979] Simplification of expression

-----------------------------------------------------------------------

Summary of changes:
 src/lib/acl/logic_check.h             |    2 +-
 src/lib/acl/tests/logic_check_test.cc |   42 +++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/acl/logic_check.h b/src/lib/acl/logic_check.h
index 6d6b420..6e1c567 100644
--- a/src/lib/acl/logic_check.h
+++ b/src/lib/acl/logic_check.h
@@ -83,7 +83,7 @@ public:
         typename CompoundCheck<Context>::Checks result;
         for (typename Checks::const_iterator i(checks_.begin());
              i != checks_.end(); ++i) {
-            result.push_back(&**i);
+            result.push_back(i->get());
         }
         return (result);
     }
diff --git a/src/lib/acl/tests/logic_check_test.cc b/src/lib/acl/tests/logic_check_test.cc
index 5fab196..c4b00eb 100644
--- a/src/lib/acl/tests/logic_check_test.cc
+++ b/src/lib/acl/tests/logic_check_test.cc
@@ -163,4 +163,46 @@ TEST_F(LogicCreatorTest, allRun) {
     log_.checkFirst(2);
 }
 
+// Or is able to return false
+TEST_F(LogicCreatorTest, anyFalse) {
+    AnyOfPtr any(load<AnyOf>("{\"ANY\": ["
+                             "    {\"logcheck\": [0, false]},"
+                             "    {\"logcheck\": [1, false]},"
+                             "    {\"logcheck\": [2, false]}"
+                             "]}"));
+    EXPECT_EQ(3, any->getSubexpressions().size());
+    EXPECT_FALSE(any->matches(log_));
+    log_.checkFirst(3);
+}
+
+// And is able to return true
+TEST_F(LogicCreatorTest, andTrue) {
+    AllOfPtr all(load<AllOf>("{\"ALL\": ["
+                             "    {\"logcheck\": [0, true]},"
+                             "    {\"logcheck\": [1, true]},"
+                             "    {\"logcheck\": [2, true]}"
+                             "]}"));
+    EXPECT_EQ(3, all->getSubexpressions().size());
+    EXPECT_TRUE(all->matches(log_));
+    log_.checkFirst(3);
+}
+
+// We can nest them together
+TEST_F(LogicCreatorTest, nested) {
+    AllOfPtr all(load<AllOf>("{\"ALL\": ["
+                             "    {\"ANY\": ["
+                             "        {\"logcheck\": [0, true]},"
+                             "        {\"logcheck\": [2, true]},"
+                             "    ]},"
+                             "    {\"logcheck\": [1, false]}"
+                             "]}"));
+    EXPECT_EQ(2, all->getSubexpressions().size());
+    const LogicOperator<AnyOfSpec, Log>*
+        any(dynamic_cast<const LogicOperator<AnyOfSpec, Log>*>
+            (all->getSubexpressions()[0]));
+    EXPECT_EQ(2, any->getSubexpressions().size());
+    EXPECT_FALSE(all->matches(log_));
+    log_.checkFirst(2);
+}
+
 }




More information about the bind10-changes mailing list