Added relationship and scope filter test case
This commit is contained in:
@@ -158,7 +158,7 @@ std::optional<bool> subclass_filter::match(
|
||||
relationship_filter::relationship_filter(
|
||||
filter_t type, std::vector<relationship_t> relationships)
|
||||
: filter_visitor{type}
|
||||
, relationships_{std::move(relationships)}
|
||||
, relationships_{relationships}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ std::optional<bool> relationship_filter::match(
|
||||
|
||||
scope_filter::scope_filter(filter_t type, std::vector<scope_t> scopes)
|
||||
: filter_visitor{type}
|
||||
, scopes_{std::move(scopes)}
|
||||
, scopes_{scopes}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -263,9 +263,9 @@ void diagram_filter::init_filters(const config::diagram &c)
|
||||
exclusive_.emplace_back(std::make_unique<element_filter>(
|
||||
filter_t::kExclusive, c.exclude().elements));
|
||||
exclusive_.emplace_back(std::make_unique<relationship_filter>(
|
||||
filter_t::kExclusive, c.include().relationships));
|
||||
filter_t::kExclusive, c.exclude().relationships));
|
||||
exclusive_.emplace_back(std::make_unique<scope_filter>(
|
||||
filter_t::kExclusive, c.include().scopes));
|
||||
filter_t::kExclusive, c.exclude().scopes));
|
||||
exclusive_.emplace_back(std::make_unique<subclass_filter>(
|
||||
filter_t::kExclusive, c.exclude().subclasses));
|
||||
exclusive_.emplace_back(std::make_unique<context_filter>(
|
||||
|
||||
@@ -137,8 +137,8 @@ public:
|
||||
bool exc = std::any_of(
|
||||
exclusive_.begin(), exclusive_.end(), [this, &e](const auto &ex) {
|
||||
auto m = ex->match(diagram_, e);
|
||||
// Return a match if a filter is undefined for specific element
|
||||
// or it's a match
|
||||
// Return true if a filter is defined for specific element
|
||||
// and it's a match
|
||||
return m.has_value() && m.value();
|
||||
});
|
||||
if (exc)
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
bool inc = std::all_of(
|
||||
inclusive_.begin(), inclusive_.end(), [this, &e](const auto &in) {
|
||||
auto m = in->match(diagram_, e);
|
||||
// Return a match if a filter is undefined for specific element
|
||||
// Return true if a filter is undefined for specific element
|
||||
// or it's a match
|
||||
return !m.has_value() || m.value();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user