-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue when two filter "excludes" have the same string length (#22)
- Loading branch information
1 parent
49399fb
commit 866c5f4
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "pch.h" | ||
#include <winmd_reader.h> | ||
|
||
using namespace winmd::reader; | ||
|
||
TEST_CASE("filter_simple") | ||
{ | ||
std::vector<std::string> include = { "N1", "N3", "N3.N4.N5" }; | ||
std::vector<std::string> exclude = { "N2", "N3.N4" }; | ||
|
||
filter f{ include, exclude }; | ||
|
||
REQUIRE(!f.empty()); | ||
|
||
REQUIRE(!f.includes("NN.T")); | ||
|
||
REQUIRE(f.includes("N1.T")); | ||
REQUIRE(f.includes("N3.T")); | ||
|
||
REQUIRE(!f.includes("N2.T")); | ||
REQUIRE(!f.includes("N3.N4.T")); | ||
|
||
REQUIRE(f.includes("N3.N4.N5.T")); | ||
} | ||
|
||
TEST_CASE("filter_excludes_same_length") | ||
{ | ||
std::vector<std::string> include = { "N.N1", "N.N2" }; | ||
std::vector<std::string> exclude = { "N.N3", "N.N4" }; | ||
|
||
filter f{ include, exclude }; | ||
|
||
REQUIRE(!f.empty()); | ||
|
||
REQUIRE(f.includes("N.N1.T")); | ||
REQUIRE(f.includes("N.N2.T")); | ||
|
||
REQUIRE(!f.includes("N.N3.T")); | ||
REQUIRE(!f.includes("N.N4.T")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters