BIND 10 trac997, updated. 92506a5cbf25744a70fb061ebe476160b3664e28 [trac978] More review comments

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jun 14 18:24:07 UTC 2011


The branch, trac997 has been updated
       via  92506a5cbf25744a70fb061ebe476160b3664e28 (commit)
      from  3f6fb6a54d85ed33bb23aa3988934166b17261c9 (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 92506a5cbf25744a70fb061ebe476160b3664e28
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Jun 14 20:23:43 2011 +0200

    [trac978] More review comments

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

Summary of changes:
 src/lib/acl/acl.h             |    7 ++++---
 src/lib/acl/tests/acl_test.cc |   38 +++++++++++++++++++-------------------
 2 files changed, 23 insertions(+), 22 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/acl/acl.h b/src/lib/acl/acl.h
index ec3dbbb..9ab5f7e 100644
--- a/src/lib/acl/acl.h
+++ b/src/lib/acl/acl.h
@@ -90,8 +90,9 @@ public:
      *     passed to the checks.
      */
     const Action& execute(const Context& context) const {
-        for (typename Entries::const_iterator i(entries_.begin());
-             i != entries_.end(); ++i) {
+        typename Entries::const_iterator end(entries_.end());
+        for (typename Entries::const_iterator i(entries_.begin()); i != end;
+             ++i) {
             if (i->first->matches(context)) {
                 return (i->second);
             }
@@ -126,7 +127,7 @@ protected:
      *
      * This is for testing purposes only.
      */
-    const Action& getDefaultAction() const {
+    const Action& get_default_action() const {
         return (default_action_);
     }
 };
diff --git a/src/lib/acl/tests/acl_test.cc b/src/lib/acl/tests/acl_test.cc
index e7e871b..67dfcf0 100644
--- a/src/lib/acl/tests/acl_test.cc
+++ b/src/lib/acl/tests/acl_test.cc
@@ -80,54 +80,54 @@ private:
     bool accepts_;
 };
 
-// Test version of the Acl class. It adds few methods to examine the protected
+// Test version of the ACL class. It adds few methods to examine the protected
 // data, but does not change the implementation.
 class TestACL : public ACL<Log> {
 public:
     TestACL() :
         ACL(DROP)
     {}
-    // Check the stored policy there
-    void checkPolicy(BasicAction ac) {
-        EXPECT_EQ(getDefaultAction(), ac);
+    // Check the stored default action there
+    void check_default_action(BasicAction ac) {
+        EXPECT_EQ(get_default_action(), ac);
     }
 };
 
 // The test fixture. Contains some members so they don't need to be manually
 // created each time and some convenience functions.
-class AclTest : public ::testing::Test {
+class ACLTest : public ::testing::Test {
 public:
-    AclTest() :
+    ACLTest() :
         next_check_(0)
     {}
     TestACL acl_;
     Log log_;
     size_t next_check_;
-    shared_ptr<Check<Log> > getCheck(bool accepts) {
+    shared_ptr<Check<Log> > get_check(bool accepts) {
         return (shared_ptr<Check<Log> >(new ConstCheck(accepts,
                                                        next_check_++)));
     }
 };
 
 /*
- * This tests the policy (default return value) and that nothing is run
- * if nothing is inserted (it's hard to imagine otherwise though).
+ * This tests the default action and that nothing is run if nothing is
+ * inserted (it's hard to imagine otherwise though).
  *
  * We use the default ACL unchanged from the test class.
  */
-TEST_F(AclTest, emptyPolicy) {
-    acl_.checkPolicy(DROP);
+TEST_F(ACLTest, empty_rule) {
+    acl_.check_default_action(DROP);
     EXPECT_EQ(DROP, acl_.execute(log_));
     // No test was run
     log_.checkFirst(0);
 }
 
 /*
- * This tests the policy in case no check matches.
+ * This tests the default action in case no check matches.
  */
-TEST_F(AclTest, policy) {
-    acl_.append(getCheck(false), ACCEPT);
-    acl_.append(getCheck(false), REJECT);
+TEST_F(ACLTest, no_match) {
+    acl_.append(get_check(false), ACCEPT);
+    acl_.append(get_check(false), REJECT);
     EXPECT_EQ(DROP, acl_.execute(log_));
     // The first two checks were actually run (and didn't match)
     log_.checkFirst(2);
@@ -137,10 +137,10 @@ TEST_F(AclTest, policy) {
  * Checks that it takes the first matching check and returns the
  * value. Also checks that the others aren't run at all.
  */
-TEST_F(AclTest, check) {
-    acl_.append(getCheck(false), ACCEPT);
-    acl_.append(getCheck(true), REJECT);
-    acl_.append(getCheck(true), ACCEPT);
+TEST_F(ACLTest, check) {
+    acl_.append(get_check(false), ACCEPT);
+    acl_.append(get_check(true), REJECT);
+    acl_.append(get_check(true), ACCEPT);
     EXPECT_EQ(REJECT, acl_.execute(log_));
     log_.checkFirst(2);
 }




More information about the bind10-changes mailing list