reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 77ca71712b3c6f5b58e3ef3da64c9e653ea7178a
parent 3b2fee25962b9155a1aa3141a4fa2392629c2569
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu,  1 Sep 2016 23:07:27 -0400

filter: make "NOT NOT" cancel itself

Diffstat:
Msrc/filter.cpp | 3+--
Mtest/filter.cpp | 6++++++
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/filter.cpp b/src/filter.cpp @@ -36,7 +36,6 @@ void Filter::set(const string &input) bool append = false; auto push = [&] { - size_t size = token.buf.size(); if(!size) @@ -50,7 +49,7 @@ void Filter::set(const string &input) } else if(token.buf == "NOT") { token.buf.clear(); - token.flags |= NotFlag; + token.flags ^= NotFlag; return; } } diff --git a/test/filter.cpp b/test/filter.cpp @@ -232,6 +232,12 @@ TEST_CASE("NOT operator", M) { REQUIRE(f.match({"hello bacon"})); REQUIRE(f.match({"hello", "bacon"})); } + + SECTION("NOT NOT") { + f.set("NOT NOT hello"); + REQUIRE(f.match({"hello"})); + REQUIRE_FALSE(f.match({"world"})); + } } TEST_CASE("empty filter", M) {