BIND 10 trac981, updated. 2ab154b25ceb6264f87ba6a3ca139ec44c7db275 [trac981] Doxygen documentation

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Jul 4 11:55:23 UTC 2011


The branch, trac981 has been updated
       via  2ab154b25ceb6264f87ba6a3ca139ec44c7db275 (commit)
       via  faa2bca6751f7a8837e8c593ae723ea81fd40b69 (commit)
       via  2e29bef63a7fa200af54b9b0fc69e5cf2573b467 (commit)
      from  4d81613695a03b3d39adb5b54822dc1a07a37af0 (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 2ab154b25ceb6264f87ba6a3ca139ec44c7db275
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Jul 4 13:54:49 2011 +0200

    [trac981] Doxygen documentation

commit faa2bca6751f7a8837e8c593ae723ea81fd40b69
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Jul 4 13:48:03 2011 +0200

    [trac981] Implementation of NOT

commit 2e29bef63a7fa200af54b9b0fc69e5cf2573b467
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Jul 4 13:39:58 2011 +0200

    [trac981] Tests for the NOT operator

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

Summary of changes:
 src/lib/acl/logic_check.h             |   36 +++++++++++++++++++++++++++++++++
 src/lib/acl/tests/logic_check_test.cc |   20 ++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/acl/logic_check.h b/src/lib/acl/logic_check.h
index 6e1c567..cf511ba 100644
--- a/src/lib/acl/logic_check.h
+++ b/src/lib/acl/logic_check.h
@@ -200,6 +200,42 @@ private:
     const std::string name_;
 };
 
+/**
+ * \brief The NOT operator for ACLs.
+ *
+ * This simply returns the negation of whatever returns the subexpression.
+ */
+template<typename Context>
+class NotCheck : public CompoundCheck<Context> {
+public:
+    /**
+     * \brief Constructor
+     *
+     * \param expr The subexpression to be negated by this NOT.
+     */
+    NotCheck(const boost::shared_ptr<Check<Context> >& expr) :
+        expr_(expr)
+    { }
+    /**
+     * \brief The list of subexpressions
+     *
+     * \return The vector will contain single value and it is the expression
+     *     passed by constructor.
+     */
+    virtual typename CompoundCheck<Context>::Checks getSubexpressions() const {
+        typename CompoundCheck<Context>::Checks result;
+        result.push_back(expr_.get());
+        return (result);
+    }
+    /// \brief The matching function
+    virtual bool matches(const Context& context) const {
+        return (!expr_->matches(context));
+    }
+private:
+    /// \brief The subexpression
+    const boost::shared_ptr<Check<Context> > expr_;
+};
+
 }
 }
 
diff --git a/src/lib/acl/tests/logic_check_test.cc b/src/lib/acl/tests/logic_check_test.cc
index eec6d51..2e5fa58 100644
--- a/src/lib/acl/tests/logic_check_test.cc
+++ b/src/lib/acl/tests/logic_check_test.cc
@@ -242,4 +242,24 @@ TEST_F(LogicCreatorTest, nested) {
     log_.checkFirst(2);
 }
 
+void notTest(bool value) {
+    NotCheck<Log> notOp(shared_ptr<Check<Log> >(new ConstCheck(value, 0)));
+    Log log;
+    // It returns negated value
+    EXPECT_EQ(!value, notOp.matches(log));
+    // And runs the only one thing there
+    log.checkFirst(1);
+    // Check the getSubexpressions does sane things
+    ASSERT_EQ(1, notOp.getSubexpressions().size());
+    EXPECT_EQ(value, notOp.getSubexpressions()[0]->matches(log));
+}
+
+TEST(Not, trueValue) {
+    notTest(true);
+}
+
+TEST(Not, falseValue) {
+    notTest(false);
+}
+
 }




More information about the bind10-changes mailing list