From: Michal 'vorner' Vaner Date: Mon, 4 Jul 2011 11:48:03 +0000 (+0200) Subject: [trac981] Implementation of NOT X-Git-Tag: perftcpdns_before_epoll~263^2~1^2~1^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=faa2bca6751f7a8837e8c593ae723ea81fd40b69;p=thirdparty%2Fkea.git [trac981] Implementation of NOT --- diff --git a/src/lib/acl/logic_check.h b/src/lib/acl/logic_check.h index 70e657affc..f9fbec2e8c 100644 --- a/src/lib/acl/logic_check.h +++ b/src/lib/acl/logic_check.h @@ -203,13 +203,16 @@ private: template class NotCheck : public CompoundCheck { public: - NotCheck(const boost::shared_ptr >& expr) { - - } + NotCheck(const boost::shared_ptr >& expr) : + expr_(expr) + { } virtual typename CompoundCheck::Checks getSubexpressions() const { - + typename CompoundCheck::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 > expr_; diff --git a/src/lib/acl/tests/logic_check_test.cc b/src/lib/acl/tests/logic_check_test.cc index 3bf13dc5e4..2e5fa58dcf 100644 --- a/src/lib/acl/tests/logic_check_test.cc +++ b/src/lib/acl/tests/logic_check_test.cc @@ -258,8 +258,8 @@ TEST(Not, trueValue) { notTest(true); } -TEST(Not, trueValue) { - notTest(true); +TEST(Not, falseValue) { + notTest(false); } }