]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[trac981] Implementation of NOT
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 4 Jul 2011 11:48:03 +0000 (13:48 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 4 Jul 2011 11:48:03 +0000 (13:48 +0200)
src/lib/acl/logic_check.h
src/lib/acl/tests/logic_check_test.cc

index 70e657affc16f6403d08bf391f89a155d69cbdbe..f9fbec2e8cb80ef065ab21aafeca03d73c347008 100644 (file)
@@ -203,13 +203,16 @@ private:
 template<typename Context>
 class NotCheck : public CompoundCheck<Context> {
 public:
-    NotCheck(const boost::shared_ptr<Check<Context> >& expr) {
-
-    }
+    NotCheck(const boost::shared_ptr<Check<Context> >& expr) :
+        expr_(expr)
+    }
     virtual typename CompoundCheck<Context>::Checks getSubexpressions() const {
-
+        typename CompoundCheck<Context>::Checks result;
+        result.push_back(expr_.get());
+        return (result);
     }
     virtual bool matches(const Context& context) const {
+        return (!expr_->matches(context));
     }
 private:
     const boost::shared_ptr<Check<Context> > expr_;
index 3bf13dc5e4a623af9b68f3647929e0098f656a4b..2e5fa58dcf04d190735de3ff54db1c9e86f3a53a 100644 (file)
@@ -258,8 +258,8 @@ TEST(Not, trueValue) {
     notTest(true);
 }
 
-TEST(Not, trueValue) {
-    notTest(true);
+TEST(Not, falseValue) {
+    notTest(false);
 }
 
 }